How to block loading kernel module only in single user boot when blacklist fails?

5,793

Solution 1

Check that your module is not listed in file /etc/modules. This file lists the modules that must be loaded at boot time according to http://www.debian.org/doc/manuals/debian-faq/ch-kernel.en.html#s-modules

When the module name - mpt2sas in this case - is listed in file /etc/modules:

  1. Remove that mpt2sas line or comment it by prepending a hash. Line "mpt2sas" becomes "#mpt2sas".
  2. Update the initramfs image file: depmod -aeF /boot/System.map-$(uname -r) && update-initramfs -u -k $(uname -r) -t
  3. And reboot

Solution 2

Add this to your kernel boot command line (in e.g. Grub, press e and edit the kernel boot parameters):

modprobe.blacklist=mpt2sas

More on this on the Arch wiki.

Share:
5,793
Pro Backup
Author by

Pro Backup

Pro Backup provides backup storage in different locations within Europe for a low price. Starting € 4,72 per month for 98 GiB's of backup space at 2 different locations. Including Code42 "Crashplan Pro" or PROe software for Mac OS X, Windows, Linux or Solaris that automates the process.

Updated on September 18, 2022

Comments

  • Pro Backup
    Pro Backup almost 2 years

    On a "Linux debian 2.6.32-5-amd64 #1 SMP" installation where loading a kernel module (mpt2sas) is desired to be delayed to be loaded after starting sshd and users can remotely login, the mpt2sas module was disabled from loading in single user boot, by:

    $ echo 'blacklist mpt2sas' >> /etc/modprobe.d/mpt2sas.conf; depmod -aeF /boot/System.map-2.6.32-5-amd64; update-initramfs -u -k $(uname -r)
    

    Later on a modeprobe -v mpt2sas will be run in /etc/rc.local.

    After installing a newer mpt2sas driver, using dpkg -i mpt2sas-15.00.00.00-3_Debian6.0.5.amd64.deb the result is that the old driver is renamed from /lib/modules/2.6.32-5-amd64/kernel/drivers/scsi/mpt2sas/mpt2sas.ko to /lib/modules/2.6.32-5-amd64/kernel/drivers/scsi/mpt2sas/mpt2sas.ko.orig and the new driver is installed at /lib/modules/2.6.32-5-amd64/weak-updates/mpt2sas/mpt2sas.ko.

    The side effect is that the line blacklist mpt2sas in /etc/modprobe.d/mpt2sas.conf no longer has any effect, when modules are loaded in the single user boot process, mpt2sas is loaded as first kernel module.

    Regression:

    • I know that /etc/modprobe.d/mpt2sas.conf is still being loaded, because when entering a faulty line in this file, a warning is display at console during boot (4 times).
    • Running depmod -aeF /boot/System.map-2.6.32-5-amd64; update-initramfs -u -k -t $(uname -r); reboot doesn't improve.
    • Adding kernel boot parameter modprobe.blacklist=mpt2sas doesn't improve.

    How can I block loading the new mpt2sas kernel module during the single user boot phase? (I still want to load mpt2sas using modprobe in /etc/rc.local).

    • Admin
      Admin over 11 years
      I’m not sure what exactly init system do you use, but in OpenRC you can configure a service named ‘local’ through /etc/conf.d/local and define there functions local_start and local_stop, put your modprobe line in local_start then move local service to desired position, e.g. if your sshd is running at runlevel ‘boot’ place ‘local’ to default runlevel with your rc-script managing utility (rc-update, update-rc.d or something), or specify sshd in need dependencies for ‘local’ service in rc.conf (there are many examples).
    • Admin
      Admin over 11 years
      @Nils The OS was hidden in the driver name, mpt2sas-15.00.00.00-3_Debian6.0.5.amd64.deb. I will add OS and version more explicitly to the base question.
    • Admin
      Admin over 11 years
      Is this question of yours not about just the same?
    • Admin
      Admin over 11 years
      @Nils That question is not about the same. That question is about installing a newer driver. This question is about blocking it from loading in single user boot mode, after having loaded that newer mpt2sas driver version.
    • Admin
      Admin over 11 years
      @tijagi How can I find (on Debian 6.0.6) which init system exactly I do use?
    • Admin
      Admin over 11 years
      @pro-backup, the simpliest way is to check your root shell whether it has rc-update or update-rc.d available. The first one is from openrc and the second comes with sysvinit.
    • Admin
      Admin over 11 years
      @pro-backup you’re definitely on a right way.
  • Pro Backup
    Pro Backup over 11 years
    This kernel parameter modprobe.blacklist=mpt2sas does not change the loading of the /weak-updates/mpt2sas.ko module during boot in our case.
  • gertvdijk
    gertvdijk over 11 years
    facepalm - this must have been too obvious to have overlooked! Anyway, you have edited the /etc/modules file yourself, probably.
  • Pro Backup
    Pro Backup over 11 years
    @gertvdijk For a Linux novice nothing is obvious at all.