Are you using Arch Linux? And you are seeing modules all over the place for all kinds of crazy hardware you don’t even own? Then you’ve come to the right place!
First a word of reassurance: the modules loaded will not slow down your system at all, you will only waste several hundred kilobytes of RAM. But the output of lsmod does look nicer without the modules, and the system boots a little faster without them. But beyond these considerations there is very little to be gained in terms of speed during normal operation, by making the modules disappear ;-)
Think back to when you installed Arch. At some point during the installation you may have been asked to edit a few configuration files, but we are interested in one file in particular: mkinitrd.conf
The mkinitrd.conf file is the configuration file used by the program mkinitrd, which is short for “make initial ramdisk”. I am not going to complicate matters by explaining why you need a ramdisk, but if you’re going to use one anyway, it might just as well be optimized, right?
NOTE! ==> Editing the ramdisk may render your system unbootable, so it is wise to make a fallback entry in /boot/grub/menu.lst that uses the image called /boot/initrd26-full.img This ramdisk image will load every module it can and thus ensures that you will allways be able to boot your system in case you make a big mistake when modifying the normal /boot/initrd26.img
Right, now let’s start with the tweaking:
- Open /etc/mkinitrd.conf read the comments and then disable all the subsystems, except the subsystem you need. You need IDE if you got an ide disk. You need SATA if you got a sata disk. Need I go on? The only subsystem you must NEVER disable (unless you know what you are doing) is the filesystem subsystem. So DISABLE_FS=1 would be a VERY big mistake. Don’t do it! Don’t even look at it! Promise? Splendid! Indeed. Well, why don’t you move on to step #2.
- The next option is AUTODETECT. It is experimental but don’t let that fool you, it works just fine. You enable it like this: AUTODETECT=1 And now you may proceed to step #3.
- I also found it necessary to specify the filesystem I use, to prevent the ramdisk from loading modules for XFS, ReiserFS and JFS (I only use Ext3). This is accomplished by configuring the FILESYSTEMS option like this: FILESYSTEMS=(“ext3”). You will no doubt be clever enough to figure out that you need to specify what filesystem you are using instead of blindly copying my example. Now you can save mkinitrd.conf and close the editor.
- Finally, we execute the command mkinitrd auto –show in order to create and install the new ramdisk
And that’s really all there is to it. Simple, isn’t it? Quickly reboot and see what a difference this makes! Now that you’ve taken care of a veritable the maelstrom of filesystems and hostcontrollers, things should look a lot cleaner. But there may still be a couple of other modules you want to prevent from loading (such as the pcspkr module which enables the annoying pc-speaker). If you want to do that, you need to open /etc/rc.conf in an editor and add modules you don’t want to see in the output of lsmod to the MOD_BLACKLIST=() array. This is what I have in my array, for example:
MOD_BLACKLIST=(pcspkr joydev gameport) If you are not sure whether you need a module, just google for it, or experiment with putting it on the blacklist.
Good luck and have fun!