docker-systemctl-replacement icon indicating copy to clipboard operation
docker-systemctl-replacement copied to clipboard

Please support "tmpfiles.d"

Open onlyjob opened this issue 5 years ago • 4 comments

On Debian "unstable" systemctl start php7.4-fpm fails, logging the following to /var/log/php7.4-fpm.log:

ERROR: unable to bind listening socket for address '/run/php/php7.4-fpm.sock': No such file or directory (2)
ERROR: FPM initialization failed

This is because systemctl ignores tmpfiles.d definitions that are crucial for many systemd services. For instance php7.4-fpm package provides the following /usr/lib/tmpfiles.d/php7.4-fpm.conf:

#Type Path                  Mode UID      GID      Age Argument
    d /run/php              0755 www-data www-data -   -

After the following manipulations systemctl start php7.4-fpm succeeds:

# mkdir -v -p /run/php
mkdir: created directory '/run/php'
# chown -c www-data:www-data /run/php
changed ownership of '/run/php' from root:root to www-data:www-data

Thanks.

onlyjob avatar May 06 '20 21:05 onlyjob

It might be the best to implement systemd-tmpfiles(8) binary that can be called as follows:

systemd-tmpfiles --remove --create /usr/lib/tmpfiles.d/php7.4-fpm.conf

onlyjob avatar May 06 '20 22:05 onlyjob

Well, I am usually preparing container images to get them prepared for the actual installer script that will work on them. So the "mkdir" is an expected fixup - there are many other features that systemd supports which can be helped with a workaround.

The systemctl.py script did never have the intention to be a reimplementation of systemd. So this feature request will move to the bottom of my todo list. But I take patches if you have an implementation.

gdraheim avatar May 07 '20 05:05 gdraheim

Fair enough, thanks. Of course there are workarounds but I think systemctl aims for compatibility with systemd .service files and management interface. tmpfiles.d appears to be a part of that interface and supporting it would help to make more .service files work "out of the box" with minimum intervention. Now when systemctl is introduced to Debian, it is easier than ever to make container images and manage services without systemd. We are already so close to a very good level of compatibility -- all thanks to you, @gdraheim. Thank you.

onlyjob avatar May 07 '20 06:05 onlyjob

If it helps, newer Debian and Ubuntu package systemd-tmpfiles separately:

https://packages.debian.org/search?keywords=systemd-standalone-tmpfiles https://packages.ubuntu.com/search?keywords=systemd-standalone-tmpfiles

srd424 avatar Jul 13 '23 14:07 srd424