Autopkgtest (bullseye): Kernel install (or upgrade) fails during testbed setup, caused by debusine-specific script
Installing (or upgrading) `linux-image-amd64` in the bullseye autopkgtest environment is broken.
This can be seen in multiple places, eg.
- https://debusine.debian.net/debian/developers/artifact/4117668/
- https://debusine.debian.net/debian/developers/artifact/4117623/
- https://debusine.debian.net/debian/developers/artifact/4117726/
- etc etc etc
This is in **bullseye autopkgtests**, and the failure happens during **testbed setup**.
Error is:
```
The following NEW packages will be installed:
linux-image-5.10.0-45-amd64
The following packages will be upgraded:
[...] linux-image-amd64 [...]
Setting up linux-image-5.10.0-45-amd64 (5.10.259-1) ...
I: /vmlinuz is now a symlink to boot/vmlinuz-5.10.0-45-amd64
I: /initrd.img is now a symlink to boot/initrd.img-5.10.0-45-amd64
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.10.0-45-amd64
/etc/kernel/postinst.d/zz-update-systemd-boot:
install: cannot create regular file '/boot/efi/e2dba902bee54ad8b2731e70de6674fc/5.10.0-45-amd64/initrd': No such file or directory
Could not copy '/boot/initrd.img-5.10.0-45-amd64' to '/boot/efi/e2dba902bee54ad8b2731e70de6674fc/5.10.0-45-amd64/initrd'.
run-parts: /etc/kernel/postinst.d/zz-update-systemd-boot exited with return code 1
dpkg: error processing package linux-image-5.10.0-45-amd64 (--configure):
installed linux-image-5.10.0-45-amd64 package post-installation script subprocess returned error exit status 1
```
The script `/etc/kernel/postinst.d/zz-update-systemd-boot` seems to come from... debusine itself. It was introduced back in Feb 2024, cf.
- https://salsa.debian.org/freexian-team/debusine/-/work_items/222
- https://salsa.debian.org/freexian-team/debusine/-/merge_requests/598
All it does is calling `kernel-install add`. I quickly tested in a bullseye container, and I can reproduce the failure:
```
## In a local bullseye docker container
# apt install -y systemd linux-image-amd64
[...]
# /usr/bin/kernel-install add 5.10.0-45-amd64 /boot/vmlinuz-5.10.0-45-amd64
install: cannot create regular file '/boot/1b43db0fdbfc533ec73a1bcb6a4da759/5.10.0-45-amd64/initrd': No such file or directory
Could not copy '/boot/initrd.img-5.10.0-45-amd64' to '/boot/1b43db0fdbfc533ec73a1bcb6a4da759/5.10.0-45-amd64/initrd'.
```
Tested the same in a bookworm container, and it succeeds. It seems that it was fixed via this commit: https://salsa.debian.org/systemd-team/systemd/-/commit/f1c9fdd98a102b5053c765f4ee41782e7df963de. Note that this is a Debian-specific script.
Anyway, I noticed this discussion: https://salsa.debian.org/freexian-team/debusine/-/merge_requests/598#note_465928. I suppose it can be fixed (for bullseye) by adding `bootctl is-installed 2>/dev/null || exit 0` to the script.
I can also test buster and open a MR that would work for both if you want.
issue