Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I forgot my root password and am attempting to change it by booting into single-user mode, however when booting I get this screen:

enter image description here

Then I press "e" to edit the boot configuration and I get this screen:

enter image description here

However, in the tutorial I'm following it says I should navigate to the line that starts with "kernel", but as you can see, I dont have this line. So I tried changing "quiet" to "single" on the line that starts with "linux /boot/vmlinuz...." but this doesn't boots the system into single-user mode.

What line am I supposed to edit in order for this to work?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

One method:

  1. Append init=/bin/bash to the end of the grub line which begins with linux (and ends with quiet).

  2. Reset your password and reboot normally.

  3. Don't forget it again.

  4. Consider installing sudo.


Another method:

  1. Since this is apparently a virtual machine, you can mount its disk on another (working) virtual machine and manually remove the password from the /etc/shadow file. Or use kpartx to work with the virtual machine image file from the host or from another machine.
share|improve this answer
    
Thanks that worked! –  xorinzor Feb 24 '13 at 23:17
    
Now it shows me "root@(none)#" though and it doesn't know any commands, how do I fix that? –  xorinzor Feb 24 '13 at 23:18
2  
You probably don't have a PATH. Try calling /usr/bin/passwd (or anything else) directly. Or just look around and see what you have available to you. –  Michael Hampton Feb 24 '13 at 23:19
1  
using /bin/bash as init won't call any of the startup scripts to mount partitions, etc. either so if you have /usr in a separate partition you'll need to mount it by hand. Also know that you won't get the shutdown scripts either, when bash exits the kernel will immediately halt. Be sure to sync the drives first or changes may not be written. –  DerfK Feb 25 '13 at 0:12

wooo, just choose the recovery mode dude, you'll be switch to a BusyBox without any kind of password (normally).

share|improve this answer
    
Just tried it, also asks for a login after booting, during the boot I get the same maintenance question asking me for the root password or to press ctrl+D to continue –  xorinzor Feb 24 '13 at 23:11
    
did you press Ctrl+D ? I already had such reaction on some linux tweaked box, and a Ctrl+D did the trick. –  Dr I Feb 24 '13 at 23:14
    
yes I did, but then it just resumes like a normal boot and asks for the login –  xorinzor Feb 24 '13 at 23:15
1  
@DrI Debian's default is to require the root password for single user mode. –  DerfK Feb 25 '13 at 0:14
    
Hum... are you sure?? I just installed a fresh Inet 6.0.6 version using default values for the setup and my single mode is NOT requiring any password. –  Dr I Feb 25 '13 at 10:02

Your tutorial refers to Grub (legacy Grub). This is Grub2. The line beginning with linux would be the kernel line in Grub.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.