Software & AppsOperating SystemLinux

How To fix “make: *** [modules] Error 2” when installing rtl8723de driver on Ubuntu 18.04?

Ubuntu 4

In the world of Linux, encountering errors while installing or updating drivers is not uncommon. One such error is “make: *** [modules] Error 2,” which may occur when installing the rtl8723de driver on Ubuntu 18.04. This article provides a step-by-step guide to resolving this issue.

Quick Answer

To fix the "make: *** [modules] Error 2" when installing the rtl8723de driver on Ubuntu 18.04, you need to install the required dependencies, download the correct driver code, modify the driver code, build and install the driver, and load the driver module. These steps will help resolve the error and successfully install the rtl8723de driver.

Understanding the Error

Before diving into the solution, let’s first understand the error. The “make: *** [modules] Error 2” message indicates that there’s an issue with the make command, a utility that automatically builds executable programs and libraries from source code. In this case, the error is likely due to the driver code’s incompatibility with your kernel version or a missing dependency related to the libelf library.


Before you start, ensure you have the following:

  • Ubuntu 18.04 installed and updated
  • Internet connection
  • Access to a terminal window
  • Superuser (root) access

Step-by-Step Guide to Fix the Error

Step 1: Install Required Dependencies

The first step is to install the necessary dependencies. In this case, you’ll need build-essential, dkms, and libelf-dev. The build-essential package contains references for all the packages needed to compile a Debian package. dkms is a framework that helps with the dynamic building of kernel modules. libelf-dev is a library for reading and writing ELF files.

Open your terminal and type the following commands:

sudo apt-get install build-essential dkms
sudo apt-get install libelf-dev

Step 2: Download the Correct Driver

Next, download the correct driver code for your kernel version from the official GitHub page. Make sure to download the correct branch or release that matches your kernel version.

Step 3: Extract and Navigate to the Directory

Once the driver is downloaded, extract the zip file and navigate to the extracted directory. Use the following commands:

cd rtl8723de-<version>

Step 4: Modify the Driver Code

The next step is to modify the driver code. Open the include/osdep_service_linux.h file in a text editor (we’ll use nano for this example):

nano include/osdep_service_linux.h

Locate the line that contains ptimer->data = (unsigned long)cntx; and comment it out by adding // at the beginning of the line. It should now look like this:

// ptimer->data = (unsigned long)cntx;

Save the file and exit the text editor.

Step 5: Build and Install the Driver

You are now ready to build and install the driver. Use the make command to compile the code and make install to install the driver:

sudo make install

Step 6: Load the Driver Module

Finally, load the driver module using the modprobe command:

sudo modprobe rtl8723de


After following these steps, the rtl8723de driver should be successfully installed and loaded on your Ubuntu 18.04 system, and the “make: *** [modules] Error 2” error should be resolved. If you encounter any further issues, you can refer to the GitHub issue mentioned for additional troubleshooting steps. Remember, the Linux community is always there to help you out. Happy computing!

Can I use this guide to fix the “make: *** [modules] Error 2” error on a different Linux distribution?

This guide is specifically tailored for Ubuntu 18.04, and the steps may vary for other Linux distributions. It is recommended to search for a guide specifically for your distribution to ensure compatibility and accuracy.

How do I check my kernel version in Ubuntu 18.04?

You can check your kernel version by opening a terminal and running the command uname -r. This will display the kernel version installed on your system.

What should I do if I encounter an error during the installation of the required dependencies?

If you encounter an error while installing the dependencies, make sure your internet connection is stable and try running the commands again. If the issue persists, you can try updating your package repositories by running sudo apt-get update and then attempt the installation again.

Can I skip modifying the driver code in Step 4?

Modifying the driver code is necessary to resolve the "make: *** [modules] Error 2" error. Skipping this step may result in the error persisting. Make sure to follow the instructions in Step 4 to ensure successful installation.

How can I verify if the rtl8723de driver is loaded and working after installation?

You can verify if the rtl8723de driver is loaded and working by running the command lsmod | grep rtl8723de. If the driver is loaded, you should see its corresponding module listed in the output. Additionally, you can check if your Wi-Fi is working properly after the installation to confirm the driver’s functionality.

Leave a Comment

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