Targets and runlevels
systemd targets are named synchronization points that group units — multi-user.target is a normal server, graphical.target adds a desktop. rescue.target and emergency.target are recovery modes. systemctl isolate switches the running system to a different target immediately.
A server is behaving strangely after an update — some services are broken, but you cannot afford a full reboot. You run systemctl isolate rescue.target. The system drops to a single-user shell, kills all non-essential services, and leaves the root filesystem mounted read-write. You fix the broken config, then systemctl isolate multi-user.target brings everything back — no reboot required.
That is targets in practice. They are not just a boot concept — they are live-switchable system states you can use for maintenance, recovery, and diagnosis while the machine stays up.
After this lesson you can explain what a systemd target is, list the key targets and what each activates, change the default boot target, use systemctl isolate to switch targets on a running system, and map SysV runlevels to their systemd equivalents.
A target is a named synchronization point — not a script, not a runlevel number. A .target unit in systemd is a unit whose only job is to pull in dependencies. When systemd activates multi-user.target, it resolves the dependency graph of everything that target Wants= or Requires=, starts them in parallel, and marks the target active when all required units are up.
# See what multi-user.target pulls in
systemctl show multi-user.target -p Wants,Requires,After
# List all currently active targets
systemctl list-units --type=targetTargets are additive: graphical.target depends on multi-user.target, which depends on basic.target, which depends on sysinit.target. Activating graphical.target activates the whole chain.
The key targets you will encounter. Each represents a distinct system state:
| Target | State | Typical use |
|---|---|---|
emergency.target | Root fs read-only, minimal shell | Filesystem corruption, cannot mount |
rescue.target | Root fs read-write, single user | Config repair, no network |
multi-user.target | Full multiuser, no GUI | Servers, headless systems |
graphical.target | multiuser + display manager | Desktops, workstations |
reboot.target | Reboot sequence | systemctl reboot activates this |
poweroff.target | Shutdown sequence | systemctl poweroff |
The difference between emergency and rescue: emergency does not even run the normal mount logic — you get the kernel’s minimal environment with root mounted read-only. Rescue runs the normal early boot mounts and gives you a root shell with the filesystem read-write.
How to view and change the default target. The default target is what systemd boots into automatically. On a server it is multi-user.target; on a desktop it is graphical.target.
# See the current default target
systemctl get-default
# Change the default (persists across reboots)
sudo systemctl set-default multi-user.target
# Equivalent: the default target is a symlink
ls -la /etc/systemd/system/default.targetset-default simply updates the symlink at /etc/systemd/system/default.target to point to the chosen target file. There is nothing hidden — you can verify it with ls -la.
systemctl isolate switches the live system to a different target. Isolating a target starts all units required by that target and stops all units not required by it. It is the live equivalent of rebooting into a different runlevel, but without a reboot.
# Drop to rescue mode (kills most services, keeps root shell)
sudo systemctl isolate rescue.target
# Return to full multiuser (starts all normal services back up)
sudo systemctl isolate multi-user.target
# Note: not all targets are isolatable — only those with AllowIsolate=yes
# Check:
systemctl show rescue.target -p AllowIsolateWarning: isolating to rescue.target on a production system will interrupt all running services — network, databases, everything. Always warn users and confirm maintenance windows before doing this on a live box.
SysV runlevel → systemd target mapping. SysV runlevels were integers 0–6. systemd provides compatibility targets that map to them, so scripts using runlevel or /etc/inittab still work as shims.
| SysV runlevel | systemd target | Meaning |
|---|---|---|
| 0 | poweroff.target | Halt |
| 1 | rescue.target | Single user |
| 2, 3, 4 | multi-user.target | Multiuser, no GUI |
| 5 | graphical.target | Multiuser + GUI |
| 6 | reboot.target | Reboot |
# Legacy runlevel command still works (reads from systemd)
runlevel # prints previous and current runlevel as numbers
# The old telinit command maps to systemctl isolate
sudo telinit 1 # equivalent to: systemctl isolate rescue.targetSwitch a broken desktop to multi-user mode without rebooting.
Scenario: A desktop system’s display manager (gdm3) crashes in a loop after a graphics driver update. The GUI is unusable but the machine is still reachable over SSH.
# Check current default (probably graphical.target)
systemctl get-default
# Switch to multi-user.target — kills the display manager loop
sudo systemctl isolate multi-user.target
# Now fix the driver issue (remove or downgrade)
sudo apt remove nvidia-driver-535
sudo apt install nvidia-driver-525
# Change the default so it does not boot to broken graphical on next boot
sudo systemctl set-default multi-user.target
# Reboot clean with the working driver
sudo reboot
# After confirming everything works, restore graphical default
sudo systemctl set-default graphical.targetThe key: isolate let you fix the problem without a reboot cycle, reducing downtime from “reboot → broken loop → reboot” to a single deliberate reboot at the end.
▸Why this works
macOS has no systemd targets or SysV runlevels. Its equivalent is launchd domains (system, user, GUI session) but there is no isolate concept — you cannot switch the running Mac to a single-user text mode without a reboot into Recovery Mode. On Linux, the live-switchable target system is a genuine operational advantage for servers that must minimize downtime.
▸Common mistake
A common confusion: rescue.target vs emergency.target. If your system cannot mount the root filesystem (e.g., bad /etc/fstab entry), systemd may automatically drop to emergency.target — the filesystem is mounted read-only. Running mount -o remount,rw / before editing /etc/fstab is the first thing to do. rescue.target is reached only when the root filesystem mounts successfully — so if you see rescue, your disk is fine; if you see emergency, suspect a mount or filesystem problem.
You want to permanently configure a server to boot to multi-user.target instead of graphical.target. Which command achieves this?
A systemd target is a named synchronization point that groups dependent units. The key server targets: emergency.target (ro root, minimal shell), rescue.target (rw root, single user), multi-user.target (full server), graphical.target (server + desktop). systemctl get-default and set-default read and write the default boot target. systemctl isolate switches the live system to a target — starting what it needs, stopping what it does not. SysV runlevels 1, 3, and 5 map to rescue, multi-user, and graphical targets respectively. emergency vs rescue: if the filesystem failed to mount, you get emergency; if it mounted, you get rescue.
Practice
Start at the top. Tasks go easiest → hardest: recall a fact, apply it to a case, then a senior-level stretch. Open one, attempt it, then reveal.
Something unclear?
Ask a question about this lesson. Questions are anonymous and go straight to the author to make the lesson better.