I want to load my kernel module hello.ko on boot in Ubuntu 12.04. I placed it in /lib/modules/3.8.0-31-generic/kernel/ubuntu/hello.ko, ran depmod -a, and added "hello" to /etc/modules.

However, when I restart, there is no "hello" module in lsmod. In /var/log/upstart/module-init-tools.log there is a string "FATAL: Module hello not found."

If I run modprobe hello everything is fine. What's wrong with /etc/modules? Where is it trying to find modules?


Run sudo update-initramfs -u to get your module in the initial ramdisk for the current kernel. Otherwise it will not load on init.

  • 2
    This is not necessary. Modules listed in /etc/modules are loaded on init (from the kmod job, which runs once udev is up). – Gilles Aug 9 '14 at 20:07
  • @Gilles It is necessary. If the module does not exist in the initrd, then init can obviously not load it when it has not yet mounted any filesystems. – Lekensteyn Aug 10 '14 at 11:51
  • 2
    You're confusing the /init script in the initramfs and the init system which is Upstart. The initramfs doesn't even contain /etc/modules, that's part of the root filesystem. There's an Upstart job (kmod) that loads modules listed in /etc/modules. This happens after the root filesystem is mounted, it has nothing to do with the initramfs. – Gilles Aug 10 '14 at 19:53
  • Can you doublecheck if the running kernel is the correct version with the path you placed the module with uname -r. Please also check the output of modinfo /lib/modules/3.8.0-31-generic/kernel/ubuntu/hello.ko. – Thomas Jun 26 '16 at 14:48
  • @Gilles You were right, kmod loads the module after the rootfs is mounted. Since /etc/modprobe.d/ did end up in the initramfs I supposed that it would also be the case for /etc/modules which is apparently not true. – Lekensteyn Jun 27 '16 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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