[Bug 1613260] [NEW] update-grub (grub-mkconfig) includes all kernels in boot, regardless whether version is in /lib/modules

Peter Passchier solusos at passchier.net
Mon Aug 15 11:58:19 UTC 2016


Public bug reported:

All kernels/initrds in /boot are included, also if they would never
work. Below is a patch that fixes this.

1. Ubuntu 16.04.1 LTS (but it has always been like this)
2. grub-common 2.02~beta2-36ubuntu3.2
3. Only the kernels/initrds that have a version that is installed are listed on grub-mkconfig
4. All kernels/initrds in /boot are enumerated


--- 10_linux    2016-08-14 11:19:24.037604092 +0700
+++ /etc/grub.d/10_linux        2016-08-14 18:13:53.714595280 +0700
@@ -289,6 +289,12 @@
   rel_dirname=`make_system_path_relative_to_its_root $dirname`
   version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
   alt_version=`echo $version | sed -e "s,\.old$,,g"`
+  ## Only if version is in /lib/modules
+       if [ "x$(echo /lib/modules/* |grep $version)" = "x" ]
+  then
+    list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
+    continue
+  fi
   linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
   initrd=

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1613260

Title:
  update-grub (grub-mkconfig) includes all kernels in boot, regardless
  whether version is in /lib/modules

Status in grub2 package in Ubuntu:
  New

Bug description:
  All kernels/initrds in /boot are included, also if they would never
  work. Below is a patch that fixes this.

  1. Ubuntu 16.04.1 LTS (but it has always been like this)
  2. grub-common 2.02~beta2-36ubuntu3.2
  3. Only the kernels/initrds that have a version that is installed are listed on grub-mkconfig
  4. All kernels/initrds in /boot are enumerated

  
  --- 10_linux    2016-08-14 11:19:24.037604092 +0700
  +++ /etc/grub.d/10_linux        2016-08-14 18:13:53.714595280 +0700
  @@ -289,6 +289,12 @@
     rel_dirname=`make_system_path_relative_to_its_root $dirname`
     version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
     alt_version=`echo $version | sed -e "s,\.old$,,g"`
  +  ## Only if version is in /lib/modules
  +       if [ "x$(echo /lib/modules/* |grep $version)" = "x" ]
  +  then
  +    list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
  +    continue
  +  fi
     linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
   
     initrd=

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1613260/+subscriptions



More information about the foundations-bugs mailing list