Saturday, November 4, 2017

Change Default runlevel in Debian 9


Switch to the root user.


sudo su -


su -

Method 1

Let’s check the current run level by using the following command.

# systemctl get-default graphical.target

Before changing the default runlevel, check out the available targets.

# systemctl list-units --type=target

The output will look like below:


 Issue the following command to change the default runlevel to runlevel 3 (nothing but a multi-user.target).

# systemctl set-default multi-user.target

 Confirm the default runlevel.

 # systemctl get-default multi-user.target

Reboot and check it out.

 # reboot

Method 2

 In the previous method, we made the runlevel 3 as the default runlevel. You can also confirm that using the following command.


# systemctl get-default multi-user.target

 For a demo, issue the following command to make runlevel 5 as the default runlevel.

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target


# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

 Again check the current level. Now the default runlevel is graphical mode(runlevel 5).