Frequently Asked Question
Boot to Graphical or Command Line
Understanding systemctl get‑default / systemctl set‑default
| Command | What it does | What you see |
|---|---|---|
systemctl get-default |
Reads the default target – the unit that systemd starts automatically after the boot manager finishes. | Usually graphical.target (GUI) or multi‑user.target (text‑only). |
systemctl set-default <target> |
Changes the default target by creating a symbolic link /etc/systemd/system/default.target → /usr/lib/systemd/system/<target>. | A message such as Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target. |
Why it matters – the default target decides whether the machine boots straight into a graphical desktop, a multi‑user console, or a rescue/emergency mode. Changing it is the systemd equivalent of changing the old SysV “runlevel”.
The standard systemd targets (modes)
| Target | Equivalent runlevel* | What it starts | Typical use |
|---|---|---|---|
graphical.target |
5 | All services of multi-user.target plus a display manager (gdm, lightdm, sddm, etc.) and the X/Wayland stack. |
Normal desktop workstation or server with a GUI. |
multi-user.target |
3 | Network, system services, login prompts on virtual consoles (tty1‑6). No X server or display manager. | Server, headless box, or workstation you want to log into via SSH/console. |
rescue.target |
1 | Brings up a minimal system with a single root shell on the console (no networking unless explicitly enabled). | Troubleshooting, maintenance when the full system won’t start. |
emergency.target |
1 (special) | Mounts the root filesystem read‑only and spawns a root shell on the console before any other service. | Last‑ditch recovery when even rescue.target fails. |
poweroff.target, reboot.target, halt.target |
– | Cleanly shuts the system down, reboots or halts. | Used by systemctl poweroff, reboot, etc. |
suspend.target, hibernate.target, hybrid-sleep.target |
– | Puts the machine into various low‑power states. | Used by systemctl suspend etc. |
\Runlevels are the legacy SysV init concept. Systemd keeps a compatibility mapping, but the target* terminology is the native one.
How the targets relate
default.target → graphical.target (or multi‑user.target, rescue.target, …)
↳ multi-user.target
↳ graphical.target (adds display-manager.service)
graphical.target requires multi-user.target – it pulls in everything that a normal multi‑user system needs, then adds the graphical stack.
What happens if you set graphical.target but have no graphical UI installed?
- Systemd still tries to reach
graphical.target.
The target itself is just a symbolic unit; it does not contain software. It merely requires other units, most importantly display-manager.service.
- If no display manager (or X/Wayland) is present:
- The
display-manager.serviceunit will be inactive or missing. - Systemd will consider the dependency failed. By default a failed dependency does not stop the boot – the rest of
graphical.target(i.e. everything frommulti-user.target) will still start.
- Result for the user:
- You will end up at a text‑only login prompt on the virtual consoles (tty1‑6), just as if
multi-user.targethad been the default. - No graphical login screen appears, and
systemctl status graphical.targetwill show a “failed” state for the missing display manager, but the system is otherwise functional.
- If the missing component is a hard dependency (e.g. you explicitly added
After=display-manager.servicein a custom unit), that unit may also fail, but the core system will still be usable.
Practical tip
If you accidentally set graphical.target on a machine that should stay console‑only, you can revert safely:
# Switch back to text mode for the next boot
sudo systemctl set-default multi-user.target
# Apply immediately without reboot (optional)
sudo systemctl isolate multi-user.target
Conversely, to install a minimal graphical stack on a server that currently has none:
sudo apt install --no-install-recommends xorg lightdm
# or for a lightweight desktop
sudo apt install --no-install-recommends xfce4 lightdm
sudo systemctl set-default graphical.target
After the packages are in place, a reboot (or systemctl isolate graphical.target) will bring up a graphical login screen.
Quick checklist
ls -l /etc/systemd/system/default.target
- Want a desktop?
systemctl set-default graphical.targetand install a display manager + X/Wayland. - Want a pure console/server?
systemctl set-default multi-user.target. - Troubleshooting? Boot to
rescue.target(systemctl rescue) oremergency.target(systemctl emergency). - Changed the default and it isn’t taking effect? Check the symlink:
It should point at the target you set.
With this understanding you can control exactly how your Linux box starts, whether it ends up at a graphical login screen or a plain command line, and you know what each mode provides.
