Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#65978 - [systemd] add_systemd_unit in mkinitcpio hook ignores units in /etc/systemd/system

Attached to Project: Arch Linux
Opened by Sebastian Wiesner (lunaryorn) - Wednesday, 25 March 2020, 17:18 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Monday, 07 February 2022, 07:24 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
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



`add_systemd_unit` ignores administrator-created units from `/etc/systemd/system/`; I guess because `/etc/systemd/system` is missing in `unit=` at the beginning of `add_systemd_unit` (see

Was it omitted on purpose, or would it be possible to include `/etc/systemd/system` units in `add_systemd_unit`?

I'd like to add a custom mkinitcpio hook and service to print my contact info before the LUKS prompt; I could build a small AUR package for this but since it's just two files and both systemd and mkinitcpio read from /etc I figured a package would be overkill, and I could just add those two files directly. However that didn't work because `add_systemd_unit` never picked up my custom service.

As a workaround I copied relevant parts of `add_systemd_unit` to my own install hook so I'm fine, but I think in general picking up (static) units from all the places systemd looks for would be the right thing to do, wouldn't it?

Steps to reproduce:

1. Create a custom service file in `/etc/systemd/system/foo.service`
2. Create a custom install hook in `/etc/initcpio/install/foo` which invokes `add_systemd_unit foo.service || exit 1`
3. Run `mkinitcpio` and see it fail in `foo`.
This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Monday, 07 February 2022, 07:24 GMT
Reason for closing:  Won't fix
Additional comments about closing:  2022-01-02: A task closure has been requested. Reason for request: I no longer use mkinicpio and do not care for this issue anymore :)