How-To: Change boot runlevel with Grub2

1 minute read

Linux start up behaviour is driven by the so-called runlevels. It will use the default value provided in /etc/inittab for some systems (Debian…), or /etc/init/rc-sysinit.conf or some others (Ubuntu…).

This tutorial will show how to change the runlevel used during boot by modifying Grub2 start up prompt.

One of the common use case to change runlevel during boot is when you lost the root password and need to change it. In that case, you will want to boot linux in runlevel 1, this runlevel is a single user mode and makes you land on a system directly with a root prompt \o/.

This is also called in many distribution as the Recovery mode or Rescue mode.

Accessing Grub Screen

Grub2 Startup In order to be able to modify the runlevel used at boot, you will first need to access Grub 2 boot start up screen. Most distro will stay on that screen for about 10 seconds and will boot a default kernel in case you did not touch any keys, on some others, this screen is getting more and more hidden and in that case, you will need to try out a combinaison of either Esc or Shift keys until you get Grub2 startup screen.

Editing boot parameters

Once there, you need to enter

e

On the Grub entry you would like to boot.

Boot parameter edition This will get you to the boot parameter edition screen.

You now need to go to the end of the linux line and add a 1.

Booting it

Finally, hit F10 or Ctrl-x to boot linux with this new parameter.

root prompt You should now have a root prompt!