Linux

systemd

46 flashcards · answers and spaced-repetition review in the KnowCard app

In systemd terms, what is a target, and how do you find out (or change) which one the machine boots into by default?
After a fresh boot the kernel has loaded, but nothing else is running yet. What is the very first userspace process the kernel launches, and what is it responsible for?
Traditional init systems were collections of shell scripts. What is architecturally different about systemd, and how does it know when a service has crashed?
You run pstree and see one process at the root of the entire tree. Which PID is systemd, and why does /sbin/init sometimes appear to be process 1 instead?
What is the single central command for administering systemd services by hand, and what are its everyday subcommands?
A tutorial written for Fedora says to run systemctl start sshd, but on your Debian box the SSH unit isn't found under that name. What went wrong, and how far does this problem generalize?
systemctl start brings a service up right now but it's dead again after reboot. Which command makes the choice permanent, and mechanically what does it change on disk?
You type systemctl with no arguments. What does it print, and how do you also see units that exist but aren't currently active?
You want to switch the running machine to a different operating state, or list which targets are active right now. Which systemctl subcommands do each?
Init-V had a single-user mode for repair work. systemd has no such runlevel — so how do you get into a stripped-down, root-only rescue state, and what's missing there?
People say systemd manages "services," but a mount point and a swap partition aren't services. What does a unit actually cover, and how do targets relate to units?
A target file lists both Requires= and Wants= for another unit. What's the practical difference, and what does the accompanying .target.wants directory do?
Inside a .service file, which section and key actually name the program to run, and which key decides when it's enabled to auto-start?
You start a systemd user service, but plain systemctl start doesn't touch it. What are the per-user parts of systemd, and how do they get launched?
You need to know whether a given login session is a graphical desktop or just a remote terminal. Which command reveals the session type, and what values distinguish them?
Before systemd, every distro hid the hostname, locale, and timezone in a different file. Where did systemd standardize these, and which tool edits each?
systemd ships its own logging system, the journal. What is unusual about how it stores logs compared to classic plain-text syslog files?
A legacy service still ships only an old /etc/init.d/ script. Does it run under systemd at all, and how can you spot such services quickly?
You're writing your own systemd service from scratch. Where does the unit file go, and what are the minimum sections and keys it needs?
Your custom service starts one long-running program, another launches a background daemon, and a third needs several commands in a row. Which Type= fits each?
You wrote a Type=oneshot service to switch a state on start and off on stop, but systemctl stop does nothing — systemd already thinks it's inactive. What one keyword fixes this?
You edited a unit file and restarted the service, but your change didn't take effect. What step is easy to forget, and why is it necessary?
You want a crashed service to come back automatically, but not thrash forever in a crash loop. Which unit keys give you restart-on-crash with a sane rate cap?
You want a service that appends a line to a log file at every boot AND at every shutdown. What combination of Type, ExecStart/ExecStop, and one extra key makes this work?
On a headless server you use the shutdown command. What forms can its time argument take, and which options reboot, cancel, or force power-off?
How do halt and reboot relate to shutdown, and under systemd what are all three actually running underneath?
A reboot command fails with "Transaction is destructive" and the machine just keeps running. What causes this, and how do you force the reboot through?
Before systemd, how did the classic Init-V system actually bring a machine up — which config file and which directories drove the boot?
In the classic Init-V world, what were the standard runlevels 0 through 6, and how did root switch between them at runtime?
Even under systemd you may hit a legacy service that only has an Init-V script. What parameters do those /etc/init.d scripts accept, and can you run them by hand?
On Fedora/RHEL you install a network service and it doesn't run until you enable it. Why does the same package "just work" immediately after install on Debian/Ubuntu?
You just want to run a couple of commands at the end of boot without writing a full systemd unit. What lightweight escape hatch still exists, and what are its requirements?
systemd can schedule periodic jobs like Cron. What two paired files implement a timed job, and how do you see which timers will fire next?
In a .timer file, what's the difference between OnBootSec/OnUnitInactiveSec, OnCalendar, and the Persistent=true option?
For a periodic job, why might you still reach for a one-line crontab entry instead of a systemd timer — and what do you give up either way?
You SSH into an unfamiliar box and can't find systemd's files under /lib/systemd. On which distribution family is that expected, and where do they live instead?
Your minimal .service file defines only ExecStart, with no ExecStop. How does systemd stop the service, and what is the fallback if the process ignores that?
A unit file's ExecStart line is getting very long, and you'd like to reuse the service's own name inside the file. What two syntax helpers does systemd give you?
In a service unit an ExecStartPre line reads -/usr/bin/docker stop mysql-container. What does the leading minus sign do, and why would you want it there?
In an Init-V runlevel directory like /etc/rc2.d you see files named S15sshd and K80sshd. What do the S, the K, and the number mean?
You changed a running service's config file and want it applied without dropping client connections. Which systemctl subcommand does that, and when must you fall back to restart?
systemd can boot a machine whose /etc/fstab has no entries for /home or swap. What makes that possible, and which component actually does the work at boot?
You've finished repair work inside the emergency target. How do you get the machine back to normal operation, and which target is responsible for the Ctrl+Alt+Del restart in a text console?
A user's systemd --user instance is running. Which directories does it search for unit files, and when does that per-user instance start and stop?
Which command lists every login session systemd is currently tracking, and what does each row tell you?
You want one script that controls a daemon on both old Init-V boxes and modern systemd boxes. Which legacy command still works on both, and what does it do under systemd?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play