Unix & Linux Asked by Adam Pickering on November 28, 2021
The documentation I have read on systemd unit files states that unit files can be found in three locations on the filesystem:
/etc/systemd/system/
: system unit files/run/systemd/system/
: runtime unit files/lib/systemd/system/
(also sometimes /usr/lib/systemd/system/
): default unit files for packagesI understand that system unit files are for (possibly user-configured) system daemons. I also understand that default package unit files are unit files that come along with package installs that provide sane defaults.
However, I cannot find documentation that explains the purpose of runtime unit files. What are runtime unit files for? Might I, as a sysadmin, ever create one? What are some examples of problems that might be solved with runtime unit files? Why do runtime unit files take precedence over package unit files, but not over system unit files?
Historically, runtime unit files are intended for machine-generated units. They are supposed to override corresponding vendor units (if any), but are designed to allow user overrides, hence the defined precedence.
Nowadays I think they’ve largely been supplanted by transient units generated using the bus API; these don’t appear as files anywhere.
Answered by Stephen Kitt on November 28, 2021
From reading the manual here it appears that runtime unit files are simply another type of systemd configuration file, for a given process.
Also, they are generated at runtime and deleted upon exiting the process.
If it helps, search "run" on that page and read all the entries. From there, it is easy to reach the same conclusion.
Answered by BitShift on November 28, 2021
I've never seen /run/systemd being used for unit files on my systems. Although it could be used when you're just running unmodified unit files from /lib/systemd.
Usually /lib/systemd contains the default unit files and timers (and you should never edit them there), and /etc/systemd contains the enabled (links to /lib/systemd files) and customized ones.
You can customize timers and unit files with sudo systemctl edit unit/timer
to add some things to the original file or sudo systemctl edit --full unit/timer
to completely edit the unit file or timer.
Answered by aardbol on November 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP