Package: vmdebootstrap Version: 1.4-1 Severity: important Tags: patch -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
When --boottype argument (along with --bootsize) is specified, we expect to see a proper /etc/fstab entry in the built image with specified filesystem. This is currently being set as 'None'. This is a regression due to simple missing intake of parameter in the filesystem handler. The attached patch fixes the issue. In addition, there is also a patch for requiring --bootsize when --boottype is passed. - -- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386, armhf Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages vmdebootstrap depends on: ii debootstrap 1.0.78+nmu1 ii extlinux 3:6.03+dfsg-11 ii kpartx 0.5.0+git1.656f8865-4 ii libjs-sphinxdoc 1.3.5-1 ii mbr 1.1.11-5+b1 ii parted 3.2-15 ii python-cliapp 1.20160109-1 ii python-distro-info 0.14 ii python2.7 2.7.11-3 pn python:any <none> ii qemu-utils 1:2.5+dfsg-5 Versions of packages vmdebootstrap recommends: ii grub2-common 2.02~beta2-36 ii python-guestfs 1:1.32.2-3 ii qemu-system 1:2.5+dfsg-5 ii qemu-user-static 1:2.5+dfsg-5 ii squashfs-tools 1:4.3-3 Versions of packages vmdebootstrap suggests: ii cmdtest 0.22-1 ii pandoc 1.15.1.1~dfsg-2+b3 pn u-boot:armhf <none> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWyGUWAAoJEDbDYUQMm8lxh/IQAJf2ETzcxvaIWcm2/0ifKnUz sa9yKPvHg1bTdnbC7i0dT/GEI1MCLhUu4XHbX8DCvOAktuZA2LGA478GrAuCWoaF pjQebB1NHwIL0M8Sm6/LKjNgSRFSgbW4spI7FwFM71A2cSpl/UuqZX2T6jkLgscW 8CnQsjPMB8XmYXVi0qOyCk3EvN4nuTh4XsvCjnwwPqJEQIyLR3Ny4vj0Ly50ThaK 3Ih5Z2487/8nwuGNpjslaycRHcdQIXj9FsvdEJwZZIIiO3YW9/IOaGKrXteZ/VHl 645c0T/fG/fjW/EtwS/FSmMB+TkvujsdlumuExz4GhKMfKzdbSxhzF7qN+OD/eRD A2Bp4D6bnxvz/OXZ2SKMn9XvKubcHoPyHQHSOLKNWT69fOt0fuOVk06LLQVHu7pj q7bfTStrZLBOLg3KuauptnsaZl2NxpinroU4jCc3RVe4z6x3aiMAjYFq/muZD/mV mrAflf5ihq3nm2aEjA5I5FvtpRcZtFoujirVVaVMGtUAetAZK/rox6WSooDwOcna j14M9iqfCfkScyZo6712NdrtlbLij2Zrgu0eNkiK4eA8iIAn0rAsWh5K0eTZFdP/ YDF9r4f0jY+hRISiv7Yo3pd4FIIFAx8bMshWgBu2KogI+TsDbvZ/P2J4KuKzEQEk 9deyZlu1ShBn8CfYIhxb =No53 -----END PGP SIGNATURE-----
>From a8acb8d9a953f72c4494ac06add042685fc43a14 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa <su...@medhas.org> Date: Sat, 20 Feb 2016 18:04:36 +0530 Subject: [PATCH 1/3] Don't allow --boottype without --bootsize Otherwise, user may pass just the --boottype and expect a boot partition to be created and that does not happen. --- bin/vmdebootstrap | 3 +++ yarns/200-fast-tests.yarn | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap index 2971260..3016945 100755 --- a/bin/vmdebootstrap +++ b/bin/vmdebootstrap @@ -178,6 +178,9 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth self.settings['extlinux'] and not self.settings['grub']: raise cliapp.AppException( 'extlinux is not yet supported on btrfs. Use grub.') + if self.settings['boottype'] and not self.settings['bootsize']: + raise cliapp.AppException( + '--boottype requires --bootsize as well.') uefi = self.handlers[Uefi.name] oldstable = distro.was_oldstable(datetime.date(2015, 4, 26)) uefi.check_settings(oldstable=oldstable) diff --git a/yarns/200-fast-tests.yarn b/yarns/200-fast-tests.yarn index 352c8ec..17303b5 100644 --- a/yarns/200-fast-tests.yarn +++ b/yarns/200-fast-tests.yarn @@ -188,3 +188,11 @@ verify that vmdebootstrap parses the command line correctly. ... --image=FOO --roottype btrfs --dry-run THEN vmdebootstrap exited with a non-zero exit code AND vmdebootstrap wrote an error message matching not yet supported + + SCENARIO --boottype used without --bootsize + ASSUMING fast tests are requested + WHEN user attempts to run vmdebootstrap + ... --image=FOO --boottype ext4 --dry-run + THEN vmdebootstrap exited with a non-zero exit code + AND vmdebootstrap wrote an error message matching --boottype + AND vmdebootstrap wrote an error message matching --bootsize -- 2.7.0
>From bfa8760a68b8f75f9a3d25c10f90178c45f0ba95 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa <su...@medhas.org> Date: Sat, 20 Feb 2016 18:06:13 +0530 Subject: [PATCH 2/3] Fix issue with fstab entry for boot partition - When bootsize and boottype are passed, the fstab entry for boot partition is getting written with fstype as 'None' leading to boot failures. Fix this. - Also don't fail boot flag check if partition flag information comes out from parted as 'boot, lba' instead of 'boot' --- vmdebootstrap/filesystem.py | 1 + yarns/300-slow-build-tests.yarn | 13 +++++++++++++ yarns/900-implements.yarn | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/vmdebootstrap/filesystem.py b/vmdebootstrap/filesystem.py index 0898de9..77f02df 100644 --- a/vmdebootstrap/filesystem.py +++ b/vmdebootstrap/filesystem.py @@ -53,6 +53,7 @@ class Filesystem(Base): def define_settings(self, settings): self.settings = settings self.devices['roottype'] = self.settings['roottype'] + self.devices['boottype'] = self.settings['boottype'] def chown(self): if not self.settings['owner']: diff --git a/yarns/300-slow-build-tests.yarn b/yarns/300-slow-build-tests.yarn index a76a27c..d125993 100644 --- a/yarns/300-slow-build-tests.yarn +++ b/yarns/300-slow-build-tests.yarn @@ -48,3 +48,16 @@ These tests are slow, since building images is slow. AND partition 1 has the boot flag set AND partition 1 has an btrfs filesystem AND partition 1 has file /etc/fstab matching ^\S+\s+\/\s+btrfs\s+defaults\s+\d\s+\d$ + + SCENARIO build a Debian 8 image with separate boot partition + ASSUMING build tests are requested + GIVEN user wants to build an image FOO.img that is 2GiB in size + WHEN the user runs vmdebootstrap --bootsize=128M --boottype=ext3 --grub + THEN the image has the correct size + AND the partition count of the image is 2 + AND partition 1 has the boot flag set + AND partition 1 has an ext3 filesystem + AND partition 2 has an ext4 filesystem + AND partition 2 has file /etc/fstab matching ^\S+\s+\/\s+ext4\s+errors=remount-ro\s+\d\s+\d$ + AND partition 2 has file /etc/fstab matching ^\S+\s+\/boot\s+ext3\s+errors=remount-ro\s+\d\s+\d$ + diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 657101e..57889ab 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -109,7 +109,7 @@ Check partition boot flag. IMPLEMENTS THEN partition (\d+) has the boot flag set parted --script "$IMAGE" print | - awk -v "PART=$MATCH_1" '/^ [0-9]+ / && $1 == PART && $7 == "boot"' | + awk -v "PART=$MATCH_1" '/^ [0-9]+ / && $1 == PART && $7 ~ "^boot,?$"' | grep . Check filesystem on a partition. This checks the actual filesystem, -- 2.7.0