Service failures and boot recovery
Quick answer
Recover by gathering evidence first: identify the failed unit, inspect its effective settings and relevant logs, correct the smallest cause, and verify the outcome.
Prepare the practice environment
Run python3 lab-fixtures/boot-services/setup.py from the extracted package root as an ordinary user in a disposable Linux environment. Enter the printed path and check pwd. Use a fresh fixture and a fresh Bash process for each offline example, with LC_ALL=C and set -o pipefail. Do not omit the explicit offline root. Read the fixture README before VM-only examples; never run those on the host. Static checks do not start a service.
How it works
systemctl status summarizes state, while journalctl -u UNIT scopes logs to a unit and -b selects a boot. A nonzero status can indicate an inactive or failed unit, so inspect the actual state and exit code. reset-failed clears failed state and counters, not the underlying cause. If unit verification finds a nonexistent executable, repair the path or installation before restarting. For real boot failure, use an authorized VM console or rescue environment, preserve logs and configuration, and choose a reversible repair or known-good snapshot. A boot can fail before journald starts. Do not infer the complete root cause from a single log line or disable security controls to make a unit run.
First determine whether the unit definition is invalid, the program cannot be launched, or the program starts and then fails. Each calls for different evidence: a verification diagnostic, a launch error, or application output and exit status. Preserve the first failure before retrying. In a VM, compare service state and an independent functional check after a minimal correction; neither clearing a failure flag nor observing an active state alone establishes recovery.
Try the examples
A teaching log, not actual journal output. It suggests checking ExecStart.
Expected stdout:
bm-report.service: failed to locate executableif systemd-analyze verify ./bm-broken.service > verify.log 2>&1; then exit 1; else printf 'invalid unit rejected\n'; fiThe invalid executable path is intentional; inspect verify.log for the actual diagnostic.
Expected stdout:
invalid unit rejectedsystemctl status bytemind-demo.service --no-pagerjournalctl -b -u bytemind-demo.service -n 30 --no-pagerVM-only, after the sample has run. View only logs you are authorized to read; redact sensitive data before sharing.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Do not repeatedly restart a failing service without understanding the error, erase logs, or run boot repair commands on the host. A clean failed flag does not prove a fix.
Practice
Inspect the broken unit and its verification log, then create a new corrected copy with ExecStart=/usr/bin/true in the private directory and verify it. Explain how a live VM would require additional runtime and log checks.
Related references
Study: journalctl, systemctl. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Service failures and boot recovery — Knowledge Check
Apply boot and systemd concepts to offline unit files and VM-only scenarios.
Which action is best first for a failed unit?
What does reset-failed do?
What does journalctl -b -u UNIT select?
Can a boot fail before journal entries are available?