Package: flash-kernel
Version: 3.109
Severity: serious
Tags: patch
X-Debbugs-Cc: [email protected], [email protected]

Hi,

this is a bug for this (merged) MR on salsa:

https://salsa.debian.org/installer-team/flash-kernel/-/merge_requests/80

From the MR/commit description:

> Since Debian Linux commit 85b86360b6e4c1c63a698aa98edbdec963d72ebe,
> /usr/lib/linux-image-$kvers is a symlink to /lib/modules/$kvers/dtb and
> without -H, find will not traverse into it.

I'm not the best person to file this bug because the platforms I have here
(imx8mq, rk3588, a311d, ls1028a, imx8m+) are all not supported by flash-kernel,
so I can only use them with flash-kernel with a patched machine file. This is
why you will see a strange version in my logs.

I am maintaining a Debian "derivative" (we only patch five packages) for the
MNT Reform open hardware laptops and one of the packages we patch is
flash-kernel. We also patch it with the patch from above MR and this is what
convinces me that that MR fixes this problem.

Without that patch, we see this:


Preparing to unpack 
…/flash-kernel_3.109+reform20250506T203207Z~bpo13+1_arm64.deb…
Unpacking flash-kernel (3.109+reform20250506T203207Z~bpo13+1) over (3.109)…
Setting up initramfs-tools (0.150)…
update-initramfs: deferring update (trigger activated)
Setting up flash-kernel (3.109+reform20250506T203207Z~bpo13+1)…
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
flash-kernel: deferring update (trigger activated)
Processing triggers for man-db (2.13.1-1)…
Processing triggers for initramfs-tools (0.150)…
update-initramfs: Generating /boot/initrd.img-6.18.3-mnt-reform-arm64
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
Couldn't find DTB rk3588-mnt-pocket-reform.dtb in 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64
 or /etc/flash-kernel/dtbs
Installing  into 
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
cp: cannot stat '': No such file or directory
run-parts: /etc/initramfs/post-update.d//flash-kernel exited with return code 1
dpkg: error processing package initramfs-tools (--configure):
 old initramfs-tools package postinst maintainer script subprocess failed with 
exit status 1
Errors were encountered while processing:
 initramfs-tools
Error: Sub-process /usr/bin/dpkg returned an error code (1)


We can investigate why that is by looking at the sh -x output:


+ [ MNT Pocket Reform with RCORE RK3588 Module = MNT Pocket Reform with RCORE 
RK3588 Module ]
+ state=gotmachine
+ [ gotmachine = fields ]
+ [ gotmachine = gotmachine ]
+ [ gotmachine != gotmachine ]
+ read field value
+ [ gotmachine = machine ]
+ [ gotmachine = fields ]
+ [ gotmachine = gotmachine ]
+ state=fields
+ read field value
+ [ fields = machine ]
+ [ fields = fields ]
+ echo rockchip/rk3588-mnt-pocket-reform.dtb
+ return 0
+ local field=rockchip/rk3588-mnt-pocket-reform.dtb
+ dtb_name=rockchip/rk3588-mnt-pocket-reform.dtb
+ [ -n rockchip/rk3588-mnt-pocket-reform.dtb ]
+ echo Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
+ dirname rockchip/rk3588-mnt-pocket-reform.dtb
+ dtb_dir=rockchip
+ basename rockchip/rk3588-mnt-pocket-reform.dtb
+ dtb_name=rk3588-mnt-pocket-reform.dtb
+ [ -n  ]
+ linux-version list
+ linux-version sort
+ tail -1
+ latest_version=6.18.3-mnt-reform-arm64
+ [ -n  ]
+ [ -z  ]
+ [ -n  ]
+ [ no = yes ]
+ kvers=6.18.3-mnt-reform-arm64
+ handle_dtb
+ [ xrk3588-mnt-pocket-reform.dtb = x ]
+ 
dtbfile=/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
+ local dtb
+ [ x = xpostrm.d ]
+ find_dtb_file
+ local dtb
+ find /etc/flash-kernel/dtbs -name rk3588-mnt-pocket-reform.dtb
+ head -n 1
+ dtb=
+ [ -z  ]
+ find /usr/lib/linux-image-6.18.3-mnt-reform-arm64 -name 
rk3588-mnt-pocket-reform.dtb
+ head -n 1
+ dtb=
+ [ ! -f  ]
+ error Couldn't find DTB rk3588-mnt-pocket-reform.dtb in 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64 or /etc/flash-kernel/dtbs
+ echo Couldn't find DTB rk3588-mnt-pocket-reform.dtb in 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64 or /etc/flash-kernel/dtbs
Couldn't find DTB rk3588-mnt-pocket-reform.dtb in 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64 or /etc/flash-kernel/dtbs
+ exit 1
+ local dtb=
+ echo Installing  into 
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
Installing  into 
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
+ mkdir -p /boot/dtbs/6.18.3-mnt-reform-arm64/rockchip
+ cp  
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb.new
cp: cannot stat '': No such file or directory



The problem is, that "find /usr/lib/linux-image-6.18.3-mnt-reform-arm64" sees
a symlink and will not descend into it. This is why the problem is fixed by
adding the -H flag to find. With that flag in place we get:


Unpacking flash-kernel (3.109+reform20260112T074539Z+1) over 
(3.109+reform20250826T191649Z+1)…
Setting up initramfs-tools (0.150)…
update-initramfs: deferring update (trigger activated)
Setting up flash-kernel (3.109+reform20260112T074539Z+1)…
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
flash-kernel: deferring update (trigger activated)
Processing triggers for man-db (2.13.1-1)…
Processing triggers for initramfs-tools (0.150)…
update-initramfs: Generating /boot/initrd.img-6.18.3-mnt-reform-arm64
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
Installing 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
 
into /boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
Installing new rk3588-mnt-pocket-reform.dtb.
flash-kernel: installing version 6.18.3-mnt-reform-arm64
Generating boot script u-boot image... done.
Installing new boot.scr.
Processing triggers for flash-kernel (3.109+reform20260112T074539Z+1)…
Using DTB: rockchip/rk3588-mnt-pocket-reform.dtb
Installing 
/usr/lib/linux-image-6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
 
into /boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
Taking backup of rk3588-mnt-pocket-reform.dtb.
Installing new rk3588-mnt-pocket-reform.dtb.
flash-kernel: installing version 6.18.3-mnt-reform-arm64
Generating boot script u-boot image... done.
Taking backup of boot.scr.
Installing new boot.scr.


And as expected the dtb gets copied to where it should be:


m@m:~$ find /boot/dtbs/
/boot/dtbs/
/boot/dtbs/6.18.3-mnt-reform-arm64
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb.bak
/boot/dtbs/6.18.3-mnt-reform-arm64/rockchip/rk3588-mnt-pocket-reform.dtb
/boot/dtbs/6.18.3-mnt-reform-arm64/rk3588-mnt-pocket-reform.dtb


Thanks!

cheers, josch

Reply via email to