5

I want to modprobe a module from the kernel command line (in my case yaboot, but you are probably more familiar with grub). This is for a workaround for the live CD. I've seen some old advice that says this is possible in Ubuntu. However, it doesn't seem to work for me.

The module I want to load is a framebuffer (so it is normally blacklisted). I don't know if that complicates things, but I can't seem to modprobe any module from the kernel command line. Is there any other Command Line that would do it?

Does anybody know if this is possible, and how you would do it? Thanks.

6
  • If you mean if it can be done from within grub (config files), then do remember that your module must be in your /boot/initrd.img-....... initial ramdisk image.
    – jippie
    Apr 20, 2012 at 17:21
  • 1
    I want to modprobe a module that is not in the initial ramdisk image.
    – rsavage
    Apr 20, 2012 at 18:12
  • Then you have to copy it to initrd.
    – jippie
    Apr 20, 2012 at 18:21
  • So are you saying the answer to the question is no then?
    – rsavage
    Apr 20, 2012 at 18:45
  • As far as my knowledges at this moment in time.
    – jippie
    Apr 20, 2012 at 18:46

4 Answers 4

2

To load a module when the kernel is called from the bootloader you have only to add the name of the module.

The syntax is the name of the module, if you want to pass an option to the module, type modulename.moduleoption.

For example, in my old computer I have an ISA Plug & Play Ethernet Adapter RTL8019/11901 that works with the NE module. On the kernel command line I add ne.irq=0x0220 and boot. Finally the card is recognized.

1

Grub uses the insmod command to load up modules. Here's a real-world example from my /boot/grub/grub.cfg file:

menuentry 'Ubuntu, with Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd8,msdos1)'
    search --no-floppy --fs-uuid --set=root 1b66bb9e-5b02-49f1-8cf9-bc3f649d70a6
    linux   /boot/vmlinuz-3.2.0-23-generic root=UUID=1b66bb9e-5b02-49f1-8cf9-bc3f649d70a6 ro   nomodeset pcie_aspm=force
    initrd  /boot/initrd.img-3.2.0-23-generic
}

Whether or not you can script that from yaboot, is another question. If it does work, please leave a comment saying so.

4
  • Thanks for the quick reply! Sadly insmod doesn't seem to work either. yaboot is much simpler than grub. I only have a single config line to play with. Imagine I'm adding the necessary command to the end of your "nomodeset pcie_aspm=force". What I'm doing at the moment is just tagging on: insmod module_name
    – rsavage
    Apr 20, 2012 at 17:38
  • All I can do is add to this one line (taken from my installed system): /pci@f4000000/ata-6@d/disk@0:3,/boot/vmlinux initrd=/pci@f4000000/ata-6@d/disk@0:3,/boot/initrd.img root="UUID=b1g-10ng-number-1000" ro
    – rsavage
    Apr 20, 2012 at 18:13
  • 1
    @Oli IIRC insmod has the same name as module-init-tools' insmod, but apart from that it has nothing to do with kernel module loading.
    – Lekensteyn
    Apr 20, 2012 at 19:53
  • 6
    That loads grub modules, not kernel modules.
    – psusi
    Apr 20, 2012 at 22:25
1

Add the module to initrd. There is thread on ServerFault. Refer to the answer that starts with "On a Debian system, you edit /etc/initramfs-tools/modules, and put one mo..."

Are you sure you can't just add your module to /etc/modules? That is the easiest way to go.

4
  • No I can't do that. This is for a workaround for the live CD. I would do what you suggest for the installed system though.
    – rsavage
    Apr 20, 2012 at 18:40
  • Is the alternate installation CD an option? It has a lot lower requirements.
    – jippie
    Apr 20, 2012 at 18:43
  • I want to replace one framebuffer with another. I can stop the default framebuffer from loading from the kernel command line, but I need to load the replacement too.
    – rsavage
    Apr 20, 2012 at 18:50
  • Yeah the alternate is obviously a backup, but I wanted to figure out a way of using the live CD easily.
    – rsavage
    Apr 20, 2012 at 18:51
1

I was having a similar problem, and you might have luck just editing grub to add the break=premount parameter to the end of the kernel line. That will cause the initramfs prompt to appear just after loading the regular kernel modules. Then, if it happens that the additional module you need is already present in your initrd, you can use modprobe to enable it and lsmod to check that it's been enabled (you'll now see it in the list). Then you can run the exit command to allow the boot process to continue. If the additional module that you need isn't already present, then you'll need to follow steps elsewhere on how to add it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .