Table of Contents
Understanding systemd Boot Targets
Boot targets in systemd define what the system should look like after boot: which services are started, which are stopped, and which “mode” the machine is in (graphical, multi-user, rescue, etc.). They replace the old SysV “runlevels.”
This chapter focuses on:
- The most common targets and what they mean
- How to see and change the default boot target
- How to switch targets on a running system
- How to use special/emergency targets when things go wrong
You should already be familiar with basic systemctl usage from the parent chapter.
Common systemd Targets
Targets are unit files with the suffix .target. They group other units (mostly services) and may “pull in” each other.
Some of the most important system targets you will see on typical desktop/server distributions:
`rescue.target`
- Minimal single-user environment.
- Root filesystem is usually mounted read-only or with limited services.
- Networking may be disabled or very limited.
- Only basic system services start.
- Traditionally similar to “single-user mode” / runlevel 1.
Use cases:
- Fixing configuration issues (e.g.
/etc/fstab, bad drivers). - Stopping most services while you perform maintenance.
`multi-user.target`
- Multi-user, non-graphical mode.
- Network and most system services are started.
- No graphical login manager; you get text-based TTY logins.
- Rough equivalent to traditional runlevel 3 on many distros.
Use cases:
- Servers without GUI.
- Diagnostics when graphical environment is failing.
- Reducing resource usage by not starting desktop environment.
`graphical.target`
- Everything in
multi-user.target, plus graphical login and desktop environment. - Starts display managers like
gdm,sddm,lightdm, etc. - Typical mode for desktop/laptop systems.
Use cases:
- Normal desktop usage.
`emergency.target`
- Extremely minimal environment, even more barebones than
rescue.target. - Nearly nothing is started: no networking, no multi-user, often no
gettyon other TTYs. - Root filesystem may be mounted read-only.
- Provides a root shell on the console as early as possible.
Use cases:
- Severe boot problems (e.g. broken
/etc/fstab, corrupted system files). - When
rescue.targetwon’t start or is unstable.
Other notable targets
Depending on your distribution, you may also encounter:
poweroff.target– Shuts the system down and powers off.reboot.target– Reboots the system.halt.target– Halts the system without powering it off (less common).suspend.target,hibernate.target– For power-saving states.default.target– Alias (symlink) to the target the system boots into by default (usuallygraphical.targetormulti-user.target).
Inspecting Boot Targets
You interact with targets using systemctl just like with services.
List all targets
systemctl list-units --type=targetTo also see inactive targets:
systemctl list-unit-files --type=targetThis shows available targets and whether they’re enabled (i.e., may be reached automatically during boot).
Show information about a specific target
Example for multi-user.target:
systemctl status multi-user.targetTo see what the target pulls in:
systemctl show -p Wants,Requires multi-user.targetYou may also view the unit file itself:
systemctl cat multi-user.targetThis reveals:
[Unit]metadata and descriptionWants=andRequires=dependencies (other units it brings in)Conflicts=(units it cannot be active with at the same time)
Default Boot Target
The default boot target is what the system tries to reach during a normal boot. On many desktops this is graphical.target; on servers it’s often multi-user.target.
default.target is usually a symbolic link to the actual target:
ls -l /etc/systemd/system/default.targetExample output:
/etc/systemd/system/default.target -> /lib/systemd/system/graphical.targetShow the current default target
systemctl get-defaultExample:
$ systemctl get-default
graphical.targetChange the default boot target
Use set-default to change what the system enters on next boot:
- Make system boot to text-only multi-user mode:
sudo systemctl set-default multi-user.target- Make system boot with graphical login:
sudo systemctl set-default graphical.target
This command changes the default.target symlink; it doesn’t immediately switch the current session (that’s covered next).
Switching Targets at Runtime
You can move between targets on a running system without rebooting, as long as your current state allows it.
Isolating a target
systemctl isolate starts the specified target and stops units that are not part of it.
Examples:
- Switch from graphical to non-graphical multi-user mode:
sudo systemctl isolate multi-user.targetThis will stop the display manager and graphical session.
- Switch back to graphical mode:
sudo systemctl isolate graphical.targetConsiderations:
- Your current session may be terminated, especially when leaving
graphical.target. - Active SSH sessions might remain if they are wanted by the new target (they usually are in
multi-user.target).
Temporarily entering rescue mode
To switch to rescue mode from a running system:
sudo systemctl rescueThis is effectively an alias for:
sudo systemctl isolate rescue.targetYou’ll usually be asked for the root password (depending on distribution and configuration). Most services will stop, and you’ll get a root shell on the console.
To return to normal multi-user operation:
sudo systemctl isolate multi-user.targetOr, if you normally use the graphical interface:
sudo systemctl isolate graphical.targetUsing Boot Targets from the Boot Loader
You can choose targets at boot time without changing the default target permanently. This is especially useful for troubleshooting.
The details depend on your bootloader (often GRUB2), but the general idea is:
- At the GRUB menu, highlight your normal boot entry.
- Edit the kernel command line (usually by pressing
e). - Find the line starting with
linux(orlinuxefi). - Append one of the following options:
systemd.unit=rescue.targetsystemd.unit=multi-user.targetsystemd.unit=graphical.targetsystemd.unit=emergency.target- Boot with the modified line (usually
Ctrl+xorF10).
Example kernel line snippet:
linux /boot/vmlinuz-... root=/dev/sda2 ro quiet splash systemd.unit=multi-user.target
This affects only the current boot; the default target set with systemctl set-default is unchanged.
Rescue and Emergency Targets in Practice
When systems fail to boot correctly, rescue and emergency targets are crucial tools.
`rescue.target` behavior
Characteristics:
- Starts basic system services and a minimal login environment.
- May start only one TTY with a root login or may require root password.
- Often mounts filesystems according to
/etc/fstab(but with fewer checks than full boot).
Typical workflows:
- Fix an invalid
fstabmount option causing slow or failed boots. - Disable or mask a misbehaving service that prevents normal startup.
- Roll back a bad configuration change.
Enter rescue mode from the running system:
sudo systemctl rescueOr boot directly into it using the kernel parameter:
systemd.unit=rescue.target`emergency.target` behavior
Characteristics:
- Mounts the root filesystem, often read-only.
- Does not start normal system services, gettys, or networking (beyond the bare minimum).
- Immediately gives you a root shell on the console.
You typically use it when:
/etc/fstabis so broken that evenrescue.targethangs or fails.- Critical services or libraries are corrupted.
- You need to run very low-level repairs (e.g.
fsck) without interference.
From a running system:
sudo systemctl emergencyOr at boot with:
systemd.unit=emergency.targetYou may need to remount the root filesystem read-write before editing files:
mount -o remount,rw /Be extremely careful: in this state, there are almost no safety nets.
Custom and Specialized Targets
You can create your own targets to represent custom system states.
Creating a simple custom target
Example: maintenance.target which starts only a subset of services for administrative tasks.
- Create a unit file:
sudo nano /etc/systemd/system/maintenance.targetWith contents:
[Unit]
Description=Maintenance mode (no graphical login)
[Install]
WantedBy=multi-user.target- Enable it (so it appears as a bootable option or dependency):
sudo systemctl enable maintenance.target- Decide which services
maintenance.targetshould pull in by addingWantedBy=maintenance.targetin the relevant.serviceunits, or by creating drop-in config files.
Then you can:
- Switch into it at runtime:
sudo systemctl isolate maintenance.target- Make it the default (if you really want to):
sudo systemctl set-default maintenance.targetCustom targets are useful when you want a repeatable “profile” of which services run (e.g. backup-only mode, lab mode, etc.).
Summary
- Boot targets are
systemdunits ending in.targetthat define system modes (rescue, multi-user, graphical, emergency, etc.). systemctl get-defaultshows, andsystemctl set-defaultchanges, the default target used on boot.systemctl isolate <target>switches the running system to another target;systemctl rescueandsystemctl emergencyare shortcuts for troubleshooting modes.- You can request a specific target at boot via the kernel parameter
systemd.unit=.... - Targets can be customized or created from scratch to define your own system states (e.g., a restricted maintenance mode).