From 829df602421f95625c20c41b25f97cae3122b82a Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Sun, 13 Feb 2022 17:38:40 +0100 Subject: [PATCH 1/5] mmdebstrap: Align autopkgtest-build-qemu and USB stick examples Write the same `guestfish` instructions in the same way in both the `autopkgtest-build-qemu` and the "Debian desktopn on a USB stick" example. --- mmdebstrap | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index c83ca2d..e80b6ac 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6817,9 +6817,11 @@ Create a bootable USB Stick that boots into a full Debian desktop: END # You can use $(sudo blockdev --getsize64 /dev/sdXXX) to get the right # image size for the target medium in bytes - $ guestfish -N debian-unstable.img=disk:8G -- part-disk /dev/sda mbr : \ - part-set-bootable /dev/sda 1 true : mkfs ext2 /dev/sda1 : \ - set-label /dev/sda1 rootfs : mount /dev/sda1 / : \ + $ guestfish -N debian-unstable.img=disk:8G -- \ + part-disk /dev/sda mbr : \ + part-set-bootable /dev/sda 1 true : \ + set-label /dev/sda1 rootfs : \ + mkfs ext2 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ upload /usr/lib/SYSLINUX/mbr.bin /mbr.bin : \ copy-file-to-device /mbr.bin /dev/sda size:440 : rm /mbr.bin : \ @@ -6859,8 +6861,7 @@ Use as replacement for autopkgtest-build-qemu and vmdb2: part-set-bootable /dev/sda 1 true : \ mkfs ext2 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ - extlinux / : copy-in extlinux.conf / : \ - sync : umount / : shutdown + extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown $ qemu-img convert -O qcow2 debian-unstable.img debian-unstable.qcow2 As a debootstrap wrapper to run it without superuser privileges but using Linux -- 2.39.2 From 22c0ba45a03b91847dd5492054a5d2d018ac2654 Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Sun, 13 Feb 2022 17:44:25 +0100 Subject: [PATCH 2/5] mmdebstrap: Use ext4 instead of ext2 in examples --- mmdebstrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index e80b6ac..614dd44 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6821,7 +6821,7 @@ Create a bootable USB Stick that boots into a full Debian desktop: part-disk /dev/sda mbr : \ part-set-bootable /dev/sda 1 true : \ set-label /dev/sda1 rootfs : \ - mkfs ext2 /dev/sda1 : mount /dev/sda1 / : \ + mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ upload /usr/lib/SYSLINUX/mbr.bin /mbr.bin : \ copy-file-to-device /mbr.bin /dev/sda size:440 : rm /mbr.bin : \ @@ -6859,7 +6859,7 @@ Use as replacement for autopkgtest-build-qemu and vmdb2: $ guestfish -N debian-unstable.img=disk:8G -- \ part-disk /dev/sda mbr : \ part-set-bootable /dev/sda 1 true : \ - mkfs ext2 /dev/sda1 : mount /dev/sda1 / : \ + mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown $ qemu-img convert -O qcow2 debian-unstable.img debian-unstable.qcow2 -- 2.39.2 From 97e6981ddc4e878f28fce911f617344a9871692f Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Sun, 13 Feb 2022 17:49:45 +0100 Subject: [PATCH 3/5] mmdebstrap: Read extlinux's MBR from /usr/lib/EXTLINUX `/usr/lib/SYSLINUX` is not available if only `extlinux` is installed. --- mmdebstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmdebstrap b/mmdebstrap index 614dd44..0b1e869 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6823,7 +6823,7 @@ Create a bootable USB Stick that boots into a full Debian desktop: set-label /dev/sda1 rootfs : \ mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ - upload /usr/lib/SYSLINUX/mbr.bin /mbr.bin : \ + upload /usr/lib/EXTLINUX/mbr.bin /mbr.bin : \ copy-file-to-device /mbr.bin /dev/sda size:440 : rm /mbr.bin : \ extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown $ qemu-system-x86_64 -m 1G -enable-kvm debian-unstable.img -- 2.39.2 From 8e6f183b3fc0e79323c7038bbe58ed89d2bb3c2f Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Sun, 13 Feb 2022 19:56:39 +0100 Subject: [PATCH 4/5] mmdebstrap: Install mbr.bin in /boot and keep after installation --- mmdebstrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 0b1e869..660569b 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6823,8 +6823,8 @@ Create a bootable USB Stick that boots into a full Debian desktop: set-label /dev/sda1 rootfs : \ mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ - upload /usr/lib/EXTLINUX/mbr.bin /mbr.bin : \ - copy-file-to-device /mbr.bin /dev/sda size:440 : rm /mbr.bin : \ + upload /usr/lib/EXTLINUX/mbr.bin /boot/mbr.bin : \ + copy-file-to-device /boot/mbr.bin /dev/sda size:440 : \ extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown $ qemu-system-x86_64 -m 1G -enable-kvm debian-unstable.img $ sudo dd if=debian-unstable.img of=/dev/sdXXX status=progress -- 2.39.2 From 5fa2457fd55da2d459ea40e75d1bb1c673d95938 Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Sun, 13 Feb 2022 20:00:30 +0100 Subject: [PATCH 5/5] mmdebstrap: Add mbr.bin installation to autopkgtest-build-qemu instructions The generated image will not be bootable if `mbr.bin` is not installed into the MBR. These lines are copied from the "Debian desktop on USB stick" example. --- mmdebstrap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmdebstrap b/mmdebstrap index 660569b..d8ee1ec 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6861,6 +6861,8 @@ Use as replacement for autopkgtest-build-qemu and vmdb2: part-set-bootable /dev/sda 1 true : \ mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \ tar-in debian-unstable.tar / xattrs:true : \ + upload /usr/lib/EXTLINUX/mbr.bin /boot/mbr.bin : \ + copy-file-to-device /boot/mbr.bin /dev/sda size:440 : \ extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown $ qemu-img convert -O qcow2 debian-unstable.img debian-unstable.qcow2 -- 2.39.2