Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: vm...@packages.debian.org
Control: affects -1 + src:vmdb2

Please unblock package vmdb2

[ Reason ]

The main driver for uploading this vmdb release is bug #1031364:
Generating a system image with vmdb2 for x86, consisting of a Debian
release <= Bullseye (or other Linux systems with similar GRUB
releases), will result in a system that fails to boot due to GRUB not
understanding two of e2fsprogs' now-default options.

I am, however, uploading the upstream author's full new version, not
just a fix targetting this specific issue. This is because the issues
this release fixes are all reliability-related (three of them are in
fact GRUB-related).

The debdiff might seem a bit large, at 900 lines, but it is partly due
to upstream having included a patch we used to apply at build time.

[ Impact ]

If Bookworm ships with 0.26-2, all generated systems will ship with
filesystems that cannot be booted with the currently immediately
previous version of GRUB. This is quite major, in our opinion.

[ Tests ]

We have built several systems, targetting both ARM and x86 systems,
and they work successfully.

[ Risks ]

vmdb2 is a leaf package. The code changes are quite minor. While there
are several alternatives to vmdb2 in Debian, switching from one image
generating system to another might be quite heavy for the users.

[ Checklist ]
  [X] all changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in testing

[ Other info ]

Regardless of the outcome, thanks a lot for your work!

unblock vmdb2/0.27-1

-- 

diff -Nru vmdb2-0.26/amd64-uefi.vmdb vmdb2-0.27/amd64-uefi.vmdb
--- vmdb2-0.26/amd64-uefi.vmdb  2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/amd64-uefi.vmdb  2023-04-11 12:01:15.000000000 -0600
@@ -30,15 +30,11 @@
 
   - mount: /
 
-  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
-  # which ends up unable to create /dev/fd within the chroot, causing
-  # the qemu-debootstrap phase to fail. Until we get to the bottom
-  # that, don't enable the plugin.
-  #- virtual-filesystems: /
+  - virtual-filesystems: /
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: amd64
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/amd64.vmdb vmdb2-0.27/amd64.vmdb
--- vmdb2-0.26/amd64.vmdb       2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/amd64.vmdb       2023-04-11 12:01:15.000000000 -0600
@@ -23,7 +23,7 @@
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: amd64
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/ansible.vmdb vmdb2-0.27/ansible.vmdb
--- vmdb2-0.26/ansible.vmdb     2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/ansible.vmdb     2023-04-11 12:01:15.000000000 -0600
@@ -15,10 +15,10 @@
     tag: /
 
   - kpartx: "{{ output }}"
-    
+
   - mkfs: ext4
     partition: /
-    
+
   - mount: /
 
   - unpack-rootfs: /
diff -Nru vmdb2-0.26/arm64-uefi.vmdb vmdb2-0.27/arm64-uefi.vmdb
--- vmdb2-0.26/arm64-uefi.vmdb  2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/arm64-uefi.vmdb  2023-04-11 12:01:15.000000000 -0600
@@ -3,7 +3,7 @@
 
 steps:
   - mkimg: "{{ output }}"
-    size: 4G
+    size: 1G
 
   - mklabel: gpt
     device: "{{ output }}"
@@ -11,12 +11,12 @@
   - mkpart: primary
     device: "{{ output }}"
     start: 0%
-    end: 1G
+    end: 20M
     tag: efi
 
   - mkpart: primary
     device: "{{ output }}"
-    start: 1G
+    start: 20M
     end: 100%
     tag: /
 
@@ -30,26 +30,35 @@
 
   - mount: /
 
-  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
-  # which ends up unable to create /dev/fd within the chroot, causing
-  # the qemu-debootstrap phase to fail. Until we get to the bottom
-  # that, don't enable the plugin.
-  #- virtual-filesystems: /
-
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: bullseye
+    variant: minbase
     arch: arm64
     mirror: http://deb.debian.org/debian
     target: /
     unless: rootfs_unpacked
 
+  - chroot: /
+    shell: apt-get clean
+
   - apt: install
     packages:
+      - wget
+      - iproute2
       - linux-image-arm64
+      - systemd-sysv
     fs-tag: /
     unless: rootfs_unpacked
 
+  - copy-file: /etc/systemd/network/eth0.network
+    src: eth0.network
+    unless: rootfs_unpacked
+
+  - chroot: /
+    shell: systemctl enable systemd-networkd
+    unless: rootfs_unpacked
+
   - cache-rootfs: /
     unless: rootfs_unpacked
 
@@ -61,3 +70,6 @@
   - grub: uefi
     tag: /
     efi: efi
+    console: serial
+
+# vim: ft=yaml
diff -Nru vmdb2-0.26/armhf-uefi.vmdb vmdb2-0.27/armhf-uefi.vmdb
--- vmdb2-0.26/armhf-uefi.vmdb  2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/armhf-uefi.vmdb  2023-04-11 12:01:15.000000000 -0600
@@ -30,15 +30,11 @@
 
   - mount: /
 
-  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
-  # which ends up unable to create /dev/fd within the chroot, causing
-  # the qemu-debootstrap phase to fail. Until we get to the bottom
-  # that, don't enable the plugin.
-  #- virtual-filesystems: /
+  - virtual-filesystems: /
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: armhf
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/check-images vmdb2-0.27/check-images
--- vmdb2-0.26/check-images     2022-03-31 10:38:29.000000000 -0600
+++ vmdb2-0.27/check-images     2023-04-11 12:01:15.000000000 -0600
@@ -29,14 +29,11 @@
 src="$(dirname "$0")"
 cd "$src"
 
-# This uses debootstrap, not qemu-debootstrap. Hence, it only works on amd64
-if [ -x /usr/bin/dpkg ] && [ "$(dpkg --print-architecture)" = "amd64" ]; then
-       bash -x ./smoke.sh "$amd64_tarball"
+bash -x ./smoke.sh "$amd64_tarball"
 
-       for x in "$@" pc uefi ansible smoke-pc smoke-uefi; do
-               tryit "$tarballdir/$x.img" "$x.vmdb" "$amd64_tarball"
-       done
-fi
+for x in "$@" pc uefi ansible smoke-pc smoke-uefi; do
+       tryit "$tarballdir/$x.img" "$x.vmdb" "$amd64_tarball"
+done
 
 if [ -e /usr/share/OVMF/OVMF_VARS_4M.fd ]; then
        bash -x ./smoke-amd64.sh "$amd64_tarball"
diff -Nru vmdb2-0.26/debian/changelog vmdb2-0.27/debian/changelog
--- vmdb2-0.26/debian/changelog 2022-10-24 09:08:11.000000000 -0500
+++ vmdb2-0.27/debian/changelog 2022-10-24 09:48:46.000000000 -0500
@@ -1,3 +1,23 @@
+vmdb2 (0.27-1) unstable; urgency=medium
+
+  [ Gunnar Wolf ]
+  * New upstream release
+  * Specify ^large_dir, ^metadata_csum_seed parameters to e2fsprogs to fix
+    the creation of unbootable systems when older GRUB versions are used
+    (Closes: #1031364)
+
+  [ Debian Janitor ]
+  * Bump debhelper from old 12 to 13.
+  * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository-Browse.
+  * Update standards version to 4.6.1, no changes needed.
+  * Set upstream metadata fields: Repository.
+
+  [ Gunnar Wolf ]
+  * Drop 001_set_architecture_for_later_stages patch (no longer needed,
+    incorporated upstream)
+
+ -- Gunnar Wolf <gw...@debian.org>  Mon, 24 Oct 2022 14:48:46 -0000
+
 vmdb2 (0.26-2) unstable; urgency=medium
 
   * Fix debootstrap plugin: Set architecture for later stages (Closes:
diff -Nru vmdb2-0.26/debian/control vmdb2-0.27/debian/control
--- vmdb2-0.26/debian/control   2022-10-24 09:08:11.000000000 -0500
+++ vmdb2-0.27/debian/control   2022-10-24 09:48:46.000000000 -0500
@@ -4,11 +4,11 @@
 Section: admin
 Priority: optional
 Rules-Requires-Root: no
-Standards-Version: 4.5.1
+Standards-Version: 4.6.1
 Vcs-Browser: https://salsa.debian.org/debian/vmdb2/
 Vcs-Git: https://salsa.debian.org/debian/vmdb2.git
 Build-Depends: cmdtest,
-               debhelper-compat (= 12),
+               debhelper-compat (= 13),
                dh-python,
               lmodern,
                pandoc (>= 2.1.2~),
diff -Nru vmdb2-0.26/debian/patches/001_set_architecture_for_later_stages 
vmdb2-0.27/debian/patches/001_set_architecture_for_later_stages
--- vmdb2-0.26/debian/patches/001_set_architecture_for_later_stages     
2022-10-24 09:08:11.000000000 -0500
+++ vmdb2-0.27/debian/patches/001_set_architecture_for_later_stages     
1969-12-31 18:00:00.000000000 -0600
@@ -1,121 +0,0 @@
-Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021802
-Forwarded: not-needed
-From: Antonio Terceiro <terce...@debian.org>
-Date: Sat Oct 15 02:06:02 UTC 2022
-Subject: fix(debootstrap plugin): set architecture for later stages
- debootstrap takes an architecture argument, but does not propagate that
- to later stages of the image build. This causes, for example, the GRUB
- plugin to fail to install the correct packages when creating an images
- for a foreign archiecture.
- .
- The call to dpkg --print-architecture to discover the native
- architecture is already done when state is first populated, so there is
- no need to do it again in the grub plugin.
- .
- This patch has been accepted in the upstream Git repo (commits 28813c,
- 395bb4). It should be dropped in the next upstream release.
-
-Index: vmdb2/arm64-uefi.vmdb
-===================================================================
---- vmdb2.orig/arm64-uefi.vmdb
-+++ vmdb2/arm64-uefi.vmdb
-@@ -3,7 +3,7 @@
- 
- steps:
-   - mkimg: "{{ output }}"
--    size: 4G
-+    size: 1G
- 
-   - mklabel: gpt
-     device: "{{ output }}"
-@@ -11,12 +11,12 @@ steps:
-   - mkpart: primary
-     device: "{{ output }}"
-     start: 0%
--    end: 1G
-+    end: 20M
-     tag: efi
- 
-   - mkpart: primary
-     device: "{{ output }}"
--    start: 1G
-+    start: 20M
-     end: 100%
-     tag: /
- 
-@@ -30,26 +30,35 @@ steps:
- 
-   - mount: /
- 
--  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
--  # which ends up unable to create /dev/fd within the chroot, causing
--  # the qemu-debootstrap phase to fail. Until we get to the bottom
--  # that, don't enable the plugin.
--  #- virtual-filesystems: /
-+ - unpack-rootfs: /
- 
--  - unpack-rootfs: /
--
--  - qemu-debootstrap: buster
-+  - debootstrap: bullseye
-+    variant: minbase
-     arch: arm64
-     mirror: http://deb.debian.org/debian
-     target: /
-     unless: rootfs_unpacked
- 
-+  - chroot: /
-+    shell: apt-get clean
-+
-   - apt: install
-     packages:
-+      - wget
-+      - iproute2
-       - linux-image-arm64
-+      - systemd-sysv
-     fs-tag: /
-     unless: rootfs_unpacked
- 
-+  - copy-file: /etc/systemd/network/eth0.network
-+    src: eth0.network
-+    unless: rootfs_unpacked
-+
-+  - chroot: /
-+    shell: systemctl enable systemd-networkd
-+    unless: rootfs_unpacked
-+
-   - cache-rootfs: /
-     unless: rootfs_unpacked
- 
-@@ -61,3 +70,6 @@ steps:
-   - grub: uefi
-     tag: /
-     efi: efi
-+    console: serial
-+
-+# vim: ft=yaml
-Index: vmdb2/vmdb/plugins/debootstrap_plugin.py
-===================================================================
---- vmdb2.orig/vmdb/plugins/debootstrap_plugin.py
-+++ vmdb2/vmdb/plugins/debootstrap_plugin.py
-@@ -51,10 +51,8 @@ class DebootstrapStepRunner(vmdb.StepRun
-         install_keyring = values["install_keyring"]
-         include = values["include"]
-         require_empty = values["require_empty_target"]
--        arch = (
--            values["arch"]
--            or subprocess.check_output(["dpkg", 
"--print-architecture"]).strip()
--        )
-+        arch = values["arch"] or state.arch
-+        state.arch = arch
-         variant = values["variant"]
-         components = values["components"]
- 
-@@ -113,3 +111,7 @@ class DebootstrapStepRunner(vmdb.StepRun
-                 ]
-                 + remove_pkgs,
-             )
-+
-+    def run_even_if_skipped(self, values, settings, state):
-+        if values["arch"]:
-+            state.arch = values["arch"]
diff -Nru vmdb2-0.26/debian/patches/series vmdb2-0.27/debian/patches/series
--- vmdb2-0.26/debian/patches/series    2022-10-24 09:08:11.000000000 -0500
+++ vmdb2-0.27/debian/patches/series    1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-001_set_architecture_for_later_stages
diff -Nru vmdb2-0.26/debian/upstream/metadata 
vmdb2-0.27/debian/upstream/metadata
--- vmdb2-0.26/debian/upstream/metadata 1969-12-31 18:00:00.000000000 -0600
+++ vmdb2-0.27/debian/upstream/metadata 2022-10-24 09:48:46.000000000 -0500
@@ -0,0 +1,5 @@
+---
+Bug-Database: https://gitlab.com/larswirzenius/vmdb2/-/issues
+Bug-Submit: https://gitlab.com/larswirzenius/vmdb2/-/issues/new
+Repository: https://gitlab.com/larswirzenius/vmdb2.git
+Repository-Browse: https://gitlab.com/larswirzenius/vmdb2
diff -Nru vmdb2-0.26/i386-uefi.vmdb vmdb2-0.27/i386-uefi.vmdb
--- vmdb2-0.26/i386-uefi.vmdb   2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/i386-uefi.vmdb   2023-04-11 12:01:15.000000000 -0600
@@ -30,15 +30,11 @@
 
   - mount: /
 
-  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
-  # which ends up unable to create /dev/fd within the chroot, causing
-  # the qemu-debootstrap phase to fail. Until we get to the bottom
-  # that, don't enable the plugin.
-  #- virtual-filesystems: /
+  - virtual-filesystems: /
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: i386
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/i386.vmdb vmdb2-0.27/i386.vmdb
--- vmdb2-0.26/i386.vmdb        2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/i386.vmdb        2023-04-11 12:01:15.000000000 -0600
@@ -23,7 +23,7 @@
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: i386
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/NEWS vmdb2-0.27/NEWS
--- vmdb2-0.26/NEWS     2022-04-20 12:19:09.000000000 -0500
+++ vmdb2-0.27/NEWS     2023-04-11 12:01:15.000000000 -0600
@@ -5,6 +5,32 @@
 need them for myself, but I'm not developing new features otherwise. I
 will review and merge patches, though.
 
+Version 0.27, released 2023-04-07
+-----------------------------------------------------------------------------
+
+* When `vmdb2` creates an ext4 file system, it avoids using the
+  `large_dir` and `metadata_csum_seed` file system features, to avoid
+  incompatibility with versions of `grub2` older than what will be in
+  the Debian 12 (bookworm) release.
+
+* The kernel parameters can now be set in the spec file, for the
+  `grub` plugin. Thanks, Tim Small.
+
+* The `qemu-debootstrap` plugin has been removed. The plain
+  `debootstrap` plugin can be used instead, even for building an image
+  for a foreign architecture. Thank you to Antonio Terceiro.
+
+* The `run_even_if_skipped` feature of the plugin architecture has
+  been dropped, as nothing was using it anymore.
+
+* When running command, the `LC_ALL` environment variable is now set
+  to `C.UTF8`, because Ansible insists on the locale it is being used
+  in having UTF8 support.
+
+* When `vmdb2` modifies the `/etc/default/grub` file, it now modifies
+  values in place instead of just appending new lines to the end of
+  the file. Thanks, Tim Small.
+
 Version 0.26, released 2022-04-20
 -----------------------------------------------------------------------------
 
diff -Nru vmdb2-0.26/ppc64el.vmdb vmdb2-0.27/ppc64el.vmdb
--- vmdb2-0.26/ppc64el.vmdb     2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/ppc64el.vmdb     2023-04-11 12:01:15.000000000 -0600
@@ -27,15 +27,11 @@
 
   - mount: /
 
-  # Using the virtual-filesystems plugin here upsets qemu-debootstrap,
-  # which ends up unable to create /dev/fd within the chroot, causing
-  # the qemu-debootstrap phase to fail. Until we get to the bottom
-  # that, don't enable the plugin.
-  #- virtual-filesystems: /
+  - virtual-filesystems: /
 
   - unpack-rootfs: /
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: ppc64el
     mirror: http://deb.debian.org/debian
     target: /
diff -Nru vmdb2-0.26/README.md vmdb2-0.27/README.md
--- vmdb2-0.26/README.md        2022-03-31 10:38:29.000000000 -0600
+++ vmdb2-0.27/README.md        2023-04-11 12:01:15.000000000 -0600
@@ -62,7 +62,7 @@
 * `kpartx` [kpartx, mkpart command]
 * `parted` [`parted`, mklabel command]
 * `qemu-img` [`qemu-utils`, mkimg command]
-* `qemu-user-static` [`qemu-user-static`, qemu-debootstrap command]
+* `qemu-user-static` [`qemu-user-static`]
 * `zerofree` [`zerofree`, zerofree command]
 
 The following Python modules are used by vmdb2 (Debian package names in 
brackets).
diff -Nru vmdb2-0.26/smoke-amd64.vmdb vmdb2-0.27/smoke-amd64.vmdb
--- vmdb2-0.26/smoke-amd64.vmdb 2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-amd64.vmdb 2023-04-11 12:01:15.000000000 -0600
@@ -44,7 +44,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: amd64
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-i386.vmdb vmdb2-0.27/smoke-i386.vmdb
--- vmdb2-0.26/smoke-i386.vmdb  2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-i386.vmdb  2023-04-11 12:01:15.000000000 -0600
@@ -44,7 +44,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: i386
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-ppc64el.vmdb vmdb2-0.27/smoke-ppc64el.vmdb
--- vmdb2-0.26/smoke-ppc64el.vmdb       2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-ppc64el.vmdb       2023-04-11 12:01:15.000000000 -0600
@@ -44,7 +44,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: ppc64el
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-uefi-amd64.vmdb vmdb2-0.27/smoke-uefi-amd64.vmdb
--- vmdb2-0.26/smoke-uefi-amd64.vmdb    2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-uefi-amd64.vmdb    2023-04-11 12:01:15.000000000 -0600
@@ -47,7 +47,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: amd64
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-uefi-arm64.vmdb vmdb2-0.27/smoke-uefi-arm64.vmdb
--- vmdb2-0.26/smoke-uefi-arm64.vmdb    2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-uefi-arm64.vmdb    2023-04-11 12:01:15.000000000 -0600
@@ -47,7 +47,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: arm64
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-uefi-armhf.vmdb vmdb2-0.27/smoke-uefi-armhf.vmdb
--- vmdb2-0.26/smoke-uefi-armhf.vmdb    2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-uefi-armhf.vmdb    2023-04-11 12:01:15.000000000 -0600
@@ -47,7 +47,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: armhf
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/smoke-uefi-i386.vmdb vmdb2-0.27/smoke-uefi-i386.vmdb
--- vmdb2-0.26/smoke-uefi-i386.vmdb     2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/smoke-uefi-i386.vmdb     2023-04-11 12:01:15.000000000 -0600
@@ -47,7 +47,7 @@
 
   - unpack-rootfs: rootfs
 
-  - qemu-debootstrap: buster
+  - debootstrap: buster
     arch: i386
     mirror: http://deb.debian.org/debian
     keyring: /usr/share/keyrings/debian-archive-keyring.gpg
diff -Nru vmdb2-0.26/vmdb/app.py vmdb2-0.27/vmdb/app.py
--- vmdb2-0.26/vmdb/app.py      2022-03-31 10:38:29.000000000 -0600
+++ vmdb2-0.27/vmdb/app.py      2023-04-11 12:01:15.000000000 -0600
@@ -168,7 +168,9 @@
         spec = self.load_spec_file(self._specfile)
         state = vmdb.State()
         state.tags = vmdb.Tags()
-        state.arch = vmdb.runcmd(["dpkg", 
"--print-architecture"]).decode("UTF-8").strip()
+        state.arch = (
+            vmdb.runcmd(["dpkg", 
"--print-architecture"]).decode("UTF-8").strip()
+        )
         self.add_template_vars(state.as_dict())
         steps = spec.get_steps(self._tvars)
 
@@ -219,7 +221,6 @@
         steps_taken = []
         settings = {"rootfs-tarball": self._tarball}
 
-        even_if_skipped = method_name + "_even_if_skipped"
         for step in steps:
             try:
                 logging.info(msg, step)
@@ -227,9 +228,9 @@
                 runner = self.step_runners.find(step)
                 if runner.skip(step, settings, state):
                     logging.info("Skipping as requested by unless")
-                    method_names = [even_if_skipped]
+                    method_names = []
                 else:
-                    method_names = [method_name, even_if_skipped]
+                    method_names = [method_name]
 
                 methods = [
                     getattr(runner, name)
diff -Nru vmdb2-0.26/vmdb/plugins/ansible.mdwn 
vmdb2-0.27/vmdb/plugins/ansible.mdwn
--- vmdb2-0.26/vmdb/plugins/ansible.mdwn        2022-03-31 10:38:29.000000000 
-0600
+++ vmdb2-0.27/vmdb/plugins/ansible.mdwn        2023-04-11 12:01:15.000000000 
-0600
@@ -3,7 +3,7 @@
 
 Run Ansible using a provided playbook, to configure the image. vmdb2
 sets up Ansible so that it treats the image as the host being
-configured (via the `chroot` connecion). The image MUST have Python
+configured (via the `chroot` connection). The image MUST have Python
 installed (version 2 or 3 depending on Ansible version).
 
 Step keys:
diff -Nru vmdb2-0.26/vmdb/plugins/debootstrap_plugin.py 
vmdb2-0.27/vmdb/plugins/debootstrap_plugin.py
--- vmdb2-0.26/vmdb/plugins/debootstrap_plugin.py       2022-03-31 
10:38:29.000000000 -0600
+++ vmdb2-0.27/vmdb/plugins/debootstrap_plugin.py       2023-04-11 
12:01:15.000000000 -0600
@@ -51,10 +51,8 @@
         install_keyring = values["install_keyring"]
         include = values["include"]
         require_empty = values["require_empty_target"]
-        arch = (
-            values["arch"]
-            or subprocess.check_output(["dpkg", 
"--print-architecture"]).strip()
-        )
+        arch = values["arch"] or state.arch
+        state.arch = arch
         variant = values["variant"]
         components = values["components"]
 
diff -Nru vmdb2-0.26/vmdb/plugins/grub.mdwn vmdb2-0.27/vmdb/plugins/grub.mdwn
--- vmdb2-0.26/vmdb/plugins/grub.mdwn   2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/vmdb/plugins/grub.mdwn   2023-04-11 12:01:15.000000000 -0600
@@ -34,6 +34,10 @@
 * `timeout` &mdash; OPTIONAL; set the grub menu timeout, in seconds.
   Defaults to 0 seconds.
 
+* `kernel-params` &mdash; OPTIONAL; list of parameters which grub will
+  pass to the Linux kernel.  Default is:
+  `["biosdevname=0", "net.ifnames=0", "consoleblank=0", "rw"]`
+
 Example (in the .vmdb file):
 
     - grub: bios
diff -Nru vmdb2-0.26/vmdb/plugins/grub_plugin.py 
vmdb2-0.27/vmdb/plugins/grub_plugin.py
--- vmdb2-0.26/vmdb/plugins/grub_plugin.py      2022-03-31 10:38:29.000000000 
-0600
+++ vmdb2-0.27/vmdb/plugins/grub_plugin.py      2023-04-11 12:01:15.000000000 
-0600
@@ -93,6 +93,7 @@
             "tag": "",
             "image-dev": "",
             "quiet": False,
+            "kernel-params": ["biosdevname=0", "net.ifnames=0", 
"consoleblank=0", "rw"],
             "timeout": 0,
         }
 
@@ -183,12 +184,8 @@
             image_dev = prep_dev
         self.install_package(chroot, grub_package)
 
-        kernel_params = [
-            "biosdevname=0",
-            "net.ifnames=0",
-            "consoleblank=0",
-            "rw",
-        ]
+        kernel_params = values["kernel-params"]
+
         if console == "serial":
             if 'ppc64' in state.arch:
                 kernel_params.extend(
@@ -363,37 +360,38 @@
 
     def set_grub_cmdline_config(self, chroot, kernel_params):
         param_string = " ".join(kernel_params)
+        self.set_grub_default(chroot, "GRUB_CMDLINE_LINUX_DEFAULT", '"' + 
param_string + '"')
 
+    def set_grub_default(self, chroot, param, value):
         filename = self.chroot_path(chroot, "/etc/default/grub")
+        newdefault = param + "=" + str(value) + "\n"
 
-        with open(filename) as f:
-            text = f.read()
-
-        lines = text.splitlines()
-        lines = [
-            line for line in lines if not 
line.startswith("GRUB_CMDLINE_LINUX_DEFAULT")
-        ]
-        lines.append('GRUB_CMDLINE_LINUX_DEFAULT="{}"'.format(param_string))
-
-        with open(filename, "w") as f:
-            f.write("\n".join(lines) + "\n")
+        found_param = False
+        newcontents = ""
+        with open(filename, "r+") as f:
+            for line in f:
+                if line.startswith(param + "=") and not found_param:
+                    newcontents += newdefault
+                    found_param = True
+                elif line.startswith("#" + param + "=") and not found_param:
+                    newcontents += line
+                    newcontents += newdefault
+                    found_param = True
+                else:
+                    newcontents += line
+            if found_param:
+                f.seek(0)
+                f.write(newcontents)
+            else:
+                f.write(newdefault)
 
     def add_grub_serial_console(self, chroot):
-        filename = self.chroot_path(chroot, "/etc/default/grub")
-
-        with open(filename, "a") as f:
-            f.write("GRUB_TERMINAL=serial\n")
-            f.write(
-                'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 '
-                '--word=8 --parity=no --stop=1"\n'
-            )
+        self.set_grub_default(chroot, "GRUB_TERMINAL", "serial")
+        self.set_grub_default(chroot, "GRUB_SERIAL_COMMAND", '"serial '
+            '--speed=115200 --unit=0 --word=8 --parity=no --stop=1"')
 
     def add_grub_crypto_disk(self, chroot):
-        filename = self.chroot_path(chroot, "/etc/default/grub")
-        with open(filename, "a") as f:
-            f.write("GRUB_ENABLE_CRYPTODISK=y\n")
+        self.set_grub_default(chroot, "GRUB_ENABLE_CRYPTODISK", "y")
 
     def set_grub_timeout(self, chroot, timeout):
-        filename = self.chroot_path(chroot, "/etc/default/grub")
-        with open(filename, "a") as f:
-            f.write("GRUB_TIMEOUT={}\n".format(timeout))
+        self.set_grub_default(chroot, "GRUB_TIMEOUT", timeout)
diff -Nru vmdb2-0.26/vmdb/plugins/mkfs_plugin.py 
vmdb2-0.27/vmdb/plugins/mkfs_plugin.py
--- vmdb2-0.26/vmdb/plugins/mkfs_plugin.py      2022-03-31 10:38:29.000000000 
-0600
+++ vmdb2-0.27/vmdb/plugins/mkfs_plugin.py      2023-04-11 12:01:15.000000000 
-0600
@@ -51,6 +51,17 @@
                 cmd.append("-L")
             cmd.append(label)
 
+        # Ext4 filesystem features large_dir and metadata_csum_seed
+        # are known to make versions of GRUB older than 2.06-8 unable
+        # to boot. Keep this around at least until it is no longer
+        # likely enough(?) users will try to build older target
+        # systems.
+        if fstype == "ext4":
+            cmd.append("-O")
+            cmd.append("^large_dir")
+            cmd.append("-O")
+            cmd.append("^metadata_csum_seed")
+
         options = values["options"] or None
         if options:
             for opt in options.split(" "):
diff -Nru vmdb2-0.26/vmdb/plugins/qemudebootstrap.mdwn 
vmdb2-0.27/vmdb/plugins/qemudebootstrap.mdwn
--- vmdb2-0.26/vmdb/plugins/qemudebootstrap.mdwn        2021-08-26 
11:25:28.000000000 -0500
+++ vmdb2-0.27/vmdb/plugins/qemudebootstrap.mdwn        1969-12-31 
18:00:00.000000000 -0600
@@ -1,38 +0,0 @@
-Step: qemu-debootstrap
------------------------------------------------------------------------------
-
-This command has been merged into `debootstrap`.
-If your builds run on Debian 10 or later,
-it is recommended to use `debootstrap` instead of `qemu-debootstrap`.
-
-Install packages using apt, which needs to already have been
-installed, for a different architecture than the host where vmdb2 is
-being run. For example, for building an image for a Raspberry Pi on an
-Intel PC.
-
-Step keys:
-
-* `qemu-debootstrap` &mdash; REQUIRED; value is the codename of the Debian
-  release to install: `stretch`, `buster`, etc.
-
-* `target` &mdash; REQUIRED; value is the tag for the root filesystem.
-
-* `mirror` &mdash; OPTIONAL; which Debian mirror to use.
-
-* `keyring` &mdash; OPTIONAL; which gpg keyring to use to verify the
-  packages. This is useful when using a non-official Debian repository
-  (e.g. Raspbian) as by default qemu-debootstrap will use the keys
-  provided by the "debian-archive-keyring" package.
-
-* `arch` &mdash; REQUIRED; the foreign architecture to use.
-
-* `variant` &mdash; OPTIONAL; the variant for debootstrap.
-
-Example (in the .vmdb file):
-
-    - qemu-debootstrap: buster
-      target: root
-      mirror: http://mirror.example.com/debian
-      keyring: /etc/apt/trusted.gpg
-      arch: arm64
-      variant: buildd
diff -Nru vmdb2-0.26/vmdb/plugins/qemudebootstrap_plugin.py 
vmdb2-0.27/vmdb/plugins/qemudebootstrap_plugin.py
--- vmdb2-0.26/vmdb/plugins/qemudebootstrap_plugin.py   2021-08-26 
11:25:28.000000000 -0500
+++ vmdb2-0.27/vmdb/plugins/qemudebootstrap_plugin.py   1969-12-31 
18:00:00.000000000 -0600
@@ -1,92 +0,0 @@
-# Copyright 2017  Lars Wirzenius and Stuart Prescott
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-# =*= License: GPL-3+ =*=
-
-
-import vmdb
-
-
-class QemuDebootstrapPlugin(vmdb.Plugin):
-    def enable(self):
-        self.app.step_runners.add(QemuDebootstrapStepRunner())
-
-
-class QemuDebootstrapStepRunner(vmdb.StepRunnerInterface):
-    def get_key_spec(self):
-        return {
-            "qemu-debootstrap": str,
-            "target": str,
-            "mirror": str,
-            "arch": str,
-            "keyring": "",
-            "variant": "-",
-            "components": ["main"],
-        }
-
-    def run(self, values, settings, state):
-        suite = values["qemu-debootstrap"]
-        tag = values["target"]
-        target = state.tags.get_builder_mount_point(tag)
-        mirror = values["mirror"]
-        keyring = values["keyring"] or None
-        variant = values["variant"]
-        arch = values["arch"]
-        components = values["components"]
-        if not (suite and tag and target and mirror and arch):
-            raise Exception("missing arg for qemu-debootstrap step")
-        # Update the state with the target architecture declared here
-        # in order that later stages can find it and behave
-        # appropriately.
-        state.arch = arch
-        if keyring:
-            vmdb.runcmd(
-                [
-                    "qemu-debootstrap",
-                    "--keyring",
-                    keyring,
-                    "--arch",
-                    arch,
-                    "--variant",
-                    variant,
-                    "--components",
-                    ",".join(components),
-                    suite,
-                    target,
-                    mirror,
-                ]
-            )
-        else:
-            vmdb.runcmd(
-                [
-                    "qemu-debootstrap",
-                    "--arch",
-                    arch,
-                    "--variant",
-                    variant,
-                    "--components",
-                    ",".join(components),
-                    suite,
-                    target,
-                    mirror,
-                ]
-            )
-        vmdb.runcmd_chroot(target, ["apt-get", "update"])
-
-    def run_even_if_skipped(self, values, settings, state):
-        tag = values["target"]
-        target = state.tags.get_builder_mount_point(tag)
-        state.arch = values["arch"]
-        vmdb.runcmd_chroot(target, ["apt-get", "update"])
diff -Nru vmdb2-0.26/vmdb/runcmd.py vmdb2-0.27/vmdb/runcmd.py
--- vmdb2-0.26/vmdb/runcmd.py   2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/vmdb/runcmd.py   2023-04-11 12:01:15.000000000 -0600
@@ -46,10 +46,12 @@
 def runcmd(argv, **kwargs):
     progress("Exec: %r" % (argv,))
     env = kwargs.get("env", os.environ.copy())
-    env["LC_ALL"] = "C"
+    env["LC_ALL"] = "C.UTF8"
     kwargs["env"] = env
     kwargs["stdout"] = kwargs.get("stdout", subprocess.PIPE)
     kwargs["stderr"] = kwargs.get("stderr", subprocess.PIPE)
+    for name in env:
+        logging.debug(f"ENV: {name}={env[name]}")
     p = subprocess.Popen(argv, **kwargs)
     out, err = p.communicate()
     logging.debug("STDOUT: %s", out.decode("UTF8"))
diff -Nru vmdb2-0.26/vmdb/step_list.py vmdb2-0.27/vmdb/step_list.py
--- vmdb2-0.26/vmdb/step_list.py        2021-08-26 11:25:28.000000000 -0500
+++ vmdb2-0.27/vmdb/step_list.py        2023-04-11 12:01:15.000000000 -0600
@@ -50,9 +50,6 @@
     def run(self, step_spec, settings, state):
         raise NotImplementedError()
 
-    def run_even_if_skipped(self, step_spec, settings, state):
-        pass
-
     def teardown(self, step_spec, settings, state):
         # Default implementation does nop, so that sub-classes don't
         # need to have a nop teardown.
diff -Nru vmdb2-0.26/vmdb/version.py vmdb2-0.27/vmdb/version.py
--- vmdb2-0.26/vmdb/version.py  2022-04-20 12:19:09.000000000 -0500
+++ vmdb2-0.27/vmdb/version.py  2023-04-11 12:01:15.000000000 -0600
@@ -1,2 +1,2 @@
-__version__ = "0.26"
-__version_info__ = (0, 26)
+__version__ = "0.27"
+__version_info__ = (0, 27)

Attachment: signature.asc
Description: PGP signature

Reply via email to