Package: debos
Version: 1.1.1-2
Severity: important

Dear Maintainer,

Using debos to build a recipe that uses bookworm or newer suite
gives a mysterious apt error that suggest running apt --fix-broken
install.

This is a symptom of the workaround that was applied for
https://github.com/go-debos/debos/issues/361
"New debootstrap is unable to bootstrap pre-bookworm debian derivatives"

This is the workaround:
https://github.com/go-debos/debos/commit/b3c1f76bcc1dbd55fef584b8ddbda33f12733116

The workaround instead unconditionally breaks >= bookworm recipes.

I personally don't feel like bookworm debos not being able to build
bookworm recipes is a state that is suitable for a debian stable
release (so IMHO severity >= serious).

I feel like such a crude workaround should atleast be attempted to
be limited in some way. I'm attaching a patch that should work for
the forseeable future of Debian releases (and hopefully in a couple
of releases all pre-bookworm releases are not interesting to support
anymore and the workaround can simply be dropped).

(Note: this does not include ubuntu release names which has usrmerge >=27,
nor any other derivate distribution that is "bookworm-based". So this is
definitely not a complete fix.)

======================================================================

With a patched debos build running against the example rpi64 recipe at
https://github.com/go-debos/debos-recipes/blob/main/rpi64/debimage-rpi64.yaml
using `debos -v -t suite:bookworm debimage-rpi64.yaml` it no longer fails
on the first apt action, however it later seems to get stuck at running
update-initramfs (using 330% cpu and then fakemachine gets killed after
~10 minutes). This is however likely a completely separete issue, but
ideas how to investigate it welcome anyway.

```
[...]
2023/01/03 01:19:05 ==== Install kernel and firmware packages for RPi ====
Hit:1 http://deb.debian.org/debian bookworm InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2023/01/03 01:19:17 apt | The following additional packages will be installed:
2023/01/03 01:19:17 apt |   cpio initramfs-tools initramfs-tools-core 
klibc-utils libklibc
2023/01/03 01:19:17 apt |   linux-image-6.0.0-6-arm64
2023/01/03 01:19:17 apt | Suggested packages:
2023/01/03 01:19:17 apt |   libarchive-dev bash-completion linux-doc-6.0 
debian-kernel-handbook
2023/01/03 01:19:17 apt | Recommended packages:
2023/01/03 01:19:17 apt |   busybox | busybox-static zstd firmware-linux-free 
apparmor
2023/01/03 01:19:17 apt | The following NEW packages will be installed:
2023/01/03 01:19:17 apt |   cpio firmware-brcm80211 initramfs-tools 
initramfs-tools-core klibc-utils
2023/01/03 01:19:17 apt |   libklibc linux-image-6.0.0-6-arm64 
linux-image-arm64 rpi.gpio-common
2023/01/03 01:19:17 apt | 0 upgraded, 9 newly installed, 0 to remove and 0 not 
upgraded.
2023/01/03 01:19:17 apt | Need to get 71.1 MB of archives.
2023/01/03 01:19:17 apt | After this operation, 504 MB of additional disk space 
will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 cpio arm64 2.13+dfsg-7.1 
[240 kB]
Get:2 http://deb.debian.org/debian bookworm/non-free arm64 firmware-brcm80211 
all 20221214-3 [5349 kB]
Get:3 http://deb.debian.org/debian bookworm/main arm64 libklibc arm64 2.0.11-1 
[59.7 kB]
Get:4 http://deb.debian.org/debian bookworm/main arm64 klibc-utils arm64 
2.0.11-1 [101 kB]
Get:5 http://deb.debian.org/debian bookworm/main arm64 initramfs-tools-core all 
0.142 [105 kB]
Get:6 http://deb.debian.org/debian bookworm/main arm64 initramfs-tools all 
0.142 [72.9 kB]
Get:7 http://deb.debian.org/debian bookworm/main arm64 
linux-image-6.0.0-6-arm64 arm64 6.0.12-1 [65.2 MB]
Get:8 http://deb.debian.org/debian bookworm/main arm64 linux-image-arm64 arm64 
6.0.12-1 [1444 B]
Get:9 http://deb.debian.org/debian bookworm/main arm64 rpi.gpio-common arm64 
0.7.1~a4-1+b3 [6752 B]
Fetched 71.1 MB in 8s (9351 kB/s)                                              
2023/01/03 01:19:26 apt | debconf: delaying package configuration, since 
apt-utils is not installed
2023/01/03 01:19:26 apt | Selecting previously unselected package cpio.
(Reading database ... 11548 files and directories currently installed.)
2023/01/03 01:19:26 apt | Preparing to unpack 
.../0-cpio_2.13+dfsg-7.1_arm64.deb ...
2023/01/03 01:19:26 apt | Unpacking cpio (2.13+dfsg-7.1) ...
2023/01/03 01:19:27 apt | Selecting previously unselected package 
firmware-brcm80211.
2023/01/03 01:19:27 apt | Preparing to unpack 
.../1-firmware-brcm80211_20221214-3_all.deb ...
2023/01/03 01:19:27 apt | Unpacking firmware-brcm80211 (20221214-3) ...
2023/01/03 01:19:29 apt | Selecting previously unselected package 
libklibc:arm64.
2023/01/03 01:19:29 apt | Preparing to unpack .../2-libklibc_2.0.11-1_arm64.deb 
...
2023/01/03 01:19:29 apt | Unpacking libklibc:arm64 (2.0.11-1) ...
2023/01/03 01:19:30 apt | Selecting previously unselected package klibc-utils.
2023/01/03 01:19:30 apt | Preparing to unpack 
.../3-klibc-utils_2.0.11-1_arm64.deb ...
2023/01/03 01:19:30 apt | Unpacking klibc-utils (2.0.11-1) ...
2023/01/03 01:19:30 apt | Selecting previously unselected package 
initramfs-tools-core.
2023/01/03 01:19:30 apt | Preparing to unpack 
.../4-initramfs-tools-core_0.142_all.deb ...
2023/01/03 01:19:30 apt | Unpacking initramfs-tools-core (0.142) ...
2023/01/03 01:19:30 apt | Selecting previously unselected package 
initramfs-tools.
2023/01/03 01:19:30 apt | Preparing to unpack 
.../5-initramfs-tools_0.142_all.deb ...
2023/01/03 01:19:31 apt | Unpacking initramfs-tools (0.142) ...
2023/01/03 01:19:31 apt | Selecting previously unselected package 
linux-image-6.0.0-6-arm64.
2023/01/03 01:19:31 apt | Preparing to unpack 
.../6-linux-image-6.0.0-6-arm64_6.0.12-1_arm64.deb ...
2023/01/03 01:19:31 apt | Unpacking linux-image-6.0.0-6-arm64 (6.0.12-1) ...
2023/01/03 01:19:49 apt | Selecting previously unselected package 
linux-image-arm64.
2023/01/03 01:19:49 apt | Preparing to unpack 
.../7-linux-image-arm64_6.0.12-1_arm64.deb ...
2023/01/03 01:19:49 apt | Unpacking linux-image-arm64 (6.0.12-1) ...
2023/01/03 01:19:50 apt | Selecting previously unselected package 
rpi.gpio-common:arm64.
2023/01/03 01:19:50 apt | Preparing to unpack 
.../8-rpi.gpio-common_0.7.1~a4-1+b3_arm64.deb ...
2023/01/03 01:19:50 apt | Unpacking rpi.gpio-common:arm64 (0.7.1~a4-1+b3) ...
2023/01/03 01:19:50 apt | Setting up cpio (2.13+dfsg-7.1) ...
2023/01/03 01:19:50 apt | update-alternatives: using /bin/mt-gnu to provide 
/bin/mt (mt) in auto mode
2023/01/03 01:19:50 apt | Setting up rpi.gpio-common:arm64 (0.7.1~a4-1+b3) ...
2023/01/03 01:19:50 apt | Setting up libklibc:arm64 (2.0.11-1) ...
2023/01/03 01:19:50 apt | Setting up firmware-brcm80211 (20221214-3) ...
2023/01/03 01:19:50 apt | Setting up klibc-utils (2.0.11-1) ...
2023/01/03 01:19:50 apt | No diversion 'diversion of 
/usr/share/initramfs-tools/hooks/klibc to 
/usr/share/initramfs-tools/hooks/klibc^i-t by klibc-utils', none removed.
2023/01/03 01:19:50 apt | Setting up initramfs-tools-core (0.142) ...
2023/01/03 01:19:51 apt | Setting up initramfs-tools (0.142) ...
2023/01/03 01:19:51 apt | update-initramfs: deferring update (trigger activated)
2023/01/03 01:19:51 apt | Setting up linux-image-6.0.0-6-arm64 (6.0.12-1) ...
2023/01/03 01:19:55 apt | I: /vmlinuz.old is now a symlink to 
boot/vmlinuz-6.0.0-6-arm64
2023/01/03 01:19:55 apt | I: /initrd.img.old is now a symlink to 
boot/initrd.img-6.0.0-6-arm64
2023/01/03 01:19:55 apt | I: /vmlinuz is now a symlink to 
boot/vmlinuz-6.0.0-6-arm64
2023/01/03 01:19:55 apt | I: /initrd.img is now a symlink to 
boot/initrd.img-6.0.0-6-arm64
2023/01/03 01:19:56 apt | /etc/kernel/postinst.d/initramfs-tools:
2023/01/03 01:19:56 apt | update-initramfs: Generating 
/boot/initrd.img-6.0.0-6-arm64
2023/01/03 01:19:56 apt | W: No zstd in /usr/bin:/sbin:/bin, using gzip
2023/01/03 01:30:32 apt | Container root terminated by signal KILL.
Powering off.
open /tmp/fakemachine-194296958/result: no such file or directory
```


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (1000, 'testing'), (400, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 6.0.0-6-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debos depends on:
ii  busybox-static [busybox]  1:1.35.0-4+b1
ii  debootstrap               1.0.128+nmu2
ii  libc6                     2.36-7
ii  libglib2.0-0              2.74.4-1
ii  libostree-1-1             2022.7-2
ii  qemu-system-x86           1:7.2+dfsg-1+b2
ii  qemu-user-static          1:7.2+dfsg-1+b2
ii  systemd-container         252.4-1

Versions of packages debos recommends:
ii  bmap-tools         3.6-1
ii  bzip2              1.0.8-5+b1
ii  e2fsprogs          1.46.6~rc1-1+b1
ii  linux-image-amd64  6.0.12-1
ii  mount              2.38.1-4
ii  ovmf               2022.11-2
ii  parted             3.5-3
ii  systemd-resolved   252.4-1
ii  udev               252.4-1
ii  xz-utils           5.4.0-0.1
ii  zip                3.0-12

Versions of packages debos suggests:
pn  libslirp-helper  <none>
pn  user-mode-linux  <none>

-- no debconf information
From: Andreas Henriksson <andr...@fatal.se>
Date: Tue, 3 Jan 2023 01:12:42 +0100
Subject: Limit old suite workaround

The workaround for https://github.com/go-debos/debos/issues/361
that was applied in https://github.com/go-debos/debos/commit/b3c1f76bcc1dbd55fef584b8ddbda33f12733116
breaks recipes for bookworm and newer.
---
 actions/debootstrap_action.go | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/actions/debootstrap_action.go b/actions/debootstrap_action.go
index e354ff4..440053f 100644
--- a/actions/debootstrap_action.go
+++ b/actions/debootstrap_action.go
@@ -158,6 +158,26 @@ func (d *DebootstrapAction) RunSecondStage(context debos.DebosContext) error {
 	return err
 }
 
+func (d *DebootstrapAction) isLikelyOldSuite() bool {
+	// Guess if suite is something before usr-is-merged was introduced
+	switch strings.ToLower(d.Suite) {
+	// these are known to have usr-is-merged.
+	case "sid", "unstable":
+		return false;
+	case "testing":
+		return false;
+	case "bookworm":
+		return false;
+	case "trixie":
+		return false;
+	case "forky":
+		return false;
+	// we can't list all derivate distributions suites, so use default.
+	default:
+		return true;
+	}
+}
+
 func (d *DebootstrapAction) Run(context *debos.DebosContext) error {
 	d.LogStart()
 	cmdline := []string{"debootstrap"}
@@ -204,7 +224,11 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error {
 		cmdline = append(cmdline, fmt.Sprintf("--variant=%s", d.Variant))
 	}
 
-	cmdline = append(cmdline, "--exclude=usr-is-merged")
+	// workaround for https://github.com/go-debos/debos/issues/361
+	if d.isLikelyOldSuite() {
+		cmdline = append(cmdline, "--exclude=usr-is-merged")
+	}
+
 	cmdline = append(cmdline, d.Suite)
 	cmdline = append(cmdline, context.Rootdir)
 	cmdline = append(cmdline, d.Mirror)

Reply via email to