update-grub (grub-mkconfig) includes all kernels in boot, regardless whether version is in /lib/modules
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
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-
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.
@@ -289,6 +289,12 @@
rel_
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_
+ ## 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_
initrd=
It is entirely possible to build a kernel without modules and it will run just fine without anything in /lib/modules, so this change is not appropriate.