How to block loading kernel module only in single user boot when blacklist fails?
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
:
- Remove that mpt2sas line or comment it by prepending a hash. Line "
mpt2sas
" becomes "#mpt2sas
". - Update the initramfs image file:
depmod -aeF /boot/System.map-$(uname -r) && update-initramfs -u -k $(uname -r) -t
- 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.
![Pro Backup](https://i.stack.imgur.com/ICBcn.png?s=256&g=1)
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, 2022Comments
-
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 over 11 yearsI’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
andlocal_stop
, put your modprobe line in local_start then movelocal
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 inneed
dependencies for ‘local’ service in rc.conf (there are many examples). -
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 over 11 yearsIs this question of yours not about just the same?
-
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 over 11 years@tijagi How can I find (on Debian 6.0.6) which init system exactly I do use?
-
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 over 11 years@pro-backup you’re definitely on a right way.
-
Pro Backup over 11 yearsThis kernel parameter
modprobe.blacklist=mpt2sas
does not change the loading of the /weak-updates/mpt2sas.ko module during boot in our case. -
gertvdijk over 11 yearsfacepalm - this must have been too obvious to have overlooked! Anyway, you have edited the
/etc/modules
file yourself, probably. -
Pro Backup over 11 years@gertvdijk For a Linux novice nothing is obvious at all.