FS#61821 - [p11-kit] Unnecessary dependency on systemd

Attached to Project: Arch Linux
Opened by Matt Schreiber (tomeon) - Wednesday, 20 February 2019, 20:41 GMT
Last edited by Toolybird (Toolybird) - Friday, 14 April 2023, 06:46 GMT
Task Type General Gripe
Category Packages: Core
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

p11-kit was updated in September 2018 to add a dependency on systemd. This was done in order to support the use of systemctl commands in p11-kit.install. As a result, installing anything that depends on p11-kit will result in pulling in systemd. This includes curl, and therefore pacman (transitively). This is undesirable for use cases like building Arch Linux containers, which may not need any init at all, let alone systemd.

Additional info:

* Introduced in commit 6d9d0c7cac45622d768f31f21cd3fbd154824ffa (https://git.archlinux.org/svntogit/packages.git/commit/p11-kit/trunk/PKGBUILD?id=6d9d0c7cac45622d768f31f21cd3fbd154824ffa).
* Introduced in response to  FS#59897  (https://bugs.archlinux.org/task/59897)
* Released as p11-kit 0.23.15-1

Suggestion:

Instead of having p11-kit depend on systemd, rework p11-kit.install to invoke systemctl only if systemd is installed and running. I've attached the systemd.install file from the systemd package, whose sd_booted function provides an illustration of this kind of strategy. I've also attached patches to the p11-kit PKGBUILD and p11-kit.install file that, respectively, (1) make systemd an optional dependency and (2) short-circuit before calling systemctl if systemd is not running.
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 14 April 2023, 06:46 GMT
Reason for closing:  Fixed
Additional comments about closing:  p11-kit 0.23.20-5
Comment by Eli Schwartz (eschwartz) - Wednesday, 20 February 2019, 20:58 GMT
Packages do not optdepend on systemd just because they provide a systemd service/socket.

Packages which execute systemctl in the post-install, maybe -- but literally all this even does is create symlinks; there are other packages which successfully use ln.

It doesn't matter either way, since systemd is part of both base and base-devel due to providing the tmpfiles.d and sysusers.d implementation needed in order to create users/groups etc. on Arch Linux (even in a container).

The proposal is additionally broken because the package links to the libsystemd.so shared library and must regardless depend on "systemd-libs".
Comment by Matt Schreiber (tomeon) - Friday, 22 February 2019, 15:48 GMT
Thanks very much for your reply! A few observations/questions:

> Packages do not optdepend on systemd just because they provide a systemd service/socket.

Good to know. Seemed like systemd is "not essential for base functionality, but may be necessary to make full use of the contents of this package".

> [A]ll this even does is create symlinks; there are other packages which successfully use ln.

This seems like a sane approach -- just `ln -sf /usr/lib/systemd/user/p11-kit-server.socket /etc/systemd/user/sockets.target.wants/p11-kit-server.socket`, I suppose? I've downloaded the package-building sources for all packages on my main system that provide a .service or .socket in /usr/lib/systemd/{system,user} to get an idea of how other packages handle this; so far the only package I've found that uses ln to link a .service or .socket file into a *.target.wants directory is lvm2 (and it only does this to handle replacing an existing symlink to the lvm-monitoring.service file with one to the lvm2-monitor.service file). I'm currently fetching the package-building sources for other packages that contain .service and .socket files, but if you happen to know a good example off of the top of your head, I would appreciate it very much if you would share the package name.

> systemd is part of both base and base-devel due to providing the tmpfiles.d and sysusers.d implementation needed in order to create users/groups etc. on Arch Linux (even in a container).

Prior to the addition of systemd to p11-kit's `depends` array, I built and ran single-purpose (Docker) containers without having installed systemd and without having run systemd-tmpfiles or systemd-sysusers. But even in use-cases that require the tmpfiles.d and sysusers.d implementation, it may suffice to install systemd during the image building process, execute systemd-tmpfiles and systemd-sysusers, then uninstall systemd. At present, that is not possible without removing a bunch of packages besides systemd.

> The proposal is additionally broken because the package links to the libsystemd.so shared library and must regardless depend on "systemd-libs".

In that case, would it not suffice to specify "systemd-libs" in the `depends` array, rather than specifying "systemd"?
Comment by Eli Schwartz (eschwartz) - Friday, 22 February 2019, 18:58 GMT
See the gnupg package, which should be on every system as pacman needs it.

Loading...