Re: 2.6.8 stock kernel bug

From: Craig Bergren (cbergren_at_tvbox.bergren.us)
Date: 12/25/04

  • Next message: Hans Poppe: "Re: UPDATE: Symantec say you CANT ghost to an external drive"
    Date: Sat, 25 Dec 2004 20:23:18 GMT
    
    

    On Sat, 25 Dec 2004 16:28:30 +0000, Haines Brown wrote:

    > Craig Bergren <cbergren@tvbox.bergren.us> writes:
    >
    >> On Fri, 24 Dec 2004 17:24:04 +0000, Haines Brown wrote:
    >>
    >> > I've been exploring the problem that I can't mount my IDE cdrom drive
    >> > (sarge with kernel 2.6.8-1-386). Apparently, the kernel does not load the
    >> > driver, even though it's a stock kernel.
    >> >
    >> > I now have looked at bugs for kernel-image-2.6.8-1-386 and find the
    >> > following comment:
    >> >
    >> >> The kernel doesn't detect the CD-ROM drives automatically, which forces
    >> >> you to hack around.
    >
    >> man modprobe.conf
    >> man modules.conf
    >> man mkinitrd
    >>
    >> If you make the new initrd the same file name as the old one, grub should
    >> find it ok.
    >
    > Thanks, Craig. As, not a newbie exactly, but as apparently not a
    > computer geek either ;-), carrying out your suggestions involved some
    > very elemental problems. After reading up on modules.conf, modprobe,
    > and mkinitrd, I'm still in the dark about some basics.

    Thank you for reading the documentation. It really aids the conversation
    when you know a little bit more about what you are asking about. Just
    imagine if you read what I'm going to write without that basic knowledge?

    >
    > My kernel is evidently not able to load the module(s) needed for the IDE
    > CDROM drive. The issue is whether the modules are absent, or if the
    > driver (ide-cdrom?) needs to be loaded first.

    As you stated, there was a bug with the release. The shipped initrd
    didn't load the modules in the correct order. In most cases you can unload
    a number of modules and then reload them. In this case, however, we're
    talking about the ide driver that controls the disk where the files are
    stored. It's probably possible, but probably beyond your skill level
    right now.

    >
    > So, how do I find out which driver(s) need to be loaded to support a
    > particular device, such as an IDE CDROM drive? What drivers should I be
    > concerned about?

    There are dependencies shown in /lib/modules/2.6.8-1-386/modules.dep

    read the depmod man page. Depmod builds the dependency database that
    modprobe uses. Look in the kernel devices file.
    /usr/src/linux/Documentation/devices.txt. or google for it if you don't
    have that package loaded. It's part of the kernel source tarball
    available from kernel.org. The devices file shows you all the major/minor
    device numbers. The help from the kernel configuration utility either the
    menuconfig or xconfig will show you the module names for the various
    features.

    >
    > If I know the driver(s) needed, how do I find out if they are present in
    > a stock kernel. Looking for *.ko files in
    > /lib/modules/2.6.8-1-386/kernel/drivers is not the way because they are
    > apparently loadable modules.

    Regardless of whether they are compiled or loaded into the kernel, they
    will show up as devices in /proc/devices. You didn't see them there, so I
    assumed that the IDE drivers are modules with your release or there was a
    problem initializing them.

    > With a stock kernel I have no configuration file to see if a particular
    > module was compiled in. The modinfo exposes only loadable modules, and
    > lsmod command lists only loaded modules.

    Correct. If your kernel is configured for it, there is an optional
    feature that allows you to query the kernel for configuration. There is a
    script in /usr/src/linux/scripts or, again another option, /proc/config.gz
    contains the configuration file used to make the kernel.

    $ zcat /proc/config.gz

    Also /var/log/messages should contain messages indicating that compiled in
    modules either succeeded or failed to initialize and same for loaded
    modules.

    >
    > If I knew the kernel had the necessary driver compiled in, and it was
    > only a question of loading a particular one first, I'm still not clear
    > if it means loaded first with the initial bootstrap (initrd) or loaded
    > first among the loading of other modules, by modprobe.

    If I were you, I wouldn't use the term "compiled in" unless the module is
    actually part of the kernel image. Modules have three states:

     1. compiled into the kernel /proc/config.gz or scripts/?
     2. loaded into the kernel /proc/modules or lsmod
     3. not loaded into the kernel
       a. installed (you can see it in /lib/modules/x.x.x/modules.dep
       b. not installed
          I. built = make modules_install
          II. not built = make modules
              A. configured
              B. not configured = make xconfig, or make menuconfig

    Here's what I did to get a better understanding of how the initrd boot
    process works. First a little bit of pedantry:

    1. bios loads grub stage 1
    2. stage 1 loads stage1_5 for your file system
    3. stage1_5 boots per the grub.conf file.
       * you can esc out of menu and run grub by hand.

       kernel (hd1,0)/vmlinuz-2.6.9 root=/dev/hdb2
       initrd (hd1,0)/initrd-2.6.9.img

    4. Kernel executes the commands from /linuxrc on the initrd file system.
    5. Kernel runs init see /etc/inittab.

    grub creates a RAM disk containing the file system image contained in
    initrd.img. The initrd.img file is a compressed ext2 files system. You
    can unzip it to a file and mount it with a loopback device in order to see
    what's in it.

    $ gzcat initrd-2.6.8-1-386.img > initrd.img
    $ mount -o loop -t ext2 initrd.img /mnt/initrd

    $ cat /mnt/initrd/linuxrc

    $ ls /mnt/initrd/lib

    Here you will see a listing of all the modules that will be loaded before
    init runs.

    >
    > Is it correct that when it comes to kernel modules, the issue is initrd,
    > and not modprobe, and if it is a loadable module (which in this case it
    > isn't) it comes down to controlling the module loading sequence in
    > modules.conf?

    Not entirely correct.

    initrd contains the modules the kernel needs before the root files system
    gets mounted. That means, usually, only the drivers for the root device
    and the root filesystem. Look in the initrd.img file system
    to see what I mean. These modules are for the primary disk controller and
    the root file system. After the root file system is mounted, the kernel
    can get anything it wants off of your disk drive.

    mkinitrd reads the configuration files to determine which modules to
    include on the initrd.img file system. So if you have your system
    mis-configured, let's say you built some new modules and didn't run depmod
    to re-create the dependencies, you will build a defective initrd. It may
    be missing modules, or loading them in the wrong order.

    CB


  • Next message: Hans Poppe: "Re: UPDATE: Symantec say you CANT ghost to an external drive"

    Relevant Pages

    • Re: booting without initrd
      ... One important job of the initrd is to load ... drivers which aren't compiled directly into the base kernel image. ... may be a good exercise to learn about the kernel/root filesystem startup; ... grub gets confused when you use the vmalloc and mem kernel parameters. ...
      (comp.os.linux.setup)
    • Re: booting without initrd
      ... One important job of the initrd is to load ... drivers which aren't compiled directly into the base kernel image. ... grub gets confused when you use the vmalloc and mem kernel parameters. ... RO/RW root filesystem option will not matter. ...
      (comp.os.linux.setup)
    • Re: Compiling kernel: Missing ACPI and /ATM/ drivers
      ... > configuring grub. ... the kernel is loaded into memory and starts running. ... the data on the disks are organized into some kind of "file system". ... a scsi disk that is attached to a special controller card in the ...
      (comp.os.linux.setup)
    • Re: booting from ISO image on HD?
      ... >> through customized initrd files for each one. ... > between the loopback device and the underlying file (the iso image). ... I have to insmod the loop kernel module(e.g. ... how can you boot it from an initrd??? ...
      (comp.os.linux.misc)
    • Re: whats the processing sequence for initramfs during boot?
      ... mysterious internal cyst of an initrd, ... This depends on the drivers built into the kernel, ... file system is build into the kernel, you do not need the initrd. ...
      (Fedora)