os-prober 90fallback - kernels detected out of order

Bug #1317153 reported by Mario Chamorro
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-prober (Ubuntu)
Fix Released
Undecided
Dimitri John Ledkov

Bug Description

Ubuntu information at the end of this message. When detecting kernels in other distributions like CentOS on the same disk, the kernels are incorrectly sorted numerically.

e.g. this is the current incorrect jumbled result from grub-mkconfig:

vmlinuz-2.6.32-358.23.2.el6.x86_64
vmlinuz-2.6.32-431.11.2.el6.x86_64
vmlinuz-2.6.32-431.1.2.0.1.el6.x86_64
vmlinuz-2.6.32-431.3.1.el6.x86_64
vmlinuz-2.6.32-431.5.1.el6.x86_64

The correct order where the newest kernels are at the top is like so:

vmlinuz-2.6.32-431.11.2.el6.x86_64
vmlinuz-2.6.32-431.5.1.el6.x86_64
vmlinuz-2.6.32-431.3.1.el6.x86_64
vmlinuz-2.6.32-431.1.2.0.1.el6.x86_64
vmlinuz-2.6.32-358.23.2.el6.x86_64

To resolve this, /usr/lib/linux-boot-probes/mounted/90fallback needs to list them with the "-t" option:

  -t sort by modification time, newest first

I've made the below change to my local 90fallback script and verified that the kernels are now listed in the correct order:

22c22
< for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null); do
---
> for kernfile in $(eval ls -t "$mpoint$kernpat" 2>/dev/null); do

Please make this correction to os-prober so I do not have to manually modify /boot/grub/grub.cfg every time my multi-boot laptop gets new updated kernels. Thanks in advance.
-- Mario Chamorro

[mchamorr-ubuntu:~] lsb_release -rd
Description: Ubuntu 14.04 LTS
Release: 14.04

[mchamorr-ubuntu:~] apt-cache policy os-prober
os-prober:
  Installed: 1.63ubuntu1
  Candidate: 1.63ubuntu1
  Version table:
 *** 1.63ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/main i386 Packages
        100 /var/lib/dpkg/status
[mchamorr-ubuntu:~]

Tags: patch
Revision history for this message
Mario Chamorro (mochaman) wrote :

Here is my solution to the issue - this was created using 'diff -u':

--- 90fallback.0 2012-04-04 13:17:21.000000000 -0400
+++ 90fallback 2014-05-07 09:59:12.283599302 -0400
@@ -19,7 +19,7 @@
  else
   kernbootpart="$partition"
  fi
- for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null); do
+ for kernfile in $(eval ls -t "$mpoint$kernpat" 2>/dev/null); do
   kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!")
   if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
    initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/")

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "os-prober 90fallback diff/patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in os-prober (Ubuntu):
assignee: nobody → Dimitri John Ledkov (xnox)
Revision history for this message
Mario Chamorro (mochaman) wrote :

This should be a pretty simple patch to one file. I notice that I cannot see this bug in Dimitri's assigned list. Is anyone going to look at this?

Changed in os-prober (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package os-prober - 1.70ubuntu2

---------------
os-prober (1.70ubuntu2) xenial; urgency=medium

  [ Mario Chamorro ]
  * Sort detected kernels by modification time, if possible. (LP:
    #1317153)

 -- Dimitri John Ledkov <email address hidden> Tue, 23 Feb 2016 16:10:29 +0000

Changed in os-prober (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.