FS#79619 - [systemd] 20-systemd-sysusers.hook fails to execute on a fresh system

Attached to Project: Arch Linux
Opened by Markus Zucker (irminsul) - Friday, 08 September 2023, 16:41 GMT
Last edited by Toolybird (Toolybird) - Sunday, 10 September 2023, 09:42 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 11
Private No

Details

Description:

When installing a fresh Arch system, `20-systemd-sysusers.hook` fails to initialize `/etc/group`, resulting in a file that only contains the `root` group provided by the `filesystem` package.

This leads to tons of follow-up errors as essential system groups such as `udev`, `wheel`, `systemd-journal`, etc. are not present.

Here's an excerpt from `pacman.log`:

> [ALPM-SCRIPTLET] Initializing machine ID from random generator.
> [ALPM-SCRIPTLET] Failed to write /etc/machine-id: Bad file descriptor
> ...
> [ALPM-SCRIPTLET] Failed to copy permissions from /etc/group to /etc/.#groupe76aefb9d161c4b5: No such file or directory
> ...
> [ALPM-SCRIPTLET] chgrp: invalid group: ‘systemd-journal-remote’
> ...
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/dbus.conf:13: Failed to resolve user 'dbus': No such process
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/libutempter.conf:1: Failed to resolve group 'utmp': No such process
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/static-nodes-permissions.conf:12: Failed to resolve group 'audio': No such process
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/static-nodes-permissions.conf:13: Failed to resolve group 'audio': No such process
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/static-nodes-permissions.conf:14: Failed to resolve group 'disk': No such process
> [ALPM-SCRIPTLET] /usr/lib/tmpfiles.d/static-nodes-permissions.conf:18: Failed to resolve group 'kvm': No such process
> [many more errors like that]

Additional info:
* systemd (254.2-1)
* Full `pacman.log` file from running `pacstrap` is attached.

Steps to reproduce:

Try to install Arch as per the installation instructions in the wiki. I used archlinux-2023.09.01-x86_64.iso as the installation image.
This task depends upon

Closed by  Toolybird (Toolybird)
Sunday, 10 September 2023, 09:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  systemd 254.3-1
Comment by Rod Kay (charlie5) - Friday, 08 September 2023, 18:42 GMT
I can confirm this bug. I get the exact same behaviour when installing Arch using an ISO built by mkarchiso.
The problem was not evident yesterday morning, so something must have broken very recently.
Comment by Kris (czekki) - Friday, 08 September 2023, 18:49 GMT
I was using the ISO to install yesterday evening there was no error.
However today morning this error apeared.
Comment by loqs (loqs) - Friday, 08 September 2023, 19:05 GMT
Please try with systemd packages downgraded to 254.1-1. Assuming that is the cause can please bisect [1] between the two tags to locate the cause?
Edit:
See also [2].
Out of interest what if you apply the attached diff that stops sysusers or tmpfiles from being executed when the system is not booted?
Edit:
Corrected 245.1-1 to 254.1-1.

[1] https://wiki.archlinux.org/title/Bisecting_bugs_with_Git
[2] https://github.com/systemd/systemd/issues/29137
Comment by loqs (loqs) - Friday, 08 September 2023, 19:59 GMT
Please try with 8046167dc2d6d7ad62a447991efcd0404d784180 [1] reverted as in attached diff, which has been identified as the cause [2].

[1] https://github.com/systemd/systemd-stable/commit/8046167dc2d6d7ad62a447991efcd0404d784180
[2] https://github.com/systemd/systemd/issues/29137#issuecomment-1712127340
Comment by loqs (loqs) - Friday, 08 September 2023, 21:46 GMT
Fixed has been merged into system [1], PR for systemd-stable v254-stable branch [2].

[1] https://github.com/systemd/systemd/commit/7b9da3861a2d27dd31c360674947005a19f3cbe7
[2] https://github.com/systemd/systemd-stable/pull/320
Comment by Werner Beroux (Wernight) - Friday, 08 September 2023, 21:51 GMT
Had the same issue and it go solved doing:

$ pacman -U https://archive.archlinux.org/packages/s/systemd/systemd-254.1-1-x86_64.pkg.tar.zst

It's 254.1-1 (not 245.1-1).
Comment by Toolybird (Toolybird) - Friday, 08 September 2023, 23:44 GMT Comment by Stefan Schallenberg (nafets227) - Saturday, 09 September 2023, 10:42 GMT
I had issues with systems-254.2, too.
In my case it ran over the groups creation and failed in bootctl on the chrooted new system.

My analysis points to arch-chroot as root cause:
- It is creating a new PID namespace (using unshare --pid)
- But the /proc mount is copied from the root PID namespace, thus showing wrong processID´s
- starting from system-254.2 it uses /proc/<pid>/fd instead of /proc/self/fd.
It searched for /proc/<pid> using its PID in its (chroot-created) namespace, but does not find it, because /proc refers to the root namespace PIDs , and they differ by design.
- I partially solved it by re-mounting /proc inside the arch-chroot, then it reflects the PID´s of the chroot-created PID namespace.

Hope this helps for analysis, let me know if I help any further.
Comment by Zhafran Rama Azmi (RushingAlien) - Saturday, 09 September 2023, 14:36 GMT
Can confirm, entering the new root with `systemd-nspawn` instead of `arch-chroot` works for me
Comment by Nicolas Prochazka (limbo) - Saturday, 09 September 2023, 20:17 GMT
Is there any solution with mkarchroot to create chroot environment with packages, at this time it's seems to be not possible.
Comment by loqs (loqs) - Saturday, 09 September 2023, 21:11 GMT
Please test systemd 254.3-1 currently in core-testing.
Comment by Michael Ferrari (NekkoDroid) - Saturday, 09 September 2023, 22:04 GMT
I have tested the core-testing package and my problem does not occur with it. (I am the one that created https://github.com/systemd/systemd/issues/29137)
.
1. I am able to successfully run `systemd-firstboot` without it erroring "Bad file descriptor"
2. I am able to fully run my install script after updating the package inside the chroot, which makes use of systemd-boot, systemd-firstboot and the systemd hooks in mkinitcpio (and anything else a usual install makes use of).

Comment by DayDreamer (daydreamer) - Sunday, 10 September 2023, 09:01 GMT
Fixed with core-testing 254.3-1

Loading...