Closed CarlFK closed 8 months ago
https://wiki.debian.org/DpkgTriggers might be useful....
update-initramfs: Triggers are supported from version 0.92 on.
Setting up cryptsetup-initramfs (2:2.3.7-1+deb11u1) ...
update-initramfs: deferring update (trigger activated) <------ ?????
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for initramfs-tools (0.140) ...
from #raspberrypi irc waveform:
/usr/bin/linux-version list (nothing)
okay, I think (just double checking with the code as linux-version's just perl) it's because raspios has a rather weird kernel setup (at least from a debian perspective)... linux-version's expecting to find /boot/vmlinuz-KVER files but on raspios the raspberrypi-kernel package installs several kernel images named /boot/kernel[678].img (which aren't different kernel versions but variants for different pi boards) so on raspios, the only way to run update-initramfs is to explicitly specify a kernel version which also means the dpkg-trigger for update-initramfs isn't going to operate correctly there
in other words, your workaround is the "correct" way of doing this on raspios currently
raspios could patch update-initramfs (or more precisely the initramfs-tools package) to work correctly; they already patch quite a lot of stuff from debian (though not initramfs-tools currently)
it potentially breaks people's initrds on kernel upgrades that would make it a valid bug (at least in my eyes; the counter-argument would be that raspios doesn't use an initrd by default, and the only circumstance in which it does, with overlayroot, the rootfs is read-only anyway so kernels won't be updated) still, it's a worthwhile case to make I think
raspi-config workaround:
update-initramfs -c -k "$KERN"
https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L2686
on RaspiOS: when apt-get upgrades the kernel, it doesn't update the initrd. and so things break on the next reboot.
I think there are 2 things I need to fix:
I don't think there is anything in Raspios to handle config.txt updates, other than
# modify config.txt
sed -i /boot/config.txt -e "/initramfs.*/d" ;
echo initramfs "$INITRD" >> /boot/config.txt
which takes the place of Debian's update-grub
On Debians:
$ linux-version list
3.13.0-141-generic
4.19.0-12-amd64
4.19.0-16-amd64
5.10.0-20-amd64
On RaspiOS:
$ linux-version list
(nothing)
$ dpkg -S /boot/kernel.img
raspberrypi-kernel: /boot/kernel.img
$ dpkg -L raspberrypi-kernel | grep "/lib/modules/[^/]*/kernel$" | grep --only-matching -P "\d[^/]*"
5.15.84+
5.15.84-v7+
5.15.84-v7l+
5.15.84-v8+
Implementation:
add support for all 4 to config.txt i think you have to list every single model, and point p0 and pi1 to the same armv6 initrd
$ ls /boot/k*
/boot/kernel7.img /boot/kernel7l.img /boot/kernel8.img /boot/kernel.img
[pi1]
initramfs=initrd.img
[pi2]
initramfs=initrd.img
Given update-initramfs is heavily reliant on the standard debian approach to naming images in term of constructing filenames from the versions it's given, and even more so on the idea that different kernels will be installed with different file names, raspbian having thrown that entire structure out the window in favour of directly overwriting the current kernel image with the new one on upgrade makes things a little tricky.
It seems to me extremely unlikely for it to be possible to work around in the tools themselves without adding so much extra code that it would probably be less of a maintenance burden to simply fork it.
I'd suggest, though, that given the kernel image name is effectively hard-coded per system, the raspi-config approach would be far less intrusive in terms of vendor patching, seems like the best you're going to get, and the right place to patch this would be in the rasbpi package so it arranges to call update-initramfs with those arguments automatically.
overlayroot added to debian, flowed into raspi.
expected:
guessing bacause
dpkg-trigger update-initramfs;;
https://git.launchpad.net/ubuntu/+source/cloud-initramfs-tools/tree/debian/overlayroot.postinstOn Raspios
Processing triggers for initramfs-tools (0.140) ...
but then doesn't seem to do anything.commands and output on raspi:
My workaround:
update-initramfs -c -k "${KERN}"
https://github.com/CarlFK/pici/blob/main/ansible/roles/onpi/files/install_overlayroot.sh