How to check and change a default runlevel on Ubuntu Linux

To check your current and previous runlevel use runlevel command:

# runlevel 
N 2

From the above command output we can see that there was no previous runlevel detected and current run level is 2. Runlevel list defined by the Ubuntu Linux:

  • 1 – Single
  • 2,3,4,5 – User defined runlevels. Default 2
  • 6 – Reboot

To temporarily change the runlevel on your Ubuntu Linux system use telinit or directly invoke init command. The following linux command will change runlevel to 1:

# init 1
OR
# telinit 1


To permanently change your runlevel on Ubuntu Linux edit the following line within /etc/init/rc-sysinit.conf:

env DEFAULT_RUNLEVEL=2

Another alternative on how to change a default runlevel on Ubuntu Linux is to edit Grub’s default startup sequence. Locate /etc/default/grub file and edit line:

GRUB_CMDLINE_LINUX=""

To include your desired runlevel. For example to change default runlevel to 5 edit the above line to desired runlevel. For example to change to runlevel 5 insert:

GRUB_CMDLINE_LINUX="5"

and run Grub update command with administrative privileges:

# update-grub

After reboot the system will now boot to runlevel 5.