[SOLVED] creating initrd with all required SAS/SCSI modules

Posted:
Jul 26th, '13, 13:26
by magfan
Some time ago I could solve an issue with dracut by putting kernel modules into initrd (
https://forums.mageia.org/en/viewtopic.php?f=7&t=3383). But this time the trick does not work. After booting I have to call "insmod /usr/lib/modules/3.8.13.4-server-1.mga3/kernel/drivers/scsi/sg.ko.xz" manually to load the required SCSI module for our SAS TapeLibrary. Mageia just recognizes the built-in MegaRAID SAS-controller and SAS-HBA and puts the kernel modules mptsas and megaraid_sas into initrd. So far everything is OK; without that I could not even boot the system. But Mageia does not get (or care for) the information from the SAS-HBA that there is another device (the TapeLibrary) connected to the system which needs the SCSI module (sg). Interestingly Mageia puts at least the kernel module for tapes (st) into initrd...
Any idea how I could create an initrd file with all required modules included?
Re: creating initrd with all required SAS/SCSI modules fails

Posted:
Jul 26th, '13, 13:46
by claire
If you have the correct modules loaded then running dracut -f should create a new initrd with all the loaded modules in it.
The dracut man page has quite a good explanation of it's workings. The -f (--force) option allows it to overwrite the existing initrd.
Re: creating initrd with all required SAS/SCSI modules fails

Posted:
Jul 26th, '13, 14:38
by magfan
Well, I could create an initrd file including that module (sg) but it is not loaded automatically. I still have to call insmod after rebooting. It seems to me Mageia does not recognize the TapeLibrary and therefore it does not load the SCSI module. How can I force to load it while booting?
- Code: Select all
# lsinitrd initrd-3.8.13.4-server-1.mga3.img.org | grep sg.ko
# lsinitrd initrd-3.8.13.4-server-1.mga3.img | grep sg.ko -rw-r--r-- 1 root root 18140 Jul 26 13:34 usr/lib/modules/3.8.13.4-server-1.mga3/kernel/drivers/scsi/sg.ko.xz
#
Re: creating initrd with all required SAS/SCSI modules fails

Posted:
Jul 29th, '13, 03:43
by jiml8
I must be missing something. The initrd is only used for the very beginning of the system startup and has to have drivers that won't otherwise be available until the filesystems are mounted; after the pivot_root , you are running off of /. So you shouldn't need any drivers other than the minimum to boot in initrd.
However, after the filesystems are up, then you would expect your devices to be properly detected and all drivers to be loaded. I haven't had to fiddle with that kind of thing for awhile, and have never had to fiddle with it in Mageia, but I suggest you investigate udev and /etc/modules to try to find your answer. Failing that, or not willing to do that, you might just create a small service script for /etc/init.d/ that will load the driver you want.
Re: creating initrd with all required SAS/SCSI modules fails

Posted:
Jul 29th, '13, 07:56
by magfan
@jiml8: Thank you! The solution was easy once I knew where to look...
Yes, initrd must include modules required for the initial startup. In my case SAS modules have to be included because the booting device of my system is a hardware RAID. But I do not need the TapeLibrary for booting. This part is correctly handled by Mageia. What I need else is to set up the file system and devices properly. And I need the TapeLibrary to be configured properly for the backup software. This can be done for kernels 2.5 and above by adding module names in /etc/modprobe.preload (/etc/modules for older kernels). Just to be sure I included module "st" for tapes as well although it was already loaded somehow. With these new settings I get the neccessary devices: /dev/nst0* for the TapeLibrary and /dev/sg* for the LTO drive within the TapeLibrary.
So, my final modprobe.preload looks like this:
- Code: Select all
# /etc/modprobe.preload: kernel modules to load at boot time.
#
# This file should contain the names of kernel modules that are
# to be loaded at boot time, one per line. Comments begin with
# a `#', and everything on the line after them are ignored.
# this file is for module-init-tools (kernel 2.5 and above) ONLY
# for old kernel use /etc/modules
# SCSI driver (sg) and tape driver (st) for Tandberg TapeLibrary
sg
st