The Kernel Module Compiler
In Ubuntu, DKMS (Dynamic Kernel Module Support) is a framework designed to ensure that third-party kernel modules remain functional across kernel upgrades. When you install a proprietary driver (like an NVIDIA graphics driver, a Broadcom Wi-Fi driver, or specialized virtualization tools), it must be compiled against your specific Linux kernel version. If Ubuntu runs a background system update and installs a newer kernel, those proprietary drivers will break on the next reboot. The dkms.service runs during the boot process (or during package installation) to automatically recompile these third-party modules for the new kernel, ensuring your hardware continues to work seamlessly.
While DKMS is a lifesaver for desktop users with proprietary hardware, it is often unnecessary—and occasionally problematic—on strictly controlled servers. If you are running a headless web server, a database instance, or a container node that relies entirely on native, in-tree open-source drivers, DKMS has nothing to compile. The service will simply run, check for modules, find none, and exit. In environments where boot time optimization is critical, or where kernel updates are managed manually via strict image deployments (meaning you don’t want automated compilation happening on the live server), disabling the DKMS service is a standard hardening step.
How to Disable the Dkms Service
You can permanently prevent the dynamic kernel module compiler from initializing using standard systemctl commands.
- Open your Ubuntu Terminal (or SSH into your server).
- To disable the service so it does not load during the boot sequence, run:
sudo systemctl disable dkms.service
- To ensure that package updates (or dependent driver installations) cannot accidentally trigger the service to start up in the background, you must mask it:
sudo systemctl mask dkms.service
The system will now ignore the DKMS daemon. (Note: Do not do this if your server relies on proprietary out-of-tree drivers, such as NVIDIA GPUs for CUDA processing, or you will lose hardware functionality after the next kernel update).