-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sysusers.sh fails in empty chroot #3186
Comments
useradd needs both /etc/group and /etc/login.defs to work. It does chroot into a new system and then looks for these files. While this is technically correct it is a bit inconvenient for RPM. Creating etc/login.defs as an empty file make this work but still runs useradd without proper configuration until the shadow-utils package gets installed. There isn't really anything RPM can do about that and distribution need to ahndle the situation to make installations to an empty directory with rpm --roo work. Resolves: rpm-software-management#3186
OK, digging through the shadow utils source code it looks like it is the SELinux handling that fails - without any SELinux failures being recorded. Creating /sys/fs/selinux/enforce in the chroot with a |
Oh, right. useradd/groupadd are confined utilities and their selinux policy will almost certainly need updating to work with all this - if the login.defs part works it'll fail on other items in turn, see #3227. |
So perhaps the most useful line of investigation from here is to work with Fedora selinux-policy maintainer to see what needs to be done to support this. |
I don't think a updated SELinux policy will fix this. There are the parts of the strace that look relevant:
The error message comes from close_files() which dives down into commonio_close(). That calls in set_selinux_file_context() and reset_selinux_file_context(). These fail in libselinux because the config and /sys/ files it tries to access above are not to be found. Creating /sys/fs/selinux/enforce in the chroot with a 0 tricks So I think the issue is not the selinux policy for the shadow utils but the fact that they try to make SELinux work in the chroot even if there are no SELinux config file and no /sys/ FS to be found. |
As it happens, there's a shadow-utils ticket on this: shadow-maint/shadow#940 |
AFAICS the only way we could work around this in sysusers.sh is creating /sys/fs/selinux/enforce in the chroot if it doesn't exist, but that's just too gross of a hack because /sys is not even a regular filesystem but exporting runtime kernel info via sysfs(5). Dropping this out of 4.20 milestone and adding info label because this is outside our direct control, |
Describe the bug
sysusers.sh fails when installing to an empty chroot
To Reproduce
Steps to reproduce the behavior on Fedora >= 39:
Expected behavior
Some errors on filesystem installation expected due to --noscripts, but otherwise users and groups should get created and files assigned accordingly in the chroot.
Output
Environment
Additional context
Using actual systemd-sysusers binary as %__systemd_sysusers, the only failure is from filesystem /lib64 due to --noscripts. --noscripts being necessary here to force the sysusers mechanism to be used rather than useradd scripts from packages.
The text was updated successfully, but these errors were encountered: