tags 979977 + confirmed thanks Ummh, interesting...
Latest kernel and initrd are found by the following simplistic, lexicographic logic: latest_kernel=$(ls -1 /boot/vmlinuz-* | grep -v '\.dpkg-bak$' | sort -V -r | head -1) if [ -z "$latest_kernel" ]; then echo "raspi-firmware: no kernel found in /boot/vmlinuz-*, cannot populate /boot/firmware" exit 0 fi latest_initrd=$(ls -1 /boot/initrd.img-* | grep -v '\.dpkg-bak$' | sort -V -r | head -1) if [ -z "$latest_initrd" ]; then echo "raspi-firmware: no initrd found in /boot/initrd.img-*, cannot populate /boot/firmware" exit 0 fi So... Yes, it behaves as you report. Modifying the logic to search in /tmp/boot: $ touch /tmp/boot/vmlinuz-{5.10.0-trunk-armmp-lpae,5.10.0-1-armmp-lpae} $ latest_kernel=$(ls -1 /tmp/boot/vmlinuz-* | grep -v '\.dpkg-bak$' | sort -V -r | head -1) $ echo $latest_kernel /tmp/boot/vmlinuz-5.10.0-trunk-armmp-lpae Now... What to do here? I think dpkg --compare-versions here agreees with the simplistic ordering set by ls: $ if dpkg --compare-versions 5.10.0-trunk-armmp-lpae gt 5.10.0-1-armmp-lpae then echo trunk is larger else echo 1 is larger fi trunk is larger How would you suggest to check for this?