In my earleir article Resetting Linux root password on Centos/Red Hat, I showed you how to reset forgotten root password on Red hat and Centos. That method can be used for Ubuntu too but it has a lot easier way to accomplish it.This howto will show you how to reset root password on Ubuntu.
Boot the system and when you see the following screen, press ESC as it says

At the following screen, select the entry with Recovery Mode and press Enter
Then when you see the following screen, select Drop to root shell prompt
The system will drop you to single user mode.
Now change the password and reboot
passwdreboot
to restart the system.



















If you don’t have a recovery mode line in your menu.list file, you can edit the boot command line by pressing “e”, and then adding “init=/bin/bash” to the end. Then instead of running init to get things started, it will drop you into a shell ASAP, and you can run any command you like, including passwd.