Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am automating some configurations on my systems using Puppet (however, that is not really relevant here). For a group of machines I want to load a kernel module at boot time. The most elegant way seems to edit /etc/modules and add one on an individual line. However, I would like to use separate files in a ".d" directory structure for easier maintainability, rather than having Puppet editing a file.

For modprobe and specifying the options for or blacklisting modules, there's /etc/modprobe.d/, but what's the most elegant way for actually loading modules at boot time using a single new file? Basically, I'm looking for the non-existing /etc/modules.d/ directory.

Any suggestions?

share|improve this question
up vote 2 down vote accepted

The directory you are looking for is


For example, to always load the nf_conntrack_pptp kernel module, add nf_conntrack_pptp to /etc/modules-load.d/pptp.conf. The filename doesn't matter, but I'm guessing the convention or requirement is that it ends in .conf.

This is implemented for older Ubuntu versions (without systemd) using a SysVinit script in /etc/init.d/kmod. For newer systemd-versions (15.04+), systemd handles this. Read the documentation man 5 modules-load.d.

share|improve this answer
Thanks! This appears to be a systemd-thing, though. So this will only work in the very recent Ubuntu releases (15.04+). See also this Q&A on Unix.SE: What's the difference of /etc/modules-load.d and /etc/modules? – gertvdijk Feb 23 at 13:22
/etc/modules-load.d works for me on Ubuntu 14.04.3 LTS 64-bit desktop, but I don't recall ever installing systemd... maybe there's some kind of systemd/upstart bridge in 14.04? – Adam Monsen Feb 23 at 18:34
You're right! It's /etc/init.d/kmod which comes from Debian, working with SysVinit too. Upstart runs it too. Great! I can improve your answer and accept it I guess. – gertvdijk Feb 23 at 19:55

You should be able to put additional .conf files in /etc/modprobe.d/ to do module loading as well (even though the default files in there are all about blacklisting things).

You may be able to just put the module name on a line by itself, or if you need more complex behaviour, you can use 'install' at the beginning of a line. From the manpage:

install modulename command...
    This is the most powerful primitive: it tells modprobe to run your command 
    instead of inserting the module in the kernel as normal.

share|improve this answer
Are you sure about that "to do module loading as well"? Does not seem to work for me. I've put a file in /etc/modprobe.d/mymodule.conf containing one line acpiphp, but the module isn't loaded on reboot. Same when prepending it with install. Additionally, when modprobing manually, now getting warnings: WARNING: /etc/modprobe.d/mymodule.conf line 1: ignoring bad line starting with 'acpiphp' – gertvdijk Dec 12 '12 at 20:49
I'm not sure about putting it on a line by itself, but I'm positive that you can load modules using a line that starts with "install". – ImaginaryRobots Dec 12 '12 at 21:03
Nope, as I said, same when prepending with install: WARNING: /etc/modprobe.d/mymodule.conf line 1: ignoring bad line starting with 'install' – gertvdijk Dec 12 '12 at 21:07
you might have to write your own startup script, at that point. – ImaginaryRobots Dec 13 '12 at 22:05

When using a file in /etc/modules.d directory you have to use install directive.

Since "install" is expecting [module_name] [command]

install your_module /bin/true

will do the trick ;)

share|improve this answer
Thanks, I'll try it out and let you know. Do you have any source for this? The only source I find using Google on modules.d install is your answer (rest of the results is irrelevant noise). – gertvdijk Dec 31 '13 at 0:05
Didn't work for me. – Adam Monsen Feb 23 at 7:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.