Getting into single-user mode if you want to reset the root password on Ubuntu server 18.04…
Please follow the below steps.
I am doing this in an oracle virtual machine, The steps will be almost similar in physical or virtual machines. ( Maybe there are some changes depending on the bios or the grub version you are currently on)
After POST (Bios Animation, In this case, oracle virtual box screen) Press Esc as quickly as possible. Some times the screen goes so quick that we have to reboot again and try a few times to get the above screen (Screen-1). You will be seeing something similar to this, press “e” to edit the grub line you will see something like below image starting with “setparams.” See (Screen-2)
Use your arrow key to reach till the line “ Linux boot/vmlinuz…… “ at the end of the line, you will see something like below code.
“ro quiet splash $vt_handof”
Refer screen-3
remove it and add
“rw init=/bin/sh”
then press ctrl +x to boot, this will drop you in it the shell.
Some times you have to remount / as “rw ” to make the changes take effect. For that
mount -n -o remount rw /
You can change the password from here with the normal password command. After successfully changing the password reboot/reset the pc/server/virtual machine.
For any other tasks please use the ubuntu advance rescue environment to perform a suitable task. Please note that you should know the root password in these advance modes to proceed with the task.
For booting into the advance rescue environment you should follow the step until you get Screen-1, choose the advance option for ubuntu.
After pressing you will be greeted with 2 options “Ubuntu , with Linux x.x.x-generic and Ubuntu, with linux x.x.x-x (recovery mode)
Choose the recovery mode, You will be able to see a quick menu for various tasks. Refer Screen-8
Now you can choose the respective task from here and perform it.