Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Notifications
Mark all as read
Q&A

Who creates subdirs under `/run`?

+1
−0

A system daemon needs to create several files under /run/program-name/ (and possibly other subdirs of that). They are the PID file, and at least one Unix socket file (but maybe more). The FHS specifies that those files go there, under a /run subdir: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html#runRequirements. (In some Unix systems, it would still be /var/run instead of /run, but the same question applies.)

But who is responsible for the creation of the dir(s)? Should the daemon call the equivalent of mkdir -p right before open(..., O_CREAT) or bind(2)? Or should the sysadmin make sure that the directory exists before the daemon runs, by configuring systemd-tmpfiles(8) or equivalent (e.g., an rc script, or the docker entrypoint), and the daemon assume that the directory exists (and fail if it doesn't)? Or both (i.e., the sysadmin makes sure the dir exists, but the daemon still calls mkdir(2) just in case to avoid failing)?

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

Looking at a few system daemons on my Fedora 36 machine; avahi, rpcbind & chrony.

avahi & chrony seem to both do the creating of their /run/<program> directories,

rpcbind seems to be using systemd tmpfiles. It has no mkdir(2) calls.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »