[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Option to blacklist modules for d-i and installed system



We sometimes see that a module that is automatically loaded causes 
problems, either because of a bug or because of a driver conflict.

Therefore, it would be nice to be able to have a generic facility to 
blacklist modules for the installer and to have those carried over into 
the installed system.

I propose to implement something like the patch below to rootskel.
Note that debconf cannot be used as the blacklisting needs to happen 
_before_ udev is run for the first time.
Patch has been tested and seems to work nicely.

Current format is "blacklist=module1,module2".
Alternative formats could be "module.blacklist" or "module.off" (possibly 
a bit harder to implement).
A last option could be "module.blacklist=yes", which is probably most 
consistent with "module.param=value".

I have not checked if the parameter accidentally ends up in e.g. grub 
config. It should be possible to avoid that. The last alternative format 
is least likely to cause problems in that respect.

Copying the resulting blacklist.local file into /target would be done in a 
post-base-installer.d hook script.


While working on this I noticed a fairly structural issue.
The module-init-tools udeb still contains an /etc/modprobe.conf, which 
means that anything under /etc/modprobe.d/ gets ignored. But the udev 
udeb _does_ contain a few files in /etc/modprobe.d/.
Marco is going to fix module-init-tools, but that means we may see some 
changes in behavior in d-i as a result.
Despite the slight risk, I still feel that this should be done.

Cheers,
FJP


Index: src/lib/debian-installer-startup.d/S02module-params
===================================================================
--- src/lib/debian-installer-startup.d/S02module-params (revision 43884)
+++ src/lib/debian-installer-startup.d/S02module-params (working copy)
@@ -1,16 +1,26 @@
 # Before udev is started, parse kernel command word for module params of
 # the form module.param=value and register them so they will be used when
-# modules are loaded.
+# modules are loaded. Also check for modules to be blacklisted.
+
 for word in $(cat /proc/cmdline); do
        var="${word%=*}"
        val="${word#[!=]*=}"
        # grep out the normal variables with no dots
        varnodot="${var##*.*}"
+
        if [ "$var" != "" ] && [ "$varnodot" = "" ]; then
                module="${var%.*}"
                param="${var#[!.]*.}"
                if [ "$module" != "" ] && [ "$param" != "" ]; then
                        register-module -p -a "$module" "$param=$val"
                fi
+       elif [ "$var" = blacklist ] && [ -d /etc/modprobe.d ]; then
+               echo "# Modules blacklisted during installation" \
+                       >/etc/modprobe.d/blacklist.local
+               # We need comma-separation
+               for module in $(echo $val | sed 's/,/ /g'); do
+                       echo "blacklist $module" \
+                               >>/etc/modprobe.d/blacklist.local
+               done
        fi
 done

Attachment: pgp6w5MJooT4_.pgp
Description: PGP signature


Reply to: