Systemd¶
11 cards — 🟢 3 easy | 🟡 5 medium | 🔴 3 hard
🟢 Easy (3)¶
1. Where do admin-override unit files live, and why do they take precedence over vendor unit files?
Show answer
Admin overrides live in /etc/systemd/system/. Vendor unit files live in /usr/lib/systemd/system/. Admin overrides win because /etc/systemd/system/ has higher priority in the systemd unit file search path.2. What systemd target replaces traditional runlevel 3, and what does it provide?
Show answer
multi-user.target replaces runlevel 3. It provides a non-graphical multi-user system with networking and all standard services running.3. How do you view only the logs for a specific systemd service using journalctl?
Show answer
Use journalctl -u🟡 Medium (5)¶
1. What is the difference between Wants= and Requires= in a systemd unit file?
Show answer
Wants= is a soft dependency: if the wanted unit fails to start, the depending unit still starts. Requires= is a hard dependency: if the required unit fails, the depending unit also fails to start. Wants= is preferred for most cases to avoid cascading failures.2. How do you safely customize a vendor-provided systemd unit file without editing it directly?
Show answer
Use systemctl edit3. What command enables a service to start at boot AND starts it immediately in one step?
Show answer
systemctl enable --now4. How does systemd enforce resource limits on services?
Show answer
systemd uses cgroups (control groups). Every service runs in its own cgroup slice, which allows systemd to enforce CPU, memory, and I/O limits using directives like CPUQuota=, MemoryMax=, and IOWeight= in the unit file's [Service] section.5. What command would you use to debug slow boot times and identify which units are taking the longest?
Show answer
systemd-analyze blame lists units by startup time. systemd-analyze critical-chain shows the critical path of the boot sequence. systemd-analyze plot > boot.svg generates a visual SVG timeline of the entire boot.🔴 Hard (3)¶
1. Describe the simplified boot sequence from firmware to running services in a systemd-based system.
Show answer
firmware -> bootloader -> kernel -> initramfs -> systemd (PID 1) -> default.target (usually multi-user.target or graphical.target) -> dependency tree of units. systemd as PID 1 manages the entire service dependency tree from that point.2. What is the difference between After=/Before= and Wants=/Requires= in systemd unit files?
Show answer
After= and Before= control ordering only: they determine the sequence in which units start but do not create a dependency. Wants= and Requires= create actual dependencies (pull in units) but do not control order. To both require a unit and ensure it starts first, you need both Requires= and After= together.3. Why must you run systemctl daemon-reload after manually editing a unit file, and what happens if you forget?