Switching Linux Systemd Boot Targets
Systemd replaced traditional init on most modern Linux distributions, shifting terminology from “runlevels” to “targets.” If you’re migrating from older systems, here’s the mapping:
| Runlevel | Systemd Target | Purpose |
|---|---|---|
| 0 | poweroff.target |
Shutdown |
| 1 | rescue.target |
Single-user mode |
| 2, 3, 4 | multi-user.target |
Multi-user, no GUI |
| 5 | graphical.target |
Multi-user with GUI |
| 6 | reboot.target |
Reboot |
The two targets you’ll use most are multi-user.target (CLI only) and graphical.target (desktop environment).
Checking the Current Target
View your default boot target:
systemctl get-default
List all currently active targets:
systemctl list-units --type target
See all targets installed on your system:
systemctl list-unit-files --type target
Switching Target Immediately
Use isolate to switch the active target without rebooting:
sudo systemctl isolate multi-user.target
Or to switch to graphical mode:
sudo systemctl isolate graphical.target
The isolate command starts the target and its dependencies while stopping conflicting units—equivalent to the legacy init 3 or init 5 commands.
Important caveat: isolate may interrupt active services. In production environments, plan for potential downtime. Switching from graphical to multi-user will terminate your display manager and X11/Wayland session, killing any unsaved work in running applications. Use this primarily for troubleshooting or scheduled maintenance windows.
Setting the Default Boot Target
Permanently change what target loads on boot:
sudo systemctl set-default multi-user.target
Or for graphical mode:
sudo systemctl set-default graphical.target
Verify the change:
systemctl get-default
This creates or updates a symlink at /etc/systemd/system/default.target. Run it once—systemd handles all necessary setup. The enable command isn’t needed for targets.
Rescue and Emergency Targets
Rescue Mode
Boot into a minimal environment for troubleshooting:
sudo systemctl isolate rescue.target
Rescue mode requires the root password and disables most non-critical services. Use it for:
- System repairs without full multi-user mode
- Filesystem checks and repairs
- Emergency configuration changes
To boot into rescue on the next restart:
sudo systemctl set-default rescue.target
sudo reboot
After repairs, restore your normal target:
sudo systemctl set-default graphical.target
sudo systemctl isolate graphical.target
Emergency Mode
For severe troubleshooting when rescue mode isn’t sufficient:
sudo systemctl isolate emergency.target
Emergency mode provides only the root filesystem—mounted read-only—with virtually no services running. The root password is required. Use this only when:
rescue.targetwon’t boot- You need maximum isolation to diagnose filesystem or boot issues
- You can’t mount additional filesystems
After emergency repairs, reboot cleanly:
sudo systemctl reboot
Don’t isolate back to graphical mode after emergency repairs; a clean reboot ensures filesystem checks run properly.
Understanding the Default Target Symlink
Systemd manages the default target via a symlink. View it with:
ls -l /etc/systemd/system/default.target
This symlink points to a file in /usr/lib/systemd/system/. Never manually edit this symlink—always use systemctl set-default. This command is idempotent, integrates with systemd’s management layer, and prevents configuration errors.
Common Workflows
Disable GUI for Lower Resource Usage
sudo systemctl set-default multi-user.target
sudo systemctl isolate multi-user.target
Re-enable GUI
sudo systemctl set-default graphical.target
sudo systemctl start graphical.target
Here, start launches the graphical target without stopping multi-user services—usually sufficient. Use isolate only if you encounter conflicts between targets.
Check What Loads at Boot Without Rebooting
systemctl list-unit-files | grep enabled
systemctl list-dependencies graphical.target
The first command shows all enabled services. The second displays the full dependency chain for your default target, confirming what will start on boot.
View All Unit Dependencies for a Target
systemctl list-dependencies --all multi-user.target
This recursively shows every service, socket, and timer that a target depends on, useful for understanding what runs when you boot into a given mode.
Troubleshooting
If you accidentally set the wrong default target and can’t reach the GUI:
- Boot the system (you’ll land at a CLI login)
- Log in as root or a sudoer
- Run
sudo systemctl set-default graphical.target - Reboot
If the system won’t boot to rescue mode, interrupt the boot process at the GRUB menu (hold Shift during boot on many systems) and append systemd.unit=rescue.target to the kernel command line. This forces the kernel to boot into rescue mode for one boot cycle.

thanks! good tutorial
aggreat!
Good article, thanks!
Is there a way to set the target via grub? I’d like to have an entry in my grub menu for booting to graphical/multi-user.
To put Ubuntu 19.04 into Runlevel 2 (Terminal):
sudo systemctl set-default multi-user.target
To reverse:
sudo systemctl set-default graphical.target
Is there a way to give a user with minimal permissions just the NON GUI access and the root user will have full GUI access? I basically have an Ubuntu system shared by multiple users. I want to be the root user with full access. On boot, when a non-root user logs in, it should boot to non-GUI version of Ubuntu with my app running. But when I login with my root account, I should have the GUI version boot up. Thank you!
If you have limited the non-root users’ ability to run your applications only, one possible way is to run the system in multi-user target/text mode. For root, after login, you can use
startxcommand to start the X session from the terminal.Of course you can restrict users from running certain applications, but if you are about to give them a general shell, they may still find a way to circumvent that. What you want is a restricted shell, e.g. add your app to “/etc/shells”, then set it as the shell of any restricted user in “/etc/passwd”. As long as your application doesn’t allow the user to break out of it, you should be fine.
As for the root user’s graphical environment, set just set your default to multi-user.target, then use startx after login to start your desktop. Disable or uninstall any display managers.
You don’t need to enable targets. At least on my system this produces an error message, and trying to disable one does nothing. Furthermore, since graphical.target depends on multi-user.target, it is active anyway. While in sysv-init, runlevels used to be separate from each other, systemd builds a dependency tree, so one target may include another.