How to set default runlevel?

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


Solution 1:

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.