Bug 114923

Summary: mkinitrd dies on module parameters
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Kurt Garloff <garloff>
Component: BasesystemAssignee: Hannes Reinecke <hare>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Critical    
Priority: P5 - None CC: werner
Version: Beta 4   
Target Milestone: ---   
Hardware: x86   
OS: SUSE Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: mkinitrd
Proposed fix
With module.* parameter handling

Description Kurt Garloff 2005-09-02 09:21:34 UTC
tpkurt:/media/root/etc # cat /etc/modprobe.conf.local | grep -v ^# 
options scsi_mod default_dev_flags=0x20000 
 
tpkurt:/media/root/etc # tpkurt:/media/root/etc # mkinitrd 
Root device:    /dev/VG_new/LV_SL100 (mounted on / as reiserfs) 
Module list:    piix processor thermal fan reiserfs dm_mod dm-mod dm-snapshot 
 
Kernel image:   /boot/vmlinuz-2.6.13-2-xen 
Initrd image:   /boot/initrd-2.6.13-2-xen 
Shared libs:    lib/ld-2.3.5.so lib/libacl.so.1.1.0 lib/libattr.so.1.1.0 
lib/libblkid.so.1.0 lib/libc-2.3.5.so lib/libdevmapper.so.1.01 
lib/libdl-2.3.5.so lib/libpthread-0.10.so lib/librt-2.3.5.so 
lib/libselinux.so.1 lib/libuuid.so.1.2  
Driver modules: kernel/drivers/ide/ide-core.ko kernel/drivers/ide/ide-disk.ko 
kernel/drivers/ide/pci/piix.ko kernel/drivers/acpi/processor.ko 
kernel/drivers/acpi/thermal.ko kernel/drivers/acpi/fan.ko 
kernel/drivers/md/dm-mod.ko kernel/drivers/md/dm-snapshot.ko  
cp: cannot stat `default_dev_flags=0x20000': No such file or directory 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
Failed to add module default_dev_flags=0x20000. 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Comment 1 Kurt Garloff 2005-09-02 09:23:08 UTC
A fix could look like this: 
 
    # Now copy the upper level driver modules 
    lastmod='' 
    for module in $uld_modules; do 
        # If name starts with lib we have a module name, otherwise param 
        if [ ${module#lib} = ${module} ]; then 
            echo "options ${lastmod} ${module}" >> $tmp_mnt/etc/modprobe.conf 
        else 
            lastmod=${module##*/} 
            lastmod=${lastmod%.ko} 
            if [ ! -f $tmp_mnt/$module ]; then 
                if ! ( cd ${root_dir:-/} ; cp -p --parents $module 
$tmp_mnt ) ; then 
                    oops 6 "Failed to add module $module." 
                    return 
                fi 
            fi 
        fi 
    done 
 
Comment 4 Hannes Reinecke 2005-09-05 09:00:06 UTC
Kurt, your fix is not correct. We already have code to separate out modules and
options:

    while read module params ; do
        ...
    done < <(echo "$drv_modules")

So it looks more as if the module list is not written correctly.
Comment 5 Hannes Reinecke 2005-09-05 09:01:13 UTC
Created attachment 48751 [details]
mkinitrd

Updated /sbin/mkinitrd. Please retest with it.
Comment 6 Kurt Garloff 2005-09-05 20:09:45 UTC
1. Your mkinitrd seems to work (it does not error out)  
2. ... but you discard the module parameters that are likely to be needed   
3. ... ... and you fail to explain why my variant is wrong. 
           Yours is more elegant, yes ... 
 
Comment 7 Andreas Gruenbacher 2005-09-05 20:59:53 UTC
The code in comment 1 doesn't help because insmod does not look at 
modprobe.conf. There is no need to separate modules from parameters; they only 
got mixed by acciddent. 
 
The parameter problem is a bit messy: parameters for some modules loaded with 
insmod (dasd_mod, ide_core, scsi_mod) are lost. Parameters for modules loaded 
with modprobe are lost because the modprobe.conf* files are missing. 
 
Since we now have modprobe in the initrd, I suggest that we add its config 
files, use it for all module loading. 
Comment 8 Andreas Gruenbacher 2005-09-05 21:41:28 UTC
Created attachment 48854 [details]
Proposed fix

Switch to using modprobe instead of insmod; add modprobe.conf* to the initrd.
Please review and test this patch before committing...
Comment 9 Hannes Reinecke 2005-09-06 06:22:12 UTC
Hmm; I don't think that'll work. We have to be able to pass module options via
the kernel cmdline; not sure whether we handle that now correctly.

However, using modprobe instead of insmod is probably not a bad approach.
So we should always copy in modprobe.conf et al.
Comment 10 Hannes Reinecke 2005-09-06 06:32:03 UTC
Well, the patch handles the cmdline arguments properly. So ignore that bit.
Otherwise the patch looks quite ok to me ...
Comment 11 Andreas Gruenbacher 2005-09-06 07:10:02 UTC
Created attachment 48882 [details]
With module.* parameter handling

We should add parameters of the form "module.something" to the modprobe calls.
Actually this would allow to get rid of some of the other special cases.

The code that this now generates in the init script is ugly, but we can
probably live with it for one release.

Hannes, could you please test this fix?
Comment 12 Andreas Gruenbacher 2005-09-07 12:43:19 UTC
Install entries in modprobe.conf are an additional problem: we only       
have a limited set of binaries in the initrd, so some of the actions       
specified may fail in exceptional cases. We will only have with storage-type     
modules in the initrd though, which are not as weird as some other types.     
Almost all install actions either null out a module (with /bin/true as the     
action) or load a dependent module (by calling /sbin/modprobe recorsively).    
Removing install actions from modprobe.conf are likely to break more things    
than they will fix.    
    
I have added attachment 11 [details] and a version of /bin/true to the cvs now.  
  
An open issue is that we should probably pass the original INITRD_MODULES list 
of modules to modprobe instead of the resolved modules. This requires some 
changes to the fs_modules / drv_modules split code though. 
Comment 13 Hannes Reinecke 2005-09-09 12:14:56 UTC
Tested mkinitrd on SATA and IDE machine. Closing bug.