Unloading of modules at boot time in Debian

Published on 2011-02-12.

Loading modules automatically at boot time is easy in Debian: you just add the modules to /etc/modules

But what if you have to unload a module before loading it?

You can blacklist a module using /etc/modprobe.d/blacklist.conf, but blacklisting a module means that it wont load at all.

If for example you are running with an Intel AC'97 audio card you might need to unload the module before loading it in order to get the sound working using the right module options.

Doing this manually would look like this:

# modprobe -r snd-intel8x0
# modprobe snd-intel8x0 ac97_quirk=1 xbox=1

You can make these commands work in /etc/modules too because /etc/modules also takes options.

Hence the above commands would look like this in /etc/modules:

-r snd-intel8x0
snd-intel8x0 ac97_quirk=1 xbox=1

That's it!