/var/run directory creation even though service is disabled

Usually, directories to store pid's or similar are created by the startup scripts of the services. (See this question)

However, I just noticed that these directories are still re-created after a reboot when I disable the services. This happened for all the services I tried.

root@sonorus:~# systemctl status openvpn
● openvpn.service - OpenVPN service
   Loaded: loaded (/lib/systemd/system/openvpn.service; disabled)
   Active: inactive (dead)
root@sonorus:~# systemctl status ejabberd
● ejabberd.service - A distributed, fault-tolerant Jabber/XMPP server
   Loaded: loaded (/lib/systemd/system/ejabberd.service; disabled)
   Active: inactive (dead)
     Docs: https://www.process-one.net/en/ejabberd/docs/

Which service is actually creating these directories?


With systemd, there is a new functionality called tmpfiles.d(5) that can be used to create files or directories on boot outside of the .service file. Openvpn and ejabberd are both using this, so that's why the directories in /var/run are still created even if they are not started on boot.

The tmpfiles configuration files are stored in /usr/lib/tmpfiles.d/