6

I would like to know how to set a default runlevel? This is to ensure that my computer directly boots at the set level .

muru
  • 197,895
  • 55
  • 485
  • 740
gnsr
  • 1,107
  • 4
    The concept of runlevels is somewhat depreciated with both upstart and systemd. With systemd it is termed "states" - nice reiew - https://www.linux.com/learn/tutorials/794615-systemd-runlevels-and-service-management . runlevels are still emulated in some distros, most still use the concept of runlevels 0 , 1, 6 . On Debian and Ubunt 2 = 3 = 4 = 5. For upstart see https://help.ubuntu.com/community/UpstartHowto#How_do_I_change_the_runlevel.3F – Panther Apr 29 '15 at 03:40

1 Answers1

10

The simpler way is to edit /etc/init/rc-sysinit.conf and change:

env DEFAULT_RUNLEVEL=2

To:

env DEFAULT_RUNLEVEL=N

Where N is the desired runlevel.


The runlevel can be set using kernel parameters. Edit /etc/default/grub, and change:

GRUB_CMDLINE_LINUX="

to

GRUB_CMDLINE_LINUX="N"

Where N is the runlevel you want. Then run:

sudo update-grub

You can also force a one-time boot to a different runlevel by editing the command line from the GRUB menu at boot.


In practice, remember that runlevels 2-5 have no difference in the default Ubuntu setup. So don't expect anything different to happen if you boot to runlevel 3.

PKumar
  • 2,952
muru
  • 197,895
  • 55
  • 485
  • 740