Boot targets, shutting down and rebooting
Changing what a running system is doing: systemd targets and the older runlevels, how to switch between them, and how to shut down or reboot without losing the machine.
Lesson 3 of 3 in objective 101. System architecture, part of LPIC-1 Exam 101-500.
Targets, and the runlevels they replaced
SysVinit had seven runlevels. 0 is halt, 1 is single-user, 6 is reboot, and 2 through 5 are multi-user states whose exact meaning varied by distribution — on Red Hat 3 was multi-user with networking and 5 was the graphical desktop, on Debian they were all much the same. The default lived in /etc/inittab, and telinit or init switched between them at runtime.
systemd replaced runlevels with targets, which are named groups of units rather than numbers: multi-user.target and graphical.target are the two you meet daily, with rescue.target and emergency.target for repair. systemctl get-default and systemctl set-default read and write the default, and systemctl isolate switches the running system to a target now. The old numeric names survive as aliases — runlevel3.target is a symlink to multi-user.target — which is why an exam question can mix the two vocabularies in one sentence.
emergency.target is the smaller of the two repair states: it starts almost nothing and gives you a shell on a read-only root. rescue.target mounts the local filesystems and starts a few basics first. Reaching either from the boot loader means editing the kernel line to add systemd.unit=rescue.target, or simply 1 or single for the old spelling.
Where unit files live, and which copy wins
A target is itself a unit file, and so is every service it pulls in, which makes the search order for unit files part of this objective rather than a detail of package management. systemd looks in /etc/systemd/system first, then /run/systemd/system, then /usr/lib/systemd/system, and the first file it finds under that name wins outright — nothing is merged and nothing is averaged. /usr/lib/systemd/system is the vendor directory, written by packages and rewritten whenever the package is upgraded, which is why editing anything in it is work you will lose. Local policy goes in /etc/systemd/system, where nothing but an administrator writes.
Replacing a whole unit file to change one line is its own maintenance problem, so there is a middle path. A .conf file under /etc/systemd/system/<unit>.d/ is a drop-in: its settings are merged onto whichever unit file won, overriding the ones it names and leaving the rest of the vendor file in force. systemctl edit UNIT creates exactly that, and systemctl cat UNIT prints the winning file with its drop-ins so you can see what the manager actually has. Neither route takes effect on its own — systemctl daemon-reload is what makes systemd reread the disk, and restarting a unit without it restarts the definition the manager is still holding.
Shutting down properly
shutdown is the polite command: it takes a time argument, warns logged-in users, stops services in order and then halts or reboots. shutdown -h now halts, shutdown -r +5 reboots in five minutes, and shutdown -c cancels a pending one. systemctl poweroff, halt and reboot do the same job on a systemd system, and the traditional halt, poweroff and reboot commands are redirected to systemctl there.
wall broadcasts a message to every logged-in terminal, which is what shutdown uses internally to warn people. acpid is the daemon that catches the power button and lid events from the firmware and decides what to do with them, so a machine that ignores its own power button usually has acpid stopped.
systemctl get-defaultgraphical.targetsystemctl set-default multi-user.targetnext boot only — the running system has not movedsystemctl isolate multi-user.targetthat one took effect nowshutdown -r +5 "patching, back in five"Shutdown scheduled for Mon 2026-08-03 19:35:00 UTCshutdown -c
Finding out what a reboot did
Switching targets and rebooting are the two operations most likely to leave a machine somewhere you did not intend, so the commands that say what happened belong beside them. journalctl reads the systemd journal: journalctl -k restricts the output to kernel messages, which is the same material dmesg prints, and -b restricts it to the current boot. Combined — journalctl -k -b — that is the kernel log for this boot and nothing else.
The -b flag counts backwards, and that is the part worth remembering: journalctl -b -1 is the boot BEFORE this one, which is the only way to read what a machine said on its way down after it has come back up. journalctl --list-boots prints the boots the journal still holds. dmesg cannot do any of this — the ring buffer is cleared at every boot, so it only ever describes the running kernel.
Worth carrying in
- systemctl get-default
- The target this machine boots into.
- systemctl isolate
- Switch the running system to a target, stopping units not in it.
- systemctl rescue
- Drop to single-user-like maintenance with local filesystems mounted.
- telinit
- Change runlevel on a SysVinit system. init 6 has the same effect as a reboot.
- /etc/inittab
- Where the default runlevel lived before systemd.
- shutdown -r +5
- Reboot in five minutes, with a warning to logged-in users. -c cancels.
- wall
- Broadcast a message to all terminals.
- acpid
- Handles power-button and lid events from the firmware.
- journalctl -k -b
- Kernel messages from the current boot.
-b -1is the previous boot;--list-bootslists them. - /usr/lib/systemd/system
- The vendor unit files, installed by packages and overwritten on upgrade.
- /etc/systemd/system
- Local unit files and drop-in directories. Beats the vendor copy of the same name.
- systemctl daemon-reload
- Reread the unit files from disk. Nothing you edited counts until this runs.
What the exam does with this
- Runlevel 1 and
rescue.targetare single-user maintenance; 0 is halt and 6 is reboot. Confusing 0 with 6 is the single most common careless loss on this objective. systemctl isolatechanges the running system;systemctl set-defaultchanges the next boot. A question will use one word and mean the other.shutdownwith no options schedules a shutdown one minute away and sends a warning — it is not immediate unless you saynow.journalctl -kanddmesgprint the same kernel messages. Onlyjournalctlcan reach a previous boot, and that is what a question about "why did it reboot" is testing.- A unit in
/etc/systemd/systembeats one of the same name in/usr/lib/systemd/system, and a drop-in under<unit>.d/overrides part of the winner rather than replacing it. Both needsystemctl daemon-reload.
- Objective
- 101. System architecture
- Share of the exam
- 13.33% (the whole objective)
- Questions in this lesson
- 15
- Signed for by a person
- 0
Partly checked. None of the 15 questions here has been read against the cited source by a person. 15 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.
Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
Drill this lesson
A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.
Practise Boot targets, shutting down and rebooting
Questions in this lesson
- A systemd machine currently boots into the graphical target. You want every future boot to stop at the multi-user (text) target, and you do not want to change the running system right now. Which command do you use? machine-checked
- As root you want the machine to reboot in five minutes, with logged-in users warned now. Which command does that? machine-checked
- On a classic SysVinit system, which command prints the previous and the current runlevel, for example the output line 'N 3'? machine-checked
- On a machine running systemd, which TWO of these commands will power the machine off? machine-checked
- On a systemd system, type the journalctl command that restricts the output to kernel messages from the current boot. machine-checked
- An old runbook instructs you to bring a server to runlevel 3. On the systemd machine in front of you, which target is the equivalent state? machine-checked
- You are auditing a systemd installation from a rescue system, with its filesystems mounted but nothing of it running, and must determine which target it boots into. Which item on disk records that choice? machine-checked
- Before a maintenance window you must take a running systemd server down to the rescue state immediately, stopping the services that are not part of it, while leaving the machine's normal boot behaviour unchanged. Which command does that? machine-checked
- Ten minutes before a planned database restart you want a warning to appear on the terminals of everyone currently logged in, without initiating any shutdown. Which command sends it? machine-checked
- A legacy SysVinit appliance boots into runlevel 5 and must instead come up in runlevel 3 at every boot. Which line in /etc/inittab do you change? machine-checked
- `systemctl stop backup.service` appears to hang for a minute and a half, then returns, and the journal records that the process was killed. What did systemd do? machine-checked
- A shutdown was scheduled earlier with `shutdown -h 23:00` and the maintenance has been called off. Which command cancels it? machine-checked
- On a headless server the short press of the power button should run a site-specific script that drains the machine before it halts. Which daemon receives that ACPI event from the kernel and runs a configured handler? machine-checked
- Select the THREE true statements about where systemd unit files live and how changes to them take effect. machine-checked
- You have inherited a systemd machine and want to know, before rebooting it, which target it will come up in. Type the command that prints the configured default target. machine-checked
Practise Boot targets, shutting down and rebooting
The rest of objective 101
- Determining and configuring hardware settings
- Booting the system
- Boot targets, shutting down and rebooting — you are here