I don’t know how many times I have had to deal with the situation where a system requires some module that is built separately from the kernel tree (such as OpenAFS and NVIDIA drivers) and a kernel upgrade is installed either automatically or as part of an upgrade set, leaving a surprise for the next reboot when the module for the new kernel version does not exist. (Other Debian users have reported similar gripes.)
I came up with the following solution. It uses module-assistant to automatically build every kernel module package whose source is currently unpacked in /usr/src/modules.
First, install module-assistant: apt-get install module-assistant
Then, download the linked file autobuild-modules.sh, then chmod +x autobuild-modules.sh
. Move it to /usr/local/bin
or some other directory in the system’s path.
Then you will edit /etc/kernel-img.conf
and add the following line:
header_postinst_hook = /usr/local/bin/autobuild-modules.sh
(Alternately, if you have a /etc/kernel/header_postinst.d/
directory, you can just drop the autobuild-modules.sh
into that directory, again ensuring that it is marked executable.)
Now, whenever a linux-headers package is installed, all kernel modules will automatically be built and installed for that kernel version. If the build fails, it will send mail to the administrator.
Cool, thanks! I recently switched back to Debian after three years on Ubuntu, and this was the one thing annoying me. I wonder why something like this isn’t included directly in Debian (or at least, as an installable package).
Now to wait for the next kernel upgrade to verify if it works. 😉
Try installing dkms, most modules support it now. You might have to install a foo-dkms package for whatever module you want to build with dkms.