** Description changed:

+ [ Impact ]
+ 
+  * The d/tests/initrd-boot autopkgtest for nbd only skips swap-file
+    allocation on armhf, based on the assumption that armhf is the only
+    architecture ever run inside a container. That assumption no longer
+    holds: autopkgtest workers for other architectures (and even armhf
+    itself, where `uname -m` can report `armv8l` instead of `armv7l` when
+    running 32-bit userspace under a 64-bit container/kernel) can also be
+    containers, where creating/activating a swap file is not permitted.
+  * This causes the initrd-boot test to fail when it (mis)detects that
+    swap should be allocated while actually running in an LXC/LXD
+    container, producing spurious autopkgtest failures/regressions for
+    nbd itself and for other packages.
+  * The fix (LP: #2163156) replaces the architecture-based heuristic with
+    a proper container check using `systemd-detect-virt --container`,
+    skipping swap allocation whenever running inside a container,
+    regardless of architecture.
+ 
+ [ Test Plan ]
+ 
+  * Trigger/observe the nbd autopkgtest suite (in particular
+    d/tests/initrd-boot) across all architectures, including armhf and
+    arm64:
+    - on non-containerized (VM/bare-metal) autopkgtest workers, confirm
+      swap is still allocated and the test passes as before.
+    - on containerized (LXC/LXD) autopkgtest workers, confirm swap
+      allocation is skipped and the test completes successfully instead
+      of failing.
+ 
+ [ Where problems could occur ]
+ 
+  * The change is confined to the autopkgtest script
+    (debian/tests/initrd-boot); no shipped binary, library, or runtime
+    behaviour is touched, so there is no risk to users' running systems.
+  * The only risk is a misdetection by `systemd-detect-virt --container`
+    on some architecture/testbed combination, which could either:
+    - skip swap allocation when it would have succeeded, reducing the
+      test's memory margin and potentially causing an unrelated
+      out-of-memory test failure, or
+    - still attempt swap allocation inside a container where it isn't
+      permitted, reproducing the original failure.
+    Either failure mode is limited to the autopkgtest environment itself.
+ 
+ [ Other Info ]
+ 
+  * This mirrors the fix already released for stonking/26.10 in nbd
+    1:3.27.1-3ubuntu1 (LP: #2163156), proposed merge:
+    
https://code.launchpad.net/~ahasenack/ubuntu/+source/nbd/+git/nbd/+merge/509374
+  * Resolute needs the same fix because its armhf autopkgtest workers
+    were also found to misreport `uname -m` as `armv8l`, defeating the
+    original architecture-based check.
+ 
+  * This SRU is meant to stay in -proposed, hence the tag block-proposed
+ 
+ ---
+ 
  The test d/t/initrd-boot has this part:
  
  # Check if the architecture is armhf, and only attempt to enable swap if it's 
not
  if ! [ $(uname -m) = "armv7l" ]; then
      # Allocate some swap
      fallocate -l 2G /swapfile
      chmod 600 /swapfile
      mkswap /swapfile
      swapon /swapfile
  else
      echo "Skipping swap activation on armhf architecture"
  fi
  
  That was based on the assumption that only armhf was running in
  containers, but nowadays that's no longer true.
  
  The test should change that conditional to check for a container
  instead, unless the swap file is a crucial part of the test, in which
  case a isolation-machine restriction should be added.
- 
  
  The error:
  227s autopkgtest [23:44:17]: test initrd-boot: [-----------------------
  227s + TMPDIR=/tmp/autopkgtest.mB62Ws/autopkgtest_tmp
  227s + OUTDIR=/tmp/autopkgtest.mB62Ws/initrd-boot-artifacts
  227s + chmod a+rx /tmp/autopkgtest.mB62Ws/autopkgtest_tmp
  227s ++ grep '^ID=' /etc/os-release
  227s + eval ID=ubuntu
  227s ++ ID=ubuntu
  227s + '[' ubuntu = ubuntu ']'
  227s + COMPONENTS=main,universe
  227s + INCLUDES=e2fsprogs,zstd,openssh-server
  227s + EXTRAS=--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg
  227s + ssh-keygen -q -t rsa -f /tmp/autopkgtest.mB62Ws/autopkgtest_tmp/id_rsa 
-N ''
  228s + IMAGE=/tmp/autopkgtest.mB62Ws/autopkgtest_tmp/nbd.img
  228s ++ uname -m
  228s + '[' ppc64le = armv7l ']'
  228s + fallocate -l 2G /swapfile
  228s + chmod 600 /swapfile
  228s + mkswap /swapfile
  228s Setting up swapspace version 1, size = 2 GiB (2147418112 bytes)
  228s no label, UUID=3e900e6d-2850-4882-9a67-a2d7acb25686
  228s + swapon /swapfile
  228s swapon: /swapfile: swapon failed: Operation not permitted

** Changed in: nbd (Ubuntu Resolute)
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2163156

Title:
  autopkgtest failure in containers due to swap file

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nbd/+bug/2163156/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to