Hi,
On Sun, Mar 15, 2026 at 10:02:50PM -0500, David Wright wrote:
> Presumably, something in the process of writing grub.cfg
> ought to be using dpkg --compare-versions rather than
> plain ASCII sorting. (Not sure what that something would be.)
It's done by grub-mkconfig which calls /etc/grub.d/10_linux. An issue is
that this is only looking at filenames on the filesystem (not Debian
package versions):
list=
for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
done
then later:
reverse_sorted_list=$(echo $list | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/!
s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//')
version_sort is a bash function in /usr/share/grub/grub-mkconfig_lib:
version_sort ()
{
case $version_sort_sort_has_v in
yes)
LC_ALL=C sort -V "$@";;
no)
LC_ALL=C sort -n "$@";;
*)
if sort -V </dev/null > /dev/null 2>&1; then
version_sort_sort_has_v=yes
LC_ALL=C sort -V "$@"
else
version_sort_sort_has_v=no
LC_ALL=C sort -n "$@"
fi;;
esac
}
So all in all a bit tricky to get Debian package versions into there and
maybe easier to correct the problem in the filenames.
Thanks,
Andy
--
https://bitfolk.com/ -- No-nonsense VPS hosting