Bug 208593 - /sbin/modprobe does not work with multiple kernels
Bug#: 208593 Product:  Gentoo Hosted Projects Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: genkernel@gentoo.org Reported By: fdbugs@dupoux.com
Component: genkernel
URL: 
Summary: /sbin/modprobe does not work with multiple kernels
Keywords:  
Status Whiteboard: 
Opened: 2008-02-02 16:08 0000
Description:   Opened: 2008-02-02 16:08 0000
I have a problem with the /usr/share/genkernel/generic/modprobe (the modprobe
script implementation for busybox) script that comes with genkernel-3.4.9
(final version). This script has a problem when we have more than one set of
kernel modules in /lib/modules. The insmod may fail because the script uses
'find /lib/modules' to get the full path to the kernel module in
real_mod_path().

The problem is when you have vmlinuz2 loaded into memory and you want to load
the 'xxx' module, the script will load /lib/modules/vmlinuz1/xxx.ko instead of
/lib/modules/vmlinuz2/xxx.ko. Just because the wrong 'vmlinuz1' subdirectory
will be found before the right 'vmlinuz2' subdirectory by the find command.

All you have to do is to search in the right subdirectory.
To fix the bug, edit the modprobe script and do that:
replace
   find /lib/modules | grep /"${1}${KSUFF}"
with
   find /lib/modules/${KV} | grep /"${1}${KSUFF}"


Reproducible: Always

Steps to Reproduce:
1. make an initramfs that can work with more than one kernel
2.
3.

------- Comment #1 From Andrew Gaffney 2008-02-02 16:36:09 0000 -------
Well, you are using genkernel's initramfs in an unsupported way. You can't
really complain that it breaks :P However, the proposed fix is simple and
appears harmless even for "supported" configurations.

------- Comment #2 From fdupoux 2008-02-02 16:49:41 0000 -------
Hi Andrew,

Thanks for your quick reply. That's right this is an unsupported usage, but
it's always better to have a program that works in all conditions. That's just
a small contribution to improve genkernel. Hope you can include this patch in
the next genkernel version.

Thanks.

------- Comment #3 From Andrew Gaffney 2008-02-02 17:34:34 0000 -------
This is fixed in SVN. Thanks.

------- Comment #4 From Chris Gianelloni (RETIRED) 2008-02-14 04:32:41 0000 -------
I just released genkernel 3.4.10_pre1, which has this fix included.  Feel free
to REOPEN this bug or make a comment if it is not resolved.