If indicated by Harris, it does not work try:
Download Ubuntu iso image.
Burn it to a Dvd or Usb.
Start Computer / reboot computer.
Make sure BIOS is set to boot from Dvd/Usb
Put your Ubuntu Live-Dvd/Usb
Now booting will start from Ubuntu Live-Dvd/Usb
You will see two option screen - select Try it
You will system is booting in to Live-session
Open a terminal
Find out your root partition
sudo su
fdisk -l
Suppose it is /dev/sda1, run the following commands:
mount /dev/sda1 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
Note: Replace /dev/sda1, for its partition.
Chroot is an operation that changes the apparent root directory (live-session) for the current running process (hard disk installation).
Now you can change the root password:
passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
If you want to change password for Ubuntu user:
passwd user-name