Shift while booting (Esc for v9 earlier version);

Highlight the normal booting item (actually, it is highlighted by default);

'e' to edit;

Find the line starts with "linux ....";

Edit "ro" (read only) to "rw", and add "init=/bin/bash" to the end of the line;

Ctrl+x or F10 to boot using this modified temporary item;

Root shell will be available, passwd to modify and then reboot.

 

ref:

https://help.ubuntu.com/community/LostPassword > The Other Way