Skip to content

Systemd Targets for Planned Maintenance

Admin
October 19, 2026
12 min read
Beginner
💻 Target OS: Ubuntu 24.04+ / Debian 12+ / RHEL 9+

Before you begin

  • Applies to:Linux systems that use systemd. Use a disposable full Linux VM for the isolation and rescue exercises.
  • Where to start:Start with read-only inspection. Use the hypervisor console and an approved outage for the VM exercises.
  • What you need:Have administrator access, a working console, and a verified recovery login. WSL and containers cannot replace the VM for this boot exercise.
Guide tools
Guide tools
0/0 Steps (0%)

A systemd target groups units into a named operating state. Knowing which target is active helps you plan a service window and understand the difference between changing the current runtime state and choosing the state for a future boot.

Use a disposable full Linux VM with systemd, administrator access, a working hypervisor console, and a verified recovery login. The inspection steps are suitable for normal hosts. Perform target isolation and rescue-mode exercises only on the disposable VM during an approved outage. WSL and containers are not suitable substitutes for this boot-and-console exercise.

Current target isolation and persistent default-target selection are separate operations; rescue requires console recovery.

01

Confirm systemd and Record the Current State

Read Only

Record the default target, active targets and failed units before maintenance. Multiple targets normally remain active at once. The default is a boot selection and may differ from the runtime state. A degraded system has failed units to investigate; do not erase them with reset-failed just to make the display look clean.

Terminal window
ps -p 1 -o comm=
systemctl --version | head -n 1
systemctl get-default
systemctl list-units --type=target --state=active --no-pager
systemctl --failed --no-pager
systemctl is-system-running
❯ Illustrative Output (Results Vary)
systemd
systemd 255 (255.4-1ubuntu8)
multi-user.target
running
02

Understand the Targets You Will Inspect

Operating States

Use the unit definitions installed on the VM to inspect dependencies and whether isolation is allowed. A graphical installation usually builds on multi-user.target; a minimal server may not have a useful graphical environment. Rescue provides a minimal maintenance state, while emergency is more limited and can leave essential mounts unavailable.

Terminal window
systemctl cat multi-user.target graphical.target rescue.target emergency.target
systemctl show multi-user.target rescue.target \
--property=Id --property=AllowIsolate --property=Requires --property=Wants
systemctl list-dependencies multi-user.target --no-pager
03

Prepare Console Access and Recovery Authentication

Required Gate

Open the hypervisor console and demonstrate a normal login before the outage. Check how the distribution’s rescue shell authenticates. Many installations lock the root account, which can prevent a rescue login. Resolve recovery access through the distribution’s approved procedure or skip rescue mode. Do not weaken authentication as an incidental part of this guide.

Record the original default target, the expected application services, and the approved return target in the change record. The example below only inspects account status and running services.

Terminal window
sudo passwd -S root
systemctl get-default
systemctl list-units --type=service --state=running --no-pager
loginctl list-sessions
04

Plan and Verify Application Shutdown

Maintenance Preparation

Drain traffic and jobs, coordinate databases and cluster roles, and stop application services using their documented order. Do not stop an unknown workload simply because it appears in the running-service list. Inspect outstanding jobs, timers and socket activation so they do not surprise the maintenance plan. Record health checks to repeat afterward.

Terminal window
systemctl list-jobs --no-pager
systemctl list-timers --all --no-pager
systemctl list-sockets --all --no-pager
who
05

Enter Multi-User Mode Temporarily on the Lab VM

Console Only

From the hypervisor console, isolate the non-graphical operating target. A graphical session may end immediately. On a server already in multi-user mode, there may be little visible change. This does not change the default selected for subsequent boots. Verify the active state using another console login if the first session closes.

Terminal window
sudo systemctl isolate multi-user.target
Terminal window
# Inspect from the surviving or newly opened console session:
systemctl is-active multi-user.target
systemctl get-default
systemctl list-units --type=target --state=active --no-pager
06

Enter Rescue Mode for the Optional Lab Exercise

Disruptive

Proceed only after the recovery-authentication and application-shutdown gates passed. Run this from the console. The command may terminate its caller while the rescue login appears. Authenticate at the rescue prompt using the previously verified procedure. If authentication is unavailable, use the planned VM recovery path rather than improvising password changes.

Terminal window
sudo systemctl rescue
07

Inspect Rescue State Without Making Repairs

Root Console

The authenticated rescue shell normally runs as root; confirm identity before using it. Inspect active units and mount state. Rescue is not a filesystem repair command, and mounted writable filesystems are not safe targets for an offline repair utility. This exercise performs no disk or bootloader changes.

Terminal window
id
systemctl is-active rescue.target
systemctl list-units --type=target --state=active --no-pager
findmnt /
systemctl --failed --no-pager
08

Return to the Recorded Normal Runtime Target

Restore Service

Use the exact normal target recorded earlier. These examples show two alternatives; run only the one appropriate to your VM. They are issued from the root rescue console without sudo. The rescue shell may close during the transition. Reconnect through the console and verify the expected services; dependency activation does not guarantee every application stopped before maintenance will restart.

Terminal window
# Server VM whose normal target is multi-user.target:
systemctl isolate multi-user.target
Terminal window
# Alternative for a VM with a verified graphical installation:
systemctl isolate graphical.target
09

Understand and Optionally Change the Boot Default

Persistent Configuration

Changing the default affects later boots; it does not switch the current target. Skip this step unless the maintenance change specifically requires a different default. On a disposable graphical VM, the example selects text-mode boot, then shows how to restore the previously recorded graphical default. A server originally using multi-user.target should retain that default.

Terminal window
# Optional persistent change on a graphical lab VM:
systemctl get-default
sudo systemctl set-default multi-user.target
systemctl get-default
Terminal window
# Restore only if the recorded original default was graphical.target:
sudo systemctl set-default graphical.target
systemctl get-default
10

Verify the Host and Close the Maintenance Window

Post-Change Checks

Repeat the baseline checks, review warnings during the maintenance window, and compare actual applications with the recorded service list. Restore any deliberately paused jobs or traffic only after service owners confirm health. A new failure needs investigation; do not automatically restart everything or clear evidence. If you intentionally changed boot behavior, plan a separate authorized reboot and validate it through the console.

Terminal window
systemctl get-default
systemctl list-units --type=target --state=active --no-pager
systemctl --failed --no-pager
systemctl is-system-running
sudo journalctl -b --since '-30 minutes' -p warning --no-pager

Read the installed systemctl(1), systemd.special(7), systemd.unit(5) and sulogin(8) manuals. Upstream references: systemctl operations, special targets, and unit isolation settings. Continue with service basics or service failure diagnosis.

Comments