test-execute fails because of apparmor unprivileged userns restrictions

Bug #2065964 reported by Nick Rosbrook
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Committed
Undecided
Nick Rosbrook
Noble
Fix Released
Medium
Nick Rosbrook

Bug Description

[Impact]

unit-tests in noble currently fails because test-execute fails with the following:

1633s exec-basic.service: Child 1934 belongs to exec-basic.service.
1633s exec-basic.service: Control process exited, code=exited, status=0/SUCCESS (success)
1633s exec-basic.service: Got final SIGCHLD for state start-post.
1633s exec-basic.service: Deactivated successfully.
1633s exec-basic.service: Service will not restart (restart setting)
1633s exec-basic.service: Changed start-post -> dead
1633s exec-basic.service: Consumed 49ms CPU time.
1633s Spawning process to nuke '/tmp/systemd-private-dbf1f9a2e08f4741900f145a35ce7e30-exec-basic.service-ItwK5c'
1633s Successfully forked off intermediary '(sd-rmrf)' as PID 1936.
1633s Spawning process to nuke '/var/tmp/systemd-private-dbf1f9a2e08f4741900f145a35ce7e30-exec-basic.service-V50z4Q'
1633s Successfully forked off intermediary '(sd-rmrf)' as PID 1937.
1633s src/test/test-execute.c:1121:test_exec_basic: exec-basic.service: can_unshare=no: exit status 0, expected 226
1633s Skipping PR_SET_MM, as we don't have privileges.
1633s Skipping PR_SET_MM, as we don't have privileges.
1633s (test-execute-unprivileged) terminated by signal ABRT.
1633s Assertion 'r >= 0' failed at src/test/test-execute.c:1412, function prepare_ns(). Aborting.
1633s

[...]

1678s OK: 288 SKIP: 6 FAIL: 1
1679s autopkgtest [20:59:40]: test unit-tests: -----------------------]
1679s autopkgtest [20:59:40]: test unit-tests: - - - - - - - - - - results - - - - - - - - - -
1679s unit-tests FAIL non-zero exit status 1

This is because some tests in test-execute run unprivileged, and try to user user namespaces. I fixed this upstream[1], so just backport the patch so that this test case no longer fails.

[Test Plan]

This only pertains to the unit-tests autopkgtest in systemd. Just check the result of the autopkgtest run.

[Where problems could occur]

This only changes the test-execute code to skip tests that require unprivileged userns whenever kernel.apparmor_restrict_unprivileged_userns=1. Hence, any problems would be limited to that test case within unit-tests.

[Other information]

Note that the upstream-2 test still has regular failures which need to be investigated, so this change will not get the systemd autopkgtests back to green. Since I already fixed this upstream, it is easy to backport, so it's worth making the incremental improvement for now.

[1] https://github.com/systemd/systemd/commit/70aece819311f7ab76abdf473bc8f316c5bc58c6

Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu):
status: New → Fix Committed
Changed in systemd (Ubuntu Noble):
status: New → Triaged
assignee: nobody → Nick Rosbrook (enr0n)
importance: Undecided → Medium
Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu Noble):
status: Triaged → In Progress
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Nick, or anyone else affected,

Accepted systemd into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/255.4-1ubuntu8.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in systemd (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (systemd/255.4-1ubuntu8.1)
Download full text (4.9 KiB)

All autopkgtests for the newly accepted systemd (255.4-1ubuntu8.1) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

389-ds-base/unknown (armhf, s390x)
aide/unknown (s390x)
amavisd-new/unknown (s390x)
apport/2.28.1-0ubuntu3 (arm64)
apport/unknown (s390x)
appstream/unknown (s390x)
apt/2.7.14build2 (armhf)
apt/unknown (s390x)
asterisk/unknown (s390x)
at-spi2-core/unknown (s390x)
ayatana-indicator-session/unknown (s390x)
bind9/unknown (amd64, armhf, i386, s390x)
bolt/unknown (amd64, s390x)
casper/unknown (s390x)
casync/unknown (s390x)
ceph/unknown (s390x)
clamav/unknown (amd64)
clevis/unknown (s390x)
cloudflare-ddns/unknown (s390x)
clutter-1.0/unknown (amd64)
cockpit/unknown (s390x)
collectd/unknown (s390x)
colord/unknown (s390x)
comitup/unknown (amd64, s390x)
conntrack-tools/unknown (amd64)
corosync/3.1.7-1ubuntu3 (arm64)
corosync/unknown (s390x)
corosync-qdevice/unknown (amd64, s390x)
coturn/unknown (armhf, s390x)
cron/unknown (ppc64el, s390x)
crun/unknown (amd64, s390x)
cryptsetup/2:2.7.0-1ubuntu4 (arm64)
csync2/unknown (amd64, s390x)
cups/unknown (amd64, s390x)
dbus/1.14.10-4ubuntu4 (i386)
dbus/unknown (amd64, armhf, s390x)
dbus-broker/unknown (amd64, s390x)
debos/unknown (amd64)
dhcpcd/unknown (armhf, s390x)
dlm/unknown (amd64)
dovecot/unknown (amd64)
dpdk/23.11-1build3 (amd64)
dq/20240101-1 (amd64)
exim4/unknown (amd64, armhf)
expeyes/unknown (amd64)
fcgiwrap/unknown (amd64)
fluidsynth/unknown (amd64, i386)
freedom-maker/unknown (amd64, armhf, i386)
freedombox/unknown (amd64)
freeradius/unknown (amd64)
fwupd/unknown (amd64)
gamemode/unknown (i386)
gdm3/unknown (amd64)
golang-github-coreos-go-systemd/unknown (amd64)
gpsd/unknown (amd64)
gvfs/unknown (s390x)
haproxy/unknown (amd64)
hddemux/unknown (amd64)
hwloc/unknown (amd64, s390x)
incus/unknown (amd64)
init-system-helpers/unknown (amd64)
initramfs-tools/unknown (amd64)
interception-tools/unknown (amd64)
janus/unknown (amd64)
keyman/unknown (amd64)
knot/unknown (amd64)
knot-resolver/unknown (amd64)
libcamera/0.2.0-3fakesync1build6 (amd64, armhf)
libei/1.2.1-1 (amd64)
libinput/unknown (amd64)
liblinux-systemd-perl/unknown (amd64)
libreswan/unknown (amd64)
libsdl2/unknown (amd64)
libsfml/2.6.1+dfsg-2build2 (armhf)
libsfml/unknown (amd64)
libsoup2.4/2.74.3-6ubuntu1 (ppc64el)
libsoup2.4/unknown (amd64)
libsoup3/unknown (amd64)
libusbauth-configparser/unknown (amd64)
libvirt/unknown (amd64)
lighttpd/unknown (amd64)
linux-ibm/unknown (amd64)
logiops/unknown (amd64)
logrotate/unknown (amd64)
mariadb/unknown (amd64)
mediawiki/unknown (amd64)
mir/unknown (amd64)
mkosi/unknown (amd64)
monitoring-plugins-systemd/unknown (amd64)
mosquitto/unknown (amd64)
multipath-tools/unknown (amd64)
munin/unknown (amd64)
mutter/unknown (amd64)
nagios-tang/unknown (amd64, s390x)
ndctl/unknown (armhf, s390x)
network-manager/unknown (amd64, s390x)
nextepc/unknown (amd64)
nix/unknown (amd64, armhf)
nut/unknown (amd64, armhf, s390x)
open-build-service/unknown (amd64)
openssh/unknown (amd64)
openvpn/unknown (amd64)
openzwave/unknown (amd64)
ovn/unknown (amd64)
pam/unknown (amd64, i386)
pdns-recursor/unknown (amd64)
pgagroal/unknown (amd64)
pgbouncer/unknown ...

Read more...

Revision history for this message
Nick Rosbrook (enr0n) wrote :

This autopkgtest result for systemd 255.4-1ubuntu8.1 shows the unit-tests test now passing: https://autopkgtest.ubuntu.com/results/autopkgtest-noble/noble/amd64/s/systemd/20240522_201458_f86bd@/log.gz.

tags: added: verification-done verification-done-noble
removed: verification-needed verification-needed-noble
Revision history for this message
Nick Rosbrook (enr0n) wrote :

The autopkgtest regressions were all resolved with retries.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 255.4-1ubuntu8.1

---------------
systemd (255.4-1ubuntu8.1) noble; urgency=medium

  * debian/systemd-resolved.postinst: ignore cp failure (LP: #2047975)
  * debian/systemd.postinst: don't restart user managers if too old (LP: #2054761)
  * switch-root: use MS_MOVE for /run when switchig from initrd (LP: #2064096)
  * test: check for kernel.apparmor_restrict_unprivileged_userns (LP: #2065964)

 -- Nick Rosbrook <email address hidden> Fri, 17 May 2024 10:47:34 +0200

Changed in systemd (Ubuntu Noble):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.