Hey, so I'll be moving this bug to "Won't fix". Here's the reasoning;
- the virt server ssh's to the testbed under the ubuntu user, or whatever non-root user is the main user of the system - after ssh'ing, and login as ubuntu, autopkgtest uses `sudo -n` - see here https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2104280 - this gives autopkgtest root privileges for things like apt functionality - we then switch back to the ubuntu user - see here https://salsa.debian.org/ubuntu-ci-team/autopkgtest/-/blob/ubuntu/production/lib/adt_testbed.py#L1372 - in order to run tests that don't have the needs-sudo restriction, like yours. - the systemd user slice is up and running after the initial ssh - however, using sudo -n and then su to get back to the non-root user, this new shell is NOT connected to the user slice, and is missing all associated env variables Fixing it is non-trivial. We'd have to make a lot of changes to adt_testbed.py, which we'd ideally want to upstream; however, that'd be an uphill battle, as the changes would affect *every* virt server, and potentially cause regressions all over the place. Hope this is okay. You said you have a workaround for your specific test - so I hope all is good. This issue is somewhat documented - see isolation-container at https://salsa.debian.org/ubuntu-ci- team/autopkgtest/-/blob/ubuntu/production/doc/README.package-tests.rst ** Changed in: auto-package-testing Status: In Progress => Won't Fix ** Changed in: auto-package-testing Assignee: Tim Andersson (andersson123) => (unassigned) -- You received this bug notification because you are a member of Canonical's Ubuntu QA, which is subscribed to Auto Package Testing. https://bugs.launchpad.net/bugs/2103695 Title: autopkgtest runner does not run a systemd user instance Status in Auto Package Testing: Won't Fix Bug description: Both autopkgtest-virt-lxd and autopkgtest-virt-qemu, as well as debian's infra autopkgtest runners, have a systemd user session instance running during the test; this is evidenced by the fact that `$XDG_RUNTIME_DIR` is set, and you can talk to it with `systemctl --user` commands. Ubuntu's infrastructure instead does not have a systemd user instance running, creating a divergence in the test environment. Here's the most minimal reproducer: dget https://launchpad.net/~aleasto/+archive/ubuntu/tests/+sourcefiles/empty/1.0/empty_1.0.dsc autopkgtest ./empty_1.0.dsc -- qemu autopkgtest-plucky-amd64.img where autopkgtest-plucky-amd64.img is generated by autopkgtest- buildvm-ubuntu-cloud. The test runs the following script: echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" systemctl --user status The test passes locally, but not on ubuntu's infrastructure. Here's a log from my ppa: https://autopkgtest.ubuntu.com/results/autopkgtest-plucky-aleasto-tests/plucky/amd64/e/empty/20250319_161854_94e24@/log.gz Expected result: autopkgtest [10:03:00]: test test-systemd-user: [----------------------- XDG_RUNTIME_DIR=/run/user/1000 ● autopkgtest State: running Units: 133 loaded (incl. loaded aliases) Jobs: 0 queued Failed: 0 units Since: Thu 2025-03-20 10:03:01 CET; 136ms ago systemd: 257.4-1ubuntu1 Tainted: unmerged-bin CGroup: /user.slice/user-1000.slice/user@1000.service └─init.scope ├─15648 /usr/lib/systemd/systemd --user └─15650 "(sd-pam)" Actual result: autopkgtest [16:18:34]: test test-systemd-user: [----------------------- XDG_RUNTIME_DIR= Failed to connect to user scope bus via local transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user) To manage notifications about this bug go to: https://bugs.launchpad.net/auto-package-testing/+bug/2103695/+subscriptions -- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp