View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007651 | CentOS-7 | grub2 | public | 2014-09-29 19:46 | 2015-09-26 18:37 |
Reporter | Quesar | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Linux x86_64 | OS | CentOS | OS Version | 7 |
Product Version | 7.0-1406 | ||||
Summary | 0007651: grub2-mkconfig creates boot choices in wrong order | ||||
Description | System had kernel 3.10.0-123.el7.x86_64. Updated to 3.10.0-123.6.3.el7.x86_64. After update, grub.cfg was generated with -123.el7 as the first entry instead of 123.6.3.el7. The bug is in the logic in grub-mkconfig_lib-fix-order.patch. The version_test_numeric function was doing a gt test on a vs b, but was returning true if b was higher #, instead of false if b was higher. After correcting this, I found that sort -V would put the rescue version above the others when sorting like this. As such, I added special cases for *rescue* in version_test_gt. | ||||
Steps To Reproduce | Update kernel, see old version as first choice. | ||||
Additional Information | Attached patch to fix issue. | ||||
Tags | No tags attached. | ||||
abrt_hash | |||||
URL | |||||
grub-mkconfig_lib-fix-order.patch (822 bytes)
--- share/grub/grub-mkconfig_lib 2014-06-30 12:16:11.000000000 -0400 +++ /tmp/grub-mkconfig_lib 2014-09-29 15:40:04.723864292 -0400 @@ -230,9 +230,9 @@ version_test_numeric_b="$version_test_numeric_c" fi if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then - return 0 - else return 1 + else + return 0 fi } @@ -245,6 +245,8 @@ return 0 fi case "$version_test_gt_a:$version_test_gt_b" in + *:*rescue*) return 0;; + *rescue*:*) return 1;; *.old:*.old) ;; *.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;; *:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;; |
|
My first patch did not fully fix the problem. 3.10.0-123.8.1.el7.x86_64 was released and my fix did not put this version as the 1st choice. I will need to dig in further to get a better fix, but it is still broken right now. |
|
Related upstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1124074 |
|
Another related upstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1154430 |
|
The patch attached to this bug report doesn't work. I have attached a working patch to both of the bugzilla.redhat.com bug reports. | |
Indeed the sorting order is the cause. I solved it by replacing the function version_find_latest () { version_find_latest_a="" for i in "$@" ; do if version_test_gt "$i" "$version_find_latest_a" ; then version_find_latest_a="$i" fi done echo "$version_find_latest_a" } with version_find_latest () { { for i in "$@" ; do echo $i ; done | grep -v 'rescue' | sed 's/.el7.x86_64/.000.000000/g' | sort -Vr | sed 's/.000.000000/.el7.x86_64/g' for i in "$@" ; do echo $i ; done | grep 'rescue' | sort -Vr } | head -n 1 } However, this solution is tested on a CentOS-7 x86_64 server only. It works for me. Maybe it does for you too. |
|
The sorting issue has been fixed in grub2-2.02-0.17.el7_1.4 released upstream today: https://rhn.redhat.com/errata/RHBA-2015-1784.html (BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1229329 ) |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2014-09-29 19:46 | Quesar | New Issue | |
2014-09-29 19:46 | Quesar | File Added: grub-mkconfig_lib-fix-order.patch | |
2014-10-07 20:42 | Quesar | Note Added: 0021085 | |
2014-10-07 23:39 | toracat | Note Added: 0021086 | |
2014-12-03 17:33 | toracat | Note Added: 0021849 | |
2014-12-09 00:10 | edgan | Note Added: 0021884 | |
2015-02-04 14:17 | lsparreb | Note Added: 0022282 | |
2015-09-15 12:05 | toracat | Note Added: 0024355 | |
2015-09-26 18:37 | toracat | Status | new => resolved |
2015-09-26 18:37 | toracat | Resolution | open => fixed |