gdraheim / docker-systemctl-replacement

docker systemctl replacement - allows to deploy to systemd-controlled containers without starting an actual systemd daemon (e.g. centos7, ubuntu16)
European Union Public License 1.2
1.39k stars 399 forks source link

Please support "tmpfiles.d" #98

Open onlyjob opened 4 years ago

onlyjob commented 4 years ago

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 commented 4 years ago

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
gdraheim commented 4 years ago

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.

onlyjob commented 4 years ago

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.

srd424 commented 1 year ago

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