** Description changed: [ Impact ] When installing or upgrading udev inside unprivileged user namespaces (e.g. sbuild with unshare backend, rootless containers, Apptainer), systemd-tmpfiles fails during udev.postinst with exit code 73: fchownat() of /dev/kvm failed: Operation not permitted dpkg: error processing package udev (--configure) This happens because dh_installtmpfiles in debhelper 14 dropped the trailing "|| true" fallback from maintainer scripts, and systemd- tmpfiles aborted fatally upon receiving EPERM or EACCES when chowning static device nodes whose owner lies outside the namespace mapping. [ Fix ] - In src/tmpfiles/tmpfiles.c (fd_set_perms): - Gracefully tolerate privilege errors (EPERM, EACCES) when modifying ownership or permissions on character and block device nodes (S_ISCHR, S_ISBLK) in user runtime scope, unprivileged user namespaces, or containers. - If a temporary mode tightening was applied before the failed chown, restore the original node mode (st_mode & 07777) before skipping via shortcut. - Regular files still fail fatally with EX_CANTCREAT (exit code 73) on permission errors. + Under active revision following upstream review on PR #44413. As noted by upstream (Lennart Poettering), suppressing EPERM in tmpfiles.c core weakens access control invariants on bare metal and privileged systems. The fix is being refactored into distro packaging (guarding the static-nodes tmpfiles invocation in udev.postinst when running in an unprivileged build chroot / container without active systemd). [ Test Plan ] - 1. Inside an unprivileged container or user namespace with /dev/null bind-mounted: - echo 'z /dev/null 0666 0 0' | systemd-tmpfiles --create - --user - Verify exit status is 0 and log reports: - "Lacking privilege to fchownat device node /dev/null, skipping: Operation not permitted" - 2. Run against a regular file where user lacks chown capability: - echo 'z /etc/shadow 0600 0 0' | systemd-tmpfiles --create - --user - Verify exit status is 73 (EX_CANTCREAT) and operation fails fatally. - 3. Run as root on host: - Verify /dev/null ownership is preserved and exit status is 0. - 4. Run full unit test suite: - python3 test/test-systemd-tmpfiles.py build/systemd-tmpfiles - Verify 100% test pass. + 1. Run sbuild with unshare backend and autopkgtest with /dev/kvm bind-mounted: + sbuild --chroot-mode=unshare --run-autopkgtest ... + 2. Verify udev package configuration completes with exit code 0. + 3. On a standard booted host with active systemd, verify udev.postinst continues to apply static-nodes-permissions.conf correctly. + 4. Run systemd package test suite: 0 regressions. [ Where problems could occur ] - The change only relaxes errors for device nodes (character and block devices) when running in user scope, user namespaces, or containers. - If a user intentionally requires strict ownership enforcement on a bind-mounted static device node inside an unprivileged container, failures will now be logged at debug level and skipped instead of aborting execution. Regular files and root executions remain unaffected. + The packaging guard only bypasses static-nodes tmpfiles execution in unprivileged chroots or containers where systemd is not booted. On live systems running systemd, permissions on static device nodes continue to be enforced as before. [ Other Info ] - Target release: Ubuntu 26.10 (stonking) - - Development release (tenacious): Upstream PR #44413 is submitted and passing upstream CI; will be synced once merged into upstream main. - - Upstream PR: https://github.com/systemd/systemd/pull/44413 + - Upstream PR: https://github.com/systemd/systemd/pull/44413 (upstream review concluded that core tmpfiles C suppression should be dropped in favor of distro packaging handling) - Debian BTS: #1140336 (https://bugs.debian.org/1140336) - - Test suite: upstream and debian test suites pass with 0 regressions. --- [ Original Report ] Imported from Debian bug http://bugs.debian.org/1140336: Package: udev Version: 261~rc4-1 Severity: normal X-Debbugs-Cc: <email address hidden> Dear Maintainer, I am using sbuild with the unshare backend and this config for autopkgtest: $autopkgtest_opts = ['--', 'unshare', '--release', '%r', '--arch', '%a', '-b', '/dev/kvm', '/dev/kvm']; Running sbuild --run-autopkgtest on the dracut source code started to fail during package installation: Setting up udev (261~rc4-1) ... Creating group 'input' with GID 995. Creating group 'sgx' with GID 994. Creating group 'clock' with GID 993. Creating group 'kvm' with GID 992. Creating group 'render' with GID 991. fchownat() of /dev/kvm failed: Operation not permitted dpkg: error processing package udev (--configure): old udev package postinst maintainer script subprocess failed with exit status 73 - -- + -- Benjamin Drung Debian & Ubuntu Developer
** Patch removed: "debdiff for systemd 261.3-0ubuntu4 (stonking)" https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2160036/+attachment/6012199/+files/systemd_261.3-0ubuntu4.debdiff -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2160036 Title: udev: fchownat() of /dev/kvm failed: Operation not permitted To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2160036/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
