[Bug 2007827] Re: flash-kernel failure when upgrading f-k anad kernel in the same cycle
satmandu
2007827 at bugs.launchpad.net
Sat Mar 11 22:05:13 UTC 2023
I've been generating kernel images with this script from the raspberry
pi foundation kernels for some time:
https://gist.github.com/satmandu/a507c59d84737f6d29ff353395819d51
flash-kernel gives me this error now in lunar:
Using DTB: bcm2711-rpi-4-b.dtb
Installing /etc/flash-kernel/dtbs/bcm2711-rpi-4-b.dtb into /boot/dtbs/6.1.16-v8+/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
dpkg-query: no packages found matching
I've had to modify /var/lib/dpkg/info/flash-kernel.postinst to have
"exit 0" at the end, and I've also modified the beginning to replace
"set -e" with "set -x" to get some more info on what's happening.
Trying to install the latest generated image, I get this error:
Setting up linux-image-6.1.16-v8+ (6.1.16-v8+-1) ...
Processing triggers for linux-image-6.1.16-v8+ (6.1.16-v8+-1) ...
/etc/kernel/postinst.d/dkms:
* dkms: running auto installation service for kernel 6.1.16-v8+
...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.1.16-v8+
Using DTB: bcm2711-rpi-4-b.dtb
Installing /etc/flash-kernel/dtbs/bcm2711-rpi-4-b.dtb into /boot/dtbs/6.1.16-v8+/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
flash-kernel: deferring update (trigger activated)
/etc/kernel/postinst.d/zz-flash-kernel:
Using DTB: bcm2711-rpi-4-b.dtb
Installing /etc/flash-kernel/dtbs/bcm2711-rpi-4-b.dtb into /boot/dtbs/6.1.16-v8+/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
flash-kernel: deferring update (trigger activated)
Processing triggers for flash-kernel (3.106ubuntu13) ...
+ [ xtriggered = xtriggered ]
+ FLASH_KERNEL_NOTRIGGER=y flash-kernel
Using DTB: bcm2711-rpi-4-b.dtb
Installing /etc/flash-kernel/dtbs/bcm2711-rpi-4-b.dtb into /boot/dtbs/6.1.16-v8+/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
dpkg-query: no packages found matching
+ exit 0
(without the exit 0, flash-kernel always quits with an error, leaving
the install of the kernel broken.)
I can't tell if the flash-kernel breakage is connected to this change or
not... but I can't understand why there is a dpkg-query error here.
I do see this:
dpkg-query -l linux-image-6.1.16-v8+
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-======================-============-============-=================================
ii linux-image-6.1.16-v8+ 6.1.16-v8+-1 arm64 Linux kernel, version 6.1.16-v8+
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to flash-kernel in Ubuntu.
https://bugs.launchpad.net/bugs/2007827
Title:
flash-kernel failure when upgrading f-k anad kernel in the same cycle
Status in flash-kernel package in Ubuntu:
Fix Released
Status in flash-kernel source package in Focal:
New
Status in flash-kernel source package in Jammy:
New
Status in flash-kernel source package in Kinetic:
New
Status in flash-kernel source package in Lunar:
Fix Released
Bug description:
[Impact]
In version 3.104ubuntu15 of flash-kernel, when both f-k and the kernel are upgraded in the same cycle, depending on the ordering of dpkg trigger execution, f-k may find the content of /boot "inconsistent" causing it to fail and return error exit status 1.
Erorr message:
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for flash-kernel (3.104ubuntu15) ...
flash-kernel: installing version 5.15.0-1018-xilinx-zynqmp
Initrd required for FIT method
dpkg: error processing package flash-kernel (--configure):
installed flash-kernel package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.15.0-1018-xilinx-zynqmp (5.15.0-1018.20) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-1018-xilinx-zynqmp
flash-kernel gets the latest kernel version by "linux-version list".
When flash-kernel was triggered to generate fitimage, the kernel version is "5.15.0-1018" and the initrd for it wasn't ready. So, flash-kernel failed to generate the fitimage.
A subsequent run of "apt install -f" fixed things because, by that
point, the kernel's own trigger had executed, ensuring that update-
initramfs had been run. In the case that f-k is run "prematurely" and
finds itself in this situation (/boot/kernel-$[ver} exists, but
/boot/initrd-${ver}) doesn't), it should probably bail out silently
under the assumption that whatever is responsible for it will rectify
the situation and trigger f-k again (as happens in the kernel postinst
hooks).
[Test Case]
1. Flash an old image (with an out of date kernel and flash-kernel)
2. sudo apt-get update
3. sudo apt install flash-kernel with the fix and linux packages
4. Upgrade should proceed without issue
[Regression Potential]
As with the previous flash-kernel uploads, it is possible that a breakage in the changed code can lead to issues with upgrading kernels (due to f-k being executed via a trigger at the end) or with Xilinx devices in the field not upgrading correctly. I will test all the changes extensively though.
Related issues:
LP: #1861292 flash-kernel failure during kernel upgrade
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/flash-kernel/+bug/2007827/+subscriptions
More information about the foundations-bugs
mailing list