Howto:Recover your username and password/Fix Grub 21 Error in Ubuntu

Sponsored Link
Recovering Your forgotten username and password

If You just installed Ubuntu and forgot what password you selected during the installation process or one of your friend gave you ubuntu computer without giving username and password.This tutorial will help you to recover username and password

1) Turn on your computer, and as soon as you the Press Esc to enter grub message, press the escape key.

2) Select the option that says (recovery mode).

3) Your PC will boot into a shell. Once you get a command prompt, type "passwd username" where the username is your username. If you can't remember your username, then you can type "ls /home" which should bring it up.

4) Enter a new password when prompted, and again when prompted again Type "shutdown -r now" to reboot your system,

That's it. You should now be able to login with your new password.

Fix Grub 21 Error in Ubuntu


I've just tried installing Ubuntu but when it restert for the first time, GRUB returns an Error 21. I know this means that it can't find the grub.conf file, but I don't know how to fix this. I used Windows XP's Recovery Console to get back into XP, but I can't access the GRUB files.

1. Boot your computer up with Ubuntu CD

2. Open a terminal window or switch to a tty.

3. Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary.

4. Type "grub"

5. Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)".

Use whatever your computer spits out for the following lines.

6. Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu.

7. Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition.

8. Quit grub by typing "quit".

9. Reboot and remove the bootable CD.

Note:- In the above procedure hd0,1 is an example it might be different in your case.

Related posts

26 thoughts on “Howto:Recover your username and password/Fix Grub 21 Error in Ubuntu

  1. If you don’t like the idea of anyone being able to boot recovery mode then set grub passwords.

    Then change your BIOS so prevent booting off removable media.
    Then lock your PC case to prevent BIOS resets.
    Then fix your firewire ports (
    Does e-sata have the same problem? Probably. Best just to epoxy all your PC ports.
    Then fix your wireless (
    Finally encase your PC in cement and throw it into the ocean 🙂

  2. …or encrypt your filesystems so it doesn’t matter if someone can read your hard drive or not! Of course, THEN if you lose your password you’re truly out of luck….

  3. @Thomas : and modify your /boot/grub/menu.lst to add a password and tun “lock alternative” to true !

  4. I got the “error 21” and tried using your recovery system. One problem (I think); I get “answers. I get “(hd1,4) and (hd1,6).” I tried using the first, the second, and both. I get a screen that says, “Probing devices to guess BIOS drives. This may take a long time. [email protected]:-#” with a flashing square. But the hard drive doesn’t show activity. I tried reboot, but still get the dreaded error 21. What am I doing wrong?


  5. VENKAT says…

    Its very helpful to me.I have recovered my ubuntu password and user name.Thank u very much

  6. HELP!!! i’ve made a major boo-boo, whilst trying to remove one user to set up another, I seem to have removed all users from the webbook so I cannot get into it!!! when i tried the tip above, it told me that the directory was not found. Any ideas????

  7. It didn’t let me type in a new password. please help me, i need the computer to work!
    Please reply

  8. It worked! I have been trying to get into Ubuntu all day. My XP isn’t working well, even after trying the Recovery Console, so I thought I’d just give Ubuntu a try. I heard so much about how much better it is than Windows. I followed your instructions and got the username first – I had never been prompted for it, nor a password. Once I got the user name it allowed me to change the password. Thanks so much! I am now able to use it. On to discovering =)

    Oh, I did go thru the recovery mode first like the instructions said.

  9. dear friends i need to see the current password before i login is there any command like ls/home to show the current password…
    thank u for your coming help!

  10. I’ve tried using this recovery system and I get stuck on setting a new password. It doesn’t let me make a new one and the old one doesn’t work. I had to use the ls /home in order to get the username to come up and suggestions ???

  11. I have also tried this fix. but i get a line to input a unix password. the screen will not allow anything to be typed in. I am running ubuntu 8.1 and I can’t download updates without a password

  12. I was first using ubuntu 9.10 which always ask for administrators password before i can access my windows 7 partition and i think its cool that way …. but now that i install the version 10.10 i can’t have that again and i think my windows partition is not secured …. please can anyone help me…

  13. hi

    i hav’nt used my linkbook laptop in 8 months. i forgot my username and password. how do i retrieve my information. please help

  14. I have a linkbook 8.9″ tft screen with 16Gb flash storage need help with password cannot remember password

  15. The screen goes on but everything is frozen. I dont have a password set yet. I dont understand why its locked. Its showing a lock on the screen

  16. Thanks for the tutorial but step number 1 seems to be missing some words where it says:
    Turn on your computer, and as soon as you the Press Esc to enter grub message, press the escape key.

    I seek clarification on this stage

    Thank you

  17. I did well in the start thankyou but it refuses to type the new password what must I do

Leave a comment

Your email address will not be published. Required fields are marked *