Occasionally, my system gets into a state where some kernels are missing a module or two, because DKMS somehow forgot to compile those modules for that kernel. Rather than spend time diagnosing the problem, it would be nice if there was a single command I could run that woudl just rebuild every dkms-controlled module for every installed kernel. Is there such a command?
Kernel Kernel-Modules DKMS – Command to Rebuild All DKMS Modules for All Installed Kernels
dkmskernelkernel-modules
Related Question
- Kernel – Building a New Vanilla Kernel and Handling Produced Debs
- Ubuntu – Dkms: rebuild kernel module for manually installed upstrem kernel
- Kernel – Empty Build Directory in Custom Compiled Kernel
- Ubuntu – dkms does not automatically rebuild after kernel upgrade
- Ubuntu – Is zfs-dkms required for ZFS support in generic kernels
Best Answer
I figured out a shell one-liner to do it:
This works because the names of the directories in
/var/lib/initramfs-tools
are exactly the kernel version names that you need to pass todkms_autoinstaller
to tell it to rebuild all modules for those kernel versions. Note that if you have uninstalled some old kernels, their directories might still be lying around and cause some errors to be reported, but this isn't a problem becausedkms_autoinstaller
will just do nothing for those kernel versions that aren't installed.