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

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

# systemctl set-default

 Confirm the default runlevel.

 # systemctl get-default

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

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

# ln -sf /lib/systemd/system/ /etc/systemd/system/

# ln -sf /lib/systemd/system/ /etc/systemd/system/

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