Software & AppsOperating SystemLinux

How To Fix “Error! Could not locate dkms.conf file” During Ubuntu Upgrade

Ubuntu 1

During an Ubuntu upgrade, you may encounter the error message “Error! Could not locate dkms.conf file”. This error is typically caused by modules in /var/lib/dkms that lack a dkms.conf file in their source subdirectories. The dkms system expects this file, and if it’s absent, the error is reported, and some valid modules may not be compiled. This article will guide you through the steps to identify and fix this issue.

Quick Answer

To fix the "Error! Could not locate dkms.conf file" during an Ubuntu upgrade, you can identify the offending module by using a script to check for directories without a dkms.conf file in /var/lib/dkms. Once identified, you have the option to uninstall the package that created it or move/remove the module manually. If these solutions don’t work, you can try checking for newer versions of the module, purging packages causing the problem, reconfiguring packages that use dkms, or deleting/moving out any junk or manually installed packages in the /var/lib/dkms directory. If none of these solutions work, further steps may be necessary, which can be found in the Ubuntu bug report system.

Understanding the Error

Before we dive into the solution, it’s crucial to understand what the error message means. DKMS, or Dynamic Kernel Module Support, is a framework used in Linux to generate Linux kernel modules whose sources generally reside outside the kernel source tree. The dkms.conf file is a key component in this structure, containing the configuration information required to install the module.

When the error “Error! Could not locate dkms.conf file” occurs, it means that the dkms system cannot find this crucial configuration file for one or more modules.

Identifying the Offending Module

The first step in resolving this error is to identify the module causing the problem. For this, we can use a simple script that checks for any dkms module directories without a dkms.conf file.

Here’s the script:

for i in /var/lib/dkms/*/[^k]*/source; do [ -e "$i" ] || echo "$i";done

This script loops through the directories in /var/lib/dkms, checking for the existence of the dkms.conf file in each. If it does not find the file, it prints the directory path to the console.

Resolving the Issue

Once you’ve identified the offending module, you have a few options:

  1. Uninstall the package that created it: If the module was installed by a package, you can uninstall that package using the apt-get remove command.
sudo apt-get remove [package-name]

Replace [package-name] with the name of the package you wish to remove.

  1. Move or remove the module: If the module was manually installed or renamed, you can either move it to another location or remove it entirely.
sudo mv /var/lib/dkms/[module-name] /path/to/new/location

or

sudo rm -r /var/lib/dkms/[module-name]

Replace [module-name] with the name of the module you wish to move or remove, and /path/to/new/location with the new location for the module.

Additional Solutions

If the above solutions do not resolve the issue, you may want to try the following:

  • Check for newer versions of the module: If a newer version of the module is available, you can remove the offending version and install the new one.
  • Purge packages causing the problem and run apt auto-remove: This will remove any unnecessary packages and dependencies.
  • Reconfigure packages that use dkms to force recompilation for the current kernel: This can be done using the dpkg-reconfigure command.
  • Delete or move out any junk or manually installed packages in the /var/lib/dkms directory: This can help if the error is caused by such packages.

If none of these solutions work, you may need to refer to the Ubuntu bug report system for further steps to diagnose and resolve the issue.

Remember, it’s always a good idea to back up your data before making any significant changes to your system. With the right approach, you should be able to resolve the “Error! Could not locate dkms.conf file” error and successfully upgrade your Ubuntu system.

What is DKMS?

DKMS stands for Dynamic Kernel Module Support. It is a framework used in Linux to generate Linux kernel modules whose sources generally reside outside the kernel source tree.

Why am I getting the “Error! Could not locate dkms.conf file” during an Ubuntu upgrade?

This error occurs when the dkms system cannot find the dkms.conf file for one or more modules. This file is crucial for the installation of the module.

How can I identify the module causing the “Error! Could not locate dkms.conf file” error?

You can identify the offending module by using the script provided in the article. The script checks for any dkms module directories without a dkms.conf file and prints the directory paths to the console.

What should I do if the above solutions do not work?

If the above solutions do not work, you can try checking for newer versions of the module, purging packages causing the problem and running apt auto-remove, reconfiguring packages that use dkms to force recompilation for the current kernel, or deleting/moving out any junk or manually installed packages in the /var/lib/dkms directory. If none of these solutions work, you may need to refer to the Ubuntu bug report system for further assistance.

Leave a Comment

Your email address will not be published. Required fields are marked *