Package: autopkgtest
Version: 5.32
Severity: normal
File: /usr/bin/autopkgtest-build-qemu
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

autopkgtest-build-qemu assumes that the output
of $(ls -1 /dev/mapper/loop* | sort | tail -1) is the root device for the
created image. This can fail if there are other devices matching that glob.

vmdb2 supports creating /etc/fstab based on the created and mounted
partitions in the image. I've attached a patch to use vmdb2's fstab
support. I've also opened a MR[1] with the same changes.

[1]: https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/292

- --
Vriendelijke groet, Kind regards,

Victor Westerhuis

- -- System Information:
Debian Release: trixie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.6.13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_NL.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en_US:en:nl_NL:nl
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages autopkgtest depends on:
ii  apt-utils       2.7.10
ii  libdpkg-perl    1.22.4
ii  mawk            1.3.4.20240123-1
ii  procps          2:4.0.4-4
ii  python3         3.11.6-1
ii  python3-debian  0.1.49

Versions of packages autopkgtest recommends:
ii  autodep8  0.28
ii  fakeroot  1.33-1

Versions of packages autopkgtest suggests:
pn  docker.io            <none>
pn  fakemachine          <none>
ii  genisoimage          9:1.1.11-3.4
pn  incus                <none>
pn  lxc                  <none>
pn  lxd                  <none>
ii  ovmf                 2023.11-6
pn  ovmf-ia32            <none>
ii  podman               4.9.2+ds1-2
ii  python3-distro-info  1.7
ii  qemu-efi-aarch64     2023.11-6
ii  qemu-efi-arm         2023.11-6
pn  qemu-system          <none>
ii  qemu-utils           1:8.2.1+ds-1
ii  schroot              1.6.13-3+b3
ii  util-linux           2.39.3-6
ii  vmdb2                0.28-1
ii  zerofree             1.1.1-1

- -- no debconf information

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEE6OxII3T+o0Ujs6ECQz2Rq5dHQPsFAmXJFTkTHHZpY3RvckB3
ZXN0ZXJodS5pcwAKCRBDPZGrl0dA+9kLEACcPYoO6aVRGd+VVA62pzkb/uBPAkt4
fsfUfN18g+M/vjaObyKGLPiaDGVB4bxY2eF/fxrRIQEroEutG7gOuFLPEKICJqZT
vIZyWvyLwoYDmHwSRCOi4X45BgX+GRg+j4JBRZ4vDFWX/6L0jOuBLeMP8jjayfBH
qQwof2pXg+3FAYYJKE598LCd770NGevT+dK5Cmnf4CNyrz95ftH6fDHiy0lgQfOF
r0KzmoZNp6VpUR8RTR+DxTBy1qJ5zsyCUW/Ettq4W/16H4V/uPbGr2x7drGiE6tU
cOvMVDFxLSnqFmgBFe5QXHYB8GWrm5gejpSOq/YXwEEgdywhhXj1Krm7p70kbRsg
xQfoUWej+RTex58iQTgSjI1IxuL+nl8veztNpBcDJ4uWq7/91AqoXUHz4vJZ1OaF
qcGwXQjkk5emu46Wy/N2R9HZYUDwukcRqgZ7l26I4IU0dD0VcU+2Hvt6GPTaBHcl
EHVguoysXi4Ob1U/MVIZEK+kQsXCEkBFPEMgf07gj600JHWHc93OqZUFLNwn/U7b
h3WHW5g9vHhM5q3OBrPpQkWDdfblJ/j5aTzthj135vKD/ceFkBQ/8fIRvVIQcsVl
wPSXshC/m/gsiAd4Dptdtdlgf3aEHfNETprQ6s5S+kCiLcZNpumBvLM8UEqFbJqD
XrKtyaPsRcUYSw==
=Rqlg
-----END PGP SIGNATURE-----
>From 18a2f2e7c9e92b2ce386f4abb0581e1d1aa7529b Mon Sep 17 00:00:00 2001
From: Victor Westerhuis <vic...@westerhu.is>
Date: Sun, 11 Feb 2024 19:17:14 +0100
Subject: Let vmdb2 write /etc/fstab in autopkgtest-build-qemu

The old code assumed the last device matching the glob
/dev/mapper/loop* was the root device, which is not
always true.
---
 tools/autopkgtest-build-qemu | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/tools/autopkgtest-build-qemu b/tools/autopkgtest-build-qemu
index a7d135c..2d50d58 100755
--- a/tools/autopkgtest-build-qemu
+++ b/tools/autopkgtest-build-qemu
@@ -521,6 +521,11 @@ class BuildQemu:
 
         if boot == 'efi':
             steps.append(dict(mkfs='vfat', partition='efi'))
+            steps.append({
+                'mount': 'efi',
+                'dirname': 'boot/efi',
+                'mount-on': 'root',
+            })
             steps.append(
                 dict(
                     grub='uefi',
@@ -560,26 +565,7 @@ class BuildQemu:
             ),
         )
 
-        steps.append({
-            'shell': '\n'.join([
-                'rootdev=$(ls -1 /dev/mapper/loop* | sort | tail -1)',
-                'uuid=$(blkid -c /dev/null -o value -s UUID "$rootdev")',
-                ('echo "UUID=$uuid / ext4 errors=remount-ro 0 1" '
-                 '> "$ROOT/etc/fstab"'),
-            ]),
-            'root-fs': 'root',
-        })
-
-        if boot == 'efi':
-            steps.append({
-                'shell': '\n'.join([
-                    'efidev=$(ls -1 /dev/mapper/loop* | sort | head -1)',
-                    'uuid=$(blkid -c /dev/null -o value -s UUID "$efidev")',
-                    ('echo "UUID=$uuid /boot/efi vfat defaults 0 2" '
-                     '>> "$ROOT/etc/fstab"'),
-                ]),
-                'root-fs': 'root',
-            })
+        steps.append(dict(fstab='root'))
 
         for s in (script, user_script):
             if s:
-- 
2.43.0

Reply via email to