Booting a Linux system into a different target (also known as runlevel in older versions of Linux) can be achieved by using the systemd
utility. This is a system and service manager for Linux operating systems.
Manually switch to a different target
To manually switch to a different target, you use the systemctl
command followed by the isolate
command and the name of the target. The isolate
command will start the target specified and all its dependencies and stop all others. Here’s an example:
sudo systemctl isolate multi-user.target
This command will take you to a console-only multi-user mode, which is similar to the traditional runlevel 3.
Here are the common systemd
targets:
poweroff.target
: Halt the system.rescue.target
: Single user mode.multi-user.target
: Multi-user, non-graphical. Users can usually login via multiple consoles or via the network.graphical.target
: Multi-user, graphical. Typically has all the services of multi-user.target plus a graphical login.reboot.target
: Rebootemergency.target
: Emergency shell
Boot into a different target by default during system boot
If you wish to boot into a different target by default during system boot, you can use systemctl set-default
. Here is an example:
sudo systemctl set-default multi-user.target
This command sets the system to boot into the multi-user target by default.
To check what target you are currently in, you can use the command systemctl get-default
.