test-execute fails in LXD with failure in exec-networknamespacepath-privatemounts-no.service

Bug #2046498 reported by Nick Rosbrook
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
High
Nick Rosbrook

Bug Description

This is in v255. This log snippet is taken from a local autopkgtest build:

exec-networknamespacepath-privatemounts-no.service: Child 4580 belongs to exec-networknamespacepath-privatemounts-no.service.
exec-networknamespacepath-privatemounts-no.service: Main process exited, code=exited, status=0/SUCCESS (success)
exec-networknamespacepath-privatemounts-no.service: Running next main command for state start.
exec-networknamespacepath-privatemounts-no.service: Will spawn child (service_run_next_main): /bin/sh
exec-networknamespacepath-privatemounts-no.service: Passing 0 fds to service
exec-networknamespacepath-privatemounts-no.service: About to execute: /bin/sh -x -c "ip link show dummy-test-ns"
Serializing sd-executor-state to memfd.
exec-networknamespacepath-privatemounts-no.service: Forked /bin/sh as 4581
Closing set fd 19 (socket:[109908])
Closing set fd 21 (socket:[111151])
Closing set fd 20 (socket:[111150])
Received SIGCHLD from PID 4581 (sh).
Child 4581 (sh) died (code=exited, status=1/FAILURE)
exec-networknamespacepath-privatemounts-no.service: Child 4581 belongs to exec-networknamespacepath-privatemounts-no.service.
exec-networknamespacepath-privatemounts-no.service: Main process exited, code=exited, status=1/FAILURE
exec-networknamespacepath-privatemounts-no.service: Failed with result 'exit-code'.
exec-networknamespacepath-privatemounts-no.service: Service will not restart (restart setting)
exec-networknamespacepath-privatemounts-no.service: Changed start -> failed
exec-networknamespacepath-privatemounts-no.service: Unit entered failed state.
exec-networknamespacepath-privatemounts-no.service: Consumed 23ms CPU time.
src/test/test-execute.c:1124:test_exec_networknamespacepath: exec-networknamespacepath-privatemounts-no.service: can_unshare=no: exit status 1, expected 0
(test-execute-without-unshare) terminated by signal ABRT.
Assertion 'r >= 0' failed at src/test/test-execute.c:1330, function prepare_ns(). Aborting.

Nick Rosbrook (enr0n)
Changed in systemd (Ubuntu):
importance: Undecided → High
assignee: nobody → Nick Rosbrook (enr0n)
Revision history for this message
Nick Rosbrook (enr0n) wrote :

The issue with this is that during the test setup, adding the dummy-test-ns interface to the test-execute-netns network namespace fails with EPERM, but this return code is not checked at all:

...
        /* Create dummy network interface for testing PrivateNetwork=yes */
        have_net_dummy = system("ip link add dummy-test-exec type dummy") == 0;

        if (have_net_dummy) {
                /* Create a network namespace and a dummy interface in it for NetworkNamespacePath= */
                (void) system("ip netns add test-execute-netns");
                (void) system("ip netns exec test-execute-netns ip link add dummy-test-ns type dummy");
        }
...

Running these commands manually in the LXD environment that the tests run in:

# ip link add dummy-test-exec type dummy
# ip netns add test-execute-netns
# ip netns exec test-execute-netns ip link add dummy-test-ns type dummy
mount of /sys failed: Operation not permitted

The right solution might be to make the test case dependent on the success of those setup calls, similar to what is done with `have_net_dummy`.

Revision history for this message
Nick Rosbrook (enr0n) wrote :
Changed in systemd (Ubuntu):
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 255.2-3ubuntu2

---------------
systemd (255.2-3ubuntu2) noble; urgency=medium

  * test: skip test_exec_networknamespacepath if netns setup fails (LP: #2046498)
    Files:
    - debian/patches/lp2046498-test-skip-test_exec_networknamespacepath-if-netns-setup-f.patch
    - debian/patches/test-skip-failing-test-execute-tests-in-LXC.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=de1fcf756e47858f4a206db97434bce4a71384d0
  * test: skip TEST-43-PRIVATEUSER-UNPRIV if unprivileged userns is restricted
    File: debian/patches/test-skip-TEST-43-PRIVATEUSER-UNPRIV-if-unprivileged-user.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=2aba69874c83289c43d199ca360aa2fc451486a7
  * Drop debian/UBUNTU-src-test-test-execute.c-Skip-parts-of-test-execute-in-con.patch.
    This will be re-addressed with a different patch.
    File: debian/patches/debian/UBUNTU-src-test-test-execute.c-Skip-parts-of-test-execute-in-con.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=c3cd814e028364fe0c641d4bacfce22aafd1b572
  * Drop test-skip-failing-test-execute-tests-in-LXC.patch.
    This will be re-addressed with different patches.
    File: debian/patches/test-skip-failing-test-execute-tests-in-LXC.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=ab853707f4cc3e7e2d5993ff38998c3c2c789f62
  * test: temporarily skip credentials tests in LXC.
    This was already skipped in another patch, but now that we know what's
    going on with it, split it out.
    File: debian/patches/test-temporarily-skip-credentials-tests-in-LXC.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=c71acb411d315267fe811f024cdab97e032453f3
  * test: skip test-execute in arhmf LXC containers
    File: debian/patches/test-skip-test-execute-in-arhmf-LXC-containers.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=1cb1e3060822bfadddead564e779942e73e02f62
  * test: skip exec-privatenetwork-yes-privatemounts-yes.service in LXC (LP: #2046495)
    File: debian/patches/test-skip-exec-privatenetwork-yes-privatemounts-yes.servi.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=3ab76fd2db4291ee0531a07085c72cee06cb0d12
  * test: skip a systemd-run test if unprivileged userns is restricted
    File: debian/patches/test-skip-a-systemd-run-test-if-unprivileged-userns-is-re.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=c85f2b4e32ee8fd1c0dc58d23e7fabdb7590d3cc
  * test-execute: skip tests that are broken without unprivileged userns
    File: debian/patches/test-execute-skip-tests-that-are-broken-without-unprivile.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=7a6573c4f5133a7fec11fb059dd215f7c8c2204e

 -- Nick Rosbrook <email address hidden> Wed, 24 Jan 2024 14:53:46 -0500

Changed in systemd (Ubuntu):
status: Triaged → Fix Released
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.