FS#67454 - [mkinitcpio] add /etc/os-release to initramfs, when systemd hook used in mkinitcpio

Attached to Project: Arch Linux
Opened by Stefan de Konink (skinkie) - Friday, 31 July 2020, 21:41 GMT
Last edited by David Runge (dvzrv) - Tuesday, 22 November 2022, 12:26 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Giancarlo Razzolini (grazzolini)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
systemd requires the /etc/os-release file to be present, at this moment this file is not added, this raises an error when the systemd hook is used.
https://www.freedesktop.org/software/systemd/man/os-release.html

Additional info:
* package version(s)
systemd 245 (245.6-8-arch)
mkinitcpio 28

Steps to resolve:
Append the line add_file /etc/os-release in the build function of /usr/lib/initcpio/install/systemd
This task depends upon

Closed by  David Runge (dvzrv)
Tuesday, 22 November 2022, 12:26 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with mkinitcpio 33-1
Comment by Dave Reisner (falconindy) - Sunday, 02 August 2020, 18:14 GMT
> this raises an error when the systemd hook is used.
What error?
Comment by Stefan de Konink (skinkie) - Sunday, 02 August 2020, 18:23 GMT
Failed to read os-release file, ignoring: No such file or directory

[ 62.046004] systemd-tmpfiles[265]: Entry "/etc/os-release" does not match any include prefix, skipping.
Comment by loqs (loqs) - Sunday, 02 August 2020, 18:30 GMT
That is a debug messsage [1]?
Edit:
Triggered by
L /etc/os-release - - - - ../usr/lib/os-release
from /usr/lib/tmpfiles.d/etc.conf

[1] https://github.com/systemd/systemd/blob/v246/src/tmpfiles/tmpfiles.c#L2412
Comment by Stefan de Konink (skinkie) - Sunday, 02 August 2020, 18:33 GMT
Exactly, Lennart commented on a debug trace create to debug another feature, of which the missing os-release also popped up.
https://github.com/systemd/systemd/issues/16580#issuecomment-666193698
Comment by Dave Reisner (falconindy) - Sunday, 02 August 2020, 19:35 GMT
Right, but it's a debug message, not an error. There's no harm done by not including os-release. About all it buys us is a different message in the logs.
Comment by Stefan de Konink (skinkie) - Sunday, 02 August 2020, 19:39 GMT
There is no harm adding it, especially if the lead developer of systemd directly spots it as issue when reviewing a ticket.
Comment by Dave Reisner (falconindy) - Sunday, 02 August 2020, 21:05 GMT
If anything, this should be added to the hostdata hook, not the systemd hook.
Comment by nl6720 (nl6720) - Tuesday, 25 October 2022, 14:15 GMT
https://systemd.io/INITRD_INTERFACE/#using-systemd-inside-an-initrd says to provide /etc/initrd-release and /etc/os-release files, so this should be done by the systemd hook.
Comment by Christian Hesse (eworm) - Tuesday, 25 October 2022, 14:34 GMT
These days `/etc/initrd-release` is added by `initialize_buildroot()` from `mkinicpio` functions. That should be sufficient, no?
Comment by nl6720 (nl6720) - Tuesday, 25 October 2022, 14:38 GMT
It adds an empty file from what I can see. But since initialize_buildroot already concerns itself with it, then it can be implemented in that function.
Comment by Christian Hesse (eworm) - Tuesday, 25 October 2022, 15:02 GMT
The documentation says:

> systemd uses the existence of this file as a flag whether to run in initial RAM disk mode, or not.

This sounds like an empty file is fine...

BTW, this was added in 2012 already:
https://github.com/archlinux/mkinitcpio/commit/b8459a2ac067b05925d660fdf2b62855eae544da
Comment by nl6720 (nl6720) - Tuesday, 25 October 2022, 15:32 GMT

Loading...