Linux

Where Are systemd Unit Files Stored?

Where systemd reads unit files across system, vendor and runtime dirs on Linux, and which one is yours to edit.

Last updated

systemd loads units from three tiers: /etc/systemd/system for your configuration, /lib/systemd/system (or /usr/lib) for vendor ships, and /run/systemd/system for runtime state. Same filename in an earlier tier wins outright, which is the whole override mechanism.

Enabling a service writes no config: it symlinks the vendor unit into a .wants directory under /etc. That is why enabled services survive updates (the link points at whatever version ships) and why systemctl cat beats reading files when debugging precedence.

Where systemd stores this, by platform

Linux
/etc/systemd/system

Vendor units live in /lib/systemd/system (some distros use /usr/lib/systemd/system). User units go in ~/.config/systemd/user. Always daemon-reload after edits.

Frequently asked questions

How do I customize a service without breaking updates?

Never edit /lib files: package updates overwrite them silently. Copy the unit to /etc/systemd/system and edit the copy, or drop snippet overrides in /etc/systemd/system/<name>.d/. Run systemctl daemon-reload after every change or nothing takes effect.

Which unit file is actually active for a service?

Run systemctl cat <service>. It prints the effective file plus all drop-ins in load order, which settles every which config wins argument instantly. systemctl status shows the loaded path too, one level less detailed.

Notice an outdated path? Let us know.