Debian boot to single-user mode

xorinzor asked:

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?

My answer:

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.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.