19.09.2018

Missing directory in /var/run or /run - tmpfiles.d

Sometimes is happens, that an application/demon refuses to start because of missing files/directories in /var/run.
The first solution is:
  • Create the directory in /var/run
  • Change the permissions
and everything is fine.

Not really.

After the next reboot, the directory is missing again and you have to go for the "first" solution again.

The right solution works like this:
Inside /usr/lib/tmpfiles.d create a myexample.conf file with this content:
        d /var/run/myexample 0755 schroff schroff -
To check if everything is ok run the following command:
        systemd-tmpfiles --create myexample.conf
and you will see:
# ls -l /var/run/ |grep mxexample
drwxr-xr-x  2 schroff schroff   40 19. Sep 22:45 myexample
And this directory will be created with each reboot...

Keine Kommentare:

Kommentar veröffentlichen