Sunday, February 13, 2011

Single User / Recovery Mode without root password for maintenance

Original article at :  http://www.noah.org/wiki/Single_User_Mode

This method will get you pass the "Give root password for maintenance" message, the environment will be much more primitive but this should be enough for you to issue a 'passwd' command to change the password for root. If you want to do more than that then you may have to mount filesystems and manually start the network.
  1. Reboot your machine; press 'Esc' to get to the GRUB menu; select your image; press 'e' to edit; select the Kernel line.
  2. Press 'e' to edit the kernel line. Edit the line to get rid of quiet and splash; change 'ro' to 'rw'; and add 'init=/bin/bash'. The line should look something like this (kernel version might be different) :
    kernel /vmlinuz-2.6.15-27-386 root=/dev/mapper/Ubuntu-root rw init=/bin/bash
  3. Press 'enter' then 'b' to boot with these new settings. 
Update :
For GRUB2, if you don't get the GRUB menu while booting, you need to press "SHIFT" key after BIOS shown up until GRUB menu displayed.
Also to boot after editing the entry, you need to press "CONTROL-X" .