FS#76142 - [systemd] v251.5-1 Inicpio install hook isn't properly adding service overrides

Attached to Project: Arch Linux
Opened by Christian Påbøl Jacobsen (cpebble) - Saturday, 08 October 2022, 17:51 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:14 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

When using the "add_systemd_unit" initpcio function, the systemd unit is added to the initramfs. However if that unit has an override defined in /etc/systemd/system, that override isn't correctly carried over.
The code for add_systemd_unit is in /usr/lib/initcpio/install/systemd. That file also have an "add_systemd_drop_in" which isn't used, but can be used to implement this.

The bug was discovered after trying to add a service (pcscd - smart card daemon) to boot. Normally it would depend on "sockets.target" and systemd won't start it during launch. Adding an override with "defaultdependencies=no" and a new "RequiredBy" would let the service start, but it isn't copied to initramfs.

A fix can be made by simply checking the /etc/ directory on call to "add_systemd_unit"

Steps to reproduce:
1. Override a service by "systemctl edit xxx.service"
2. Call "add_systemd_unit xxx.service" in an initcpio hook
3. Browse lsinitcpio and confirm no override is copied

This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:14 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/systemd/issues/7
Comment by Toolybird (Toolybird) - Sunday, 09 October 2022, 03:56 GMT
The use case seems a bit niche. Supplying a tested patch would likely increase the chances of this being implemented.
Comment by Christian Påbøl Jacobsen (cpebble) - Sunday, 09 October 2022, 10:37 GMT
Niche isn't far off, however with Poetterings focus on encryption and security, I'm guessing we'll see more and more systemd services to be run this early.

I'll provide a patch

Loading...