]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: don't register short-living containers with machined, again
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 4 Mar 2026 11:32:15 +0000 (12:32 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 4 Mar 2026 13:03:15 +0000 (13:03 +0000)
Otherwise we might try to register the same scope again before the
previous instance gets a chance to be cleaned up:

[   54.378392] systemd-nspawn[2554]: ░ Spawning container TEST-13-NSPAWN.defaultinaccessiblepaths.nxs on /var/lib/machines/TEST-13-NSPAWN.default_inaccessible_paths.nxs.
[   54.382202] systemd-nspawn[2554]: Failed to allocate scope: Unit TEST-13-NSPAWN.defaultinaccessiblepaths.nxs.scope was already loaded or has a fragment file.
[   54.411211] systemd[1]: TEST-13-NSPAWN.service: Main process exited, code=exited, status=1/FAILURE
[   54.411413] systemd[1]: TEST-13-NSPAWN.service: Failed with result 'exit-code'.
[   54.411885] systemd[1]: Failed to start TEST-13-NSPAWN.service - TEST-13-NSPAWN.

This is basically the same change as in
6a05abb9b49900774bc0323316103dceab0c1a7d but for the newly added tests.

Follow-up for 83b8daa032cd0adb538cfd9467e6acf2c44aa661.

Resolves: #40945

test/units/TEST-13-NSPAWN.nspawn.sh

index c753734c33137e8c42808765b06865ecdfb066c6..d5cc05b89f5823ba8697af4c1701d99af542101f 100755 (executable)
@@ -414,7 +414,7 @@ testcase_check_default_inaccessible_paths() {
 
     # Each inaccessible path should have zeroed permissions, which stat's %a reports as a single 0
     for path in "${inaccessible_paths[@]}"; do
-        systemd-nspawn --directory="$root" \
+        systemd-nspawn --register=no --directory="$root" \
                        bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq 0 ]]"
     done
 
@@ -422,14 +422,14 @@ testcase_check_default_inaccessible_paths() {
     # as writable, and it also skips the path masking (by dropping the MOUNT_APPLY_APIVFS_RO flag)
     for path in "${inaccessible_paths[@]}"; do
         exp="$(stat --format=%a "$path")"
-        SYSTEMD_NSPAWN_API_VFS_WRITABLE=yes systemd-nspawn --directory="$root" \
+        SYSTEMD_NSPAWN_API_VFS_WRITABLE=yes systemd-nspawn --register=no --directory="$root" \
                        bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq $exp ]]"
     done
 
     # SYSTEMD_NSPAWN_API_VFS_WRITABLE=network mounts only /proc/sys/net/ as writable but doesn't
     # drop the MOUNT_APPLY_APIVFS_RO flag, so the masking should still apply
     for path in "${inaccessible_paths[@]}"; do
-        SYSTEMD_NSPAWN_API_VFS_WRITABLE=network systemd-nspawn --directory="$root" \
+        SYSTEMD_NSPAWN_API_VFS_WRITABLE=network systemd-nspawn --register=no --directory="$root" \
                        bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq 0 ]]"
     done