If you get locked out of an Ubuntu 16.04 Xenial Xerus Linux instance some how… and have access to it’s boot somehow (oob or physical access) you can easily reset passwords by changing a line in the default grub loader
Hold shift, or escape at boot to get it to pause .. If you need more time and are running VirtualBox: buy your self more time
Select your default boot record, and hit e ^^– Hit the ‘e’ key on your keyboard
Scroll down to the line that starts with Linux
change the end of the line from ro to: rw init=/bin/bash
hit f10 to boot
use passwd to change reset the root password, or a user password:
finish normal boot by executing \# exec /sbin/init
Login with success!