Compare commits

...

7 commits

Author SHA1 Message Date
489e51a2eb
Run File::Find::find with no_chdir=>1
Without no_chdir=>1 the unshared child process in unshare mode needs
read permissions for the directory from which mmdebstrap is executed.
With this change, the current working directory does not need to be
world-readable anymore.

Closes: #1005857
Reported-by: Trent W. Buck <trentbuck@gmail.com>
2022-02-16 10:53:05 +01:00
fe87c3a1b8
README.md: add Gioele Barabucci 2022-02-14 07:57:52 +01:00
5fa2457fd5 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.
2022-02-13 20:00:35 +01:00
8e6f183b3f mmdebstrap: Install mbr.bin in /boot and keep after installation 2022-02-13 19:56:39 +01:00
97e6981ddc mmdebstrap: Read extlinux's MBR from /usr/lib/EXTLINUX
`/usr/lib/SYSLINUX` is not available if only `extlinux` is installed.
2022-02-13 19:55:29 +01:00
22c0ba45a0 mmdebstrap: Use ext4 instead of ext2 in examples 2022-02-13 17:44:25 +01:00
829df60242 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.
2022-02-13 17:42:26 +01:00
2 changed files with 16 additions and 9 deletions

View file

@ -154,3 +154,4 @@ Contributors
- Konstantin Demin - Konstantin Demin
- Trent W. Buck - Trent W. Buck
- Vagrant Cascadian - Vagrant Cascadian
- Gioele Barabucci

View file

@ -4094,7 +4094,10 @@ sub approx_disk_usage {
$installed_size += 1; $installed_size += 1;
} }
}; };
find($scan_installed_size, $directory); # We use no_chdir because otherwise the unshared user has to have read
# permissions for the current working directory when producing an ext2
# image. See https://bugs.debian.org/1005857
find({ wanted => $scan_installed_size, no_chdir => 1 }, $directory);
# because the above is only a heuristic we add 10% extra for good measure # because the above is only a heuristic we add 10% extra for good measure
return int($installed_size * 1.1); return int($installed_size * 1.1);
@ -6817,12 +6820,14 @@ Create a bootable USB Stick that boots into a full Debian desktop:
END END
# You can use $(sudo blockdev --getsize64 /dev/sdXXX) to get the right # You can use $(sudo blockdev --getsize64 /dev/sdXXX) to get the right
# image size for the target medium in bytes # image size for the target medium in bytes
$ guestfish -N debian-unstable.img=disk:8G -- part-disk /dev/sda mbr : \ $ guestfish -N debian-unstable.img=disk:8G -- \
part-set-bootable /dev/sda 1 true : mkfs ext2 /dev/sda1 : \ part-disk /dev/sda mbr : \
set-label /dev/sda1 rootfs : mount /dev/sda1 / : \ part-set-bootable /dev/sda 1 true : \
set-label /dev/sda1 rootfs : \
mkfs ext4 /dev/sda1 : mount /dev/sda1 / : \
tar-in debian-unstable.tar / xattrs:true : \ tar-in debian-unstable.tar / xattrs:true : \
upload /usr/lib/SYSLINUX/mbr.bin /mbr.bin : \ upload /usr/lib/EXTLINUX/mbr.bin /boot/mbr.bin : \
copy-file-to-device /mbr.bin /dev/sda size:440 : rm /mbr.bin : \ copy-file-to-device /boot/mbr.bin /dev/sda size:440 : \
extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown extlinux / : copy-in extlinux.conf / : sync : umount / : shutdown
$ qemu-system-x86_64 -m 1G -enable-kvm debian-unstable.img $ qemu-system-x86_64 -m 1G -enable-kvm debian-unstable.img
$ sudo dd if=debian-unstable.img of=/dev/sdXXX status=progress $ sudo dd if=debian-unstable.img of=/dev/sdXXX status=progress
@ -6857,10 +6862,11 @@ Use as replacement for autopkgtest-build-qemu and vmdb2:
$ guestfish -N debian-unstable.img=disk:8G -- \ $ guestfish -N debian-unstable.img=disk:8G -- \
part-disk /dev/sda mbr : \ part-disk /dev/sda mbr : \
part-set-bootable /dev/sda 1 true : \ 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 : \ tar-in debian-unstable.tar / xattrs:true : \
extlinux / : copy-in extlinux.conf / : \ upload /usr/lib/EXTLINUX/mbr.bin /boot/mbr.bin : \
sync : umount / : shutdown 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 $ qemu-img convert -O qcow2 debian-unstable.img debian-unstable.qcow2
As a debootstrap wrapper to run it without superuser privileges but using Linux As a debootstrap wrapper to run it without superuser privileges but using Linux