Fundamentals & Architecture
What are systemd targets, and how do they conceptually replace SysVinit runlevels? Name some common targets.
What is systemd and what is its role in Linux?
Explain the concept of a 'unit' in systemd.
Discuss the architectural differences between systemd and SysVinit, including key advantages like parallelization and dependency management.
Explain systemd's role as PID 1 during the Linux boot process and how it brings up services according to the default target.
What are some key components of the systemd suite beyond the core service manager, and what is the purpose of each?
Discuss the criticisms and design philosophy debates surrounding systemd, particularly regarding its scope and feature creep.
Unit Files Fundamentals
Describe the typical structure of a systemd service unit file, including the main sections and the purpose of each.
Why is systemctl daemon-reload necessary after modifying unit files?
What is a systemd unit, and what are the different types of unit files, and when would you use each?
How do you configure the options and behavior of services using .service files in systemd?
Where are systemd unit files stored on the filesystem, and what is the precedence order when multiple definitions exist for the same unit?
How do you safely override or extend vendor-supplied unit files, and what are drop-in files?
What are the best practices for writing robust and maintainable systemd unit files?
Template & Helper Units
What is the purpose of systemd-sysusers?
What is a template unit in systemd, and when would you use instantiated units like foo@.service?
What is tmpfiles.d, and how does systemd-tmpfiles manage creation and cleanup of files and directories?
What is systemd-run, and when would you create a transient unit with it?
Explain the purpose of the %i, %I, and %n specifiers in systemd unit files, especially for template units.
Managing Services With Systemctl
What is the fundamental difference between systemctl start and systemctl enable?
How do you manage services with systemctl (start, stop, enable, disable, check status)?
How would you check the status of a systemd service and interpret its output?
What do systemctl is-active, is-enabled, and is-failed report, and how are they useful in scripts?
What does systemctl enable --now do, and how does it combine two operations?
What does systemctl mask do, and how does it differ from systemctl disable?
Explain the difference between systemctl restart and systemctl reload, and when would you use reload-or-restart?
What does systemctl isolate do, and when would you use it?
What is the difference between systemctl cat and systemctl show for inspecting a unit?
How does enabling a unit create .wants symlinks, and what role does the [Install] section's WantedBy play?
Service Unit Directives
How do Environment= and EnvironmentFile= work for passing configuration to a service?
Explain the Type directive in the [Service] section and its common values, and how the chosen type affects systemd's understanding of service readiness.
Describe the Restart directive and its various options, and how systemd uses it to ensure service reliability.
Explain the ExecStart, ExecStartPre, ExecStartPost, ExecStop, and ExecReload directives, their execution order, and how to handle failures in pre/post commands.
What is the purpose of RemainAfterExit=yes in a service unit, particularly for Type=oneshot services?
When would you use PIDFile= in a service unit?
How does Type=forking work, and why is a PIDFile important for it?
How does systemd capture a service's stdout and stderr, and how do StandardOutput/StandardError directives control this?
How does the sd_notify readiness protocol work, and when would you use Type=notify?
How do KillMode and KillSignal control how systemd stops a service's processes?
Service Reliability & Restart
What is the purpose of RestartSec, and how does it interact with the Restart policy?
Explain TimeoutStartSec and TimeoutStopSec and their role in service management.
What is the OnFailure= directive, and how would you use it to trigger recovery actions?
What is WatchdogSec in a service unit, and how does it contribute to service reliability?
Explain StartLimitIntervalSec and StartLimitBurst and how they interact with the Restart directive.
Journald & Logging
How do you use journalctl to view logs for a specific service, filter by time, or view logs from previous boots?
What is systemd-journald, and how do you interact with its logs using journalctl?
How can you view logs from the previous system boot using journalctl?
Describe systemd-journald — what are the advantages of its structured, centralized logging compared to plain-text log files and syslog?
How can you configure journald for persistent logging across reboots?
How do you filter journalctl output by time, priority, or specific fields?
Describe the difference between persistent and volatile storage for the systemd journal.
How can you limit the size of the journal and control its rotation and vacuuming?
How does journald forward logs to a traditional syslog daemon, and why might you keep both?
What output formats does journalctl support with -o, and when would you use JSON output?
Timers & Scheduling
How do you associate a .timer unit with a .service unit?
What is systemctl list-timers, and what information does it show about scheduled timers?
Compare and contrast systemd timers with traditional cron jobs — what are the key advantages of using systemd timers?
Explain the difference between OnCalendar= and monotonic timers like OnBootSec and OnUnitActiveSec.
What is Persistent=true in a timer unit, and how does it affect missed job executions?
Are there any scenarios where cron might still be preferred over systemd timers?
What do AccuracySec and RandomizedDelaySec do in a timer unit, and why would you use RandomizedDelaySec?
Dependencies & Ordering
Explain the difference between After= and Before= for ordering units.
How do you list the dependencies of a unit, and what does systemctl list-dependencies show?
Explain the systemd dependency model — what is the crucial distinction between requirement dependencies like Wants and Requires and ordering dependencies like After and Before?
Why is it common to specify both a Wants (or Requires) and an After directive for a service that depends on another?
What is the purpose of the Conflicts directive in a unit file?
Explain the difference between Wants= and Requires= in a unit file.
What is the purpose of the BindsTo= and Conflicts= directives?
What is the difference between Requires= and Requisite=?
What does PartOf= do, and how does it differ from BindsTo=?
What is DefaultDependencies=, and why might you set it to no for certain units?
How does systemd's job and transaction model work when you start a unit?
Targets & Boot Process
Name some common systemd targets and describe their typical uses.
How do you change the default systemd target?
How does systemd-analyze help in understanding and optimizing the Linux boot process, and what information do blame and critical-chain give you?
What is the difference between the rescue and emergency targets?
What are sysinit.target and basic.target, and where do they fit in the boot ordering?
Resource Control & Cgroups
Name some systemd unit file directives you can use to control CPU, memory, or I/O resources for a service.
How do systemd-cgls and systemd-cgtop help you inspect the cgroup hierarchy and resource usage?
How does systemd utilize cgroups to manage and control resources like CPU, memory, and I/O for individual services?
Explain the concept of the slice hierarchy in systemd and how it relates to cgroups.
What is the difference between cgroup v1 and the cgroup v2 unified hierarchy, and how does systemd use it?
What is the difference between MemoryMax, MemoryHigh, and MemoryMin in a service unit?
Security Hardening
How do User= and Group= directives enhance service security?
What is the difference between ProtectSystem and ProtectHome, and what protection do they provide?
What does PrivateTmp=yes do for a service, and why is it useful?
Name and explain some systemd-specific security hardening directives you can apply in a service unit file.
How can the systemd-analyze security command help identify and improve the security posture of a service?
What does DynamicUser=yes do, and what are the tradeoffs of using it?
Mount Path & Scope Units
Explain how systemd manages mount points using .mount units.
What are .path units in systemd, and how do they let you activate a service in response to filesystem changes?
What are .automount units, and how do they differ from .mount units for on-demand mounting?
What is a .scope unit, and how does it differ from a .service unit?
User Sessions & Logind
What is the systemd per-user manager, and how does systemctl --user differ from the system manager?
What is systemd-logind responsible for, and how does it manage sessions and seats?
How does logind handle power events such as the power button or laptop lid, and how would you change that behaviour?
What is loginctl enable-linger, and when do you need it for user services?
Socket Activation & Troubleshooting
Outline a systematic approach to troubleshoot a systemd service that fails to start or behaves unexpectedly.
Explain the role of both .socket and .service units in implementing socket activation.
What does systemd-analyze verify do, and how does it help validate unit files?
What is systemd socket activation? Explain its core mechanism and the benefits it provides.
What is the difference between Accept=yes and Accept=no in a socket unit?