[Arm-dev] raspi kernel upgrade activates not the latest kernel version

Sun Mar 3 15:24:09 UTC 2019
Thorsten Holtkämper <thorsten.lists at holtkaemper.eu>

Hi all,

kernel upgrades on the raspi sometimes end up with not the latest kernel 
being "activated" in the /boot directory. The reason for this is the 
kernel rpm postuninstall script of the old kernel that is removed:

postuninstall scriptlet (using /bin/sh):
cp $(ls -1 /boot/kernel-*-*|tail -1) /boot/kernel7.img
cp $(ls -1d /usr/share/raspberrypi2-kernel/*-*/|tail -1)/boot/*.dtb 
/boot/
cp $(ls -1d /usr/share/raspberrypi2-kernel/*-*/|tail 
-1)/boot/overlays/*.dtb* /boot/overlays/

It chooses the latest kernel version with "ls -1 /boot/kernel-*-*|tail 
-1" which fails for kernel versions that have different number of digits 
in the version string, e.g. 4.9 and 4.14 or 4.14.91 and 4.14.103.

An additional "sort -V" should fix the problem, i.e. "ls -1 
/boot/kernel-*-*|sort -V|tail -1".

What do you think?

Best regards,
Thorsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/arm-dev/attachments/20190303/1c18bbbd/attachment-0005.html>