Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 408195 - sys-boot/grub-2.00_beta2: grub2-mkconfig, kernels not sorted by version
Summary: sys-boot/grub-2.00_beta2: grub2-mkconfig, kernels not sorted by version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
URL: http://lists.gnu.org/archive/html/gru...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-03-14 18:49 UTC by Daniel Schömer
Modified: 2012-03-20 14:16 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch /usr/share/grub/grub-mkconfig_lib to test for "sort -V" (grub-mkconfig_lib-2.00_beta2_version_sort_sort_has_v.patch,376 bytes, patch)
2012-03-14 18:49 UTC, Daniel Schömer
Details | Diff
emerge --info (emerge-info.txt,8.96 KB, text/plain)
2012-03-14 18:50 UTC, Daniel Schömer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Schömer 2012-03-14 18:49:07 UTC
grub2-mkconfig does not sort the available kernels in /boot/ by their versions.

Reproducible: Always

Steps to Reproduce:
1. Copy different kernels to /boot/ (I used genkernel), lets say kernel-genkernel-x86_64-3.2.6-gentoo, kernel-genkernel-x86_64-3.2.9-gentoo and kernel-genkernel-x86_64-3.2.11-gentoo
2. Run "sudo grub2-mkconfig -o /boot/grub2/grub.cfg"
Actual Results:  
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/kernel-genkernel-x86_64-3.2.9-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.9-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-3.2.6-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.6-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-3.2.11-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.11-gentoo
Found memtest86+ image: /boot/memtest86plus/memtest
done

# The kernel order is 3.2.9, 3.2.6, 3.2.11

Expected Results:  
Generating grub.cfg ...
Found linux image: /boot/kernel-genkernel-x86_64-3.2.11-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.11-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-3.2.9-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.9-gentoo
Found linux image: /boot/kernel-genkernel-x86_64-3.2.6-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.6-gentoo
Found memtest86+ image: /boot/memtest86plus/memtest
done

# The kernel order is 3.2.11, 3.2.9, 3.2.6

The error is in /usr/share/grub/grub-mkconfig_lib, line 196, bash function version_sort().

To sort the kernel versions, sort (/usr/bin/sort) is used with option -V (version sort), if available. The test if sort accepts option -V (uppercase), actually tests if -v (lowercase) is accepted.

After changing the test to really test if -V is accepted, the kernels are listed in the correct (descending) version sort order.
Comment 1 Daniel Schömer 2012-03-14 18:49:50 UTC
Created attachment 305335 [details, diff]
Patch /usr/share/grub/grub-mkconfig_lib to test for "sort -V"
Comment 2 Daniel Schömer 2012-03-14 18:50:29 UTC
Created attachment 305337 [details]
emerge --info
Comment 3 Mike Gilbert gentoo-dev 2012-03-14 19:04:16 UTC
Yeah, I reported that upstream on Monday. See URL.
Comment 4 Geoff Madden 2012-03-19 06:27:51 UTC
I ran into a curious problem ,due to the non sorting I deleted all but the 3.2.11 branch and when rerunning grub-mkconfig it did not pick up the existing kernel in boot,this happened on both x86 /x86_64 both AMD machines.
Any ideas ????????
Geoff
Comment 5 Mike Gilbert gentoo-dev 2012-03-19 22:26:42 UTC
(In reply to comment #4)
> Any ideas ????????

It sounds like you deleted all your kernels, not just the old ones.

Please ask for support in an official support channel (not bugzilla). Personally, I hang out in #gentoo quite often, so feel free to ping me there.

http://www.gentoo.org/main/en/support.xml
Comment 6 Mike Gilbert gentoo-dev 2012-03-19 22:29:11 UTC
This has been fixed upstream. I'll keep this open until beta3 is in the tree.
Comment 7 Michael Weber (RETIRED) gentoo-dev 2012-03-20 03:07:46 UTC
(In reply to comment #3)
> Yeah, I reported that upstream on Monday. See URL.

I've searched upstream bugtracker and reported
https://savannah.gnu.org/bugs/index.php?35888
on Sunday.

Can you please add an revbump -r1 with this patch included?
I ran into this isse several times esp. with kernels 3.2.9 and 3.2.11.

Thanks
Comment 8 Mike Gilbert gentoo-dev 2012-03-20 03:29:48 UTC
+*grub-2.00_beta2-r1 (20 Mar 2012)
+
+  20 Mar 2012; Mike Gilbert <floppym@gentoo.org> +grub-2.00_beta2-r1.ebuild:
+  Fix bug 408196.
+
Comment 9 Urmet Saar 2012-03-20 08:19:30 UTC
(In reply to comment #8)
> +*grub-2.00_beta2-r1 (20 Mar 2012)
> +
> +  20 Mar 2012; Mike Gilbert <floppym@gentoo.org> +grub-2.00_beta2-r1.ebuild:
> +  Fix bug 408196.
> +

The changelog entry has a typo. This bug is numbered 408196
Comment 10 Martin Jansa 2012-03-20 12:33:08 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > +*grub-2.00_beta2-r1 (20 Mar 2012)
> > +
> > +  20 Mar 2012; Mike Gilbert <floppym@gentoo.org> +grub-2.00_beta2-r1.ebuild:
> > +  Fix bug 408196.
> > +
> 
> The changelog entry has a typo. This bug is numbered 408196

This comment has a typo. This bug is numbered 408195

:)