Manually Install Driver Module in Linux

This tutorial intends to teach you to Install the Driver Module in Linux Manually.

Simply put, a driver module is a kind of software needed to communicate with hardware components. In this guide, we want to manually show you a complete installation of the driver module in Linux.

Steps To Manually Install Driver Module in Linux

To complete this guide, you must have access to your server as a root or non-root user with sudo privileges. Then, follow the steps below to complete this guide by using the Linux Commands.

Step 1 – List All Linux Kernel Modules or Drivers

First, you can use the following command to see your current Linux kernel drivers:

ls /lib/modules/$(uname -r)

You will get something similar to this in your output:

Output
build              modules.builtin.alias.bin  modules.order
initrd             modules.builtin.bin        modules.softdep
kernel             modules.builtin.modinfo    modules.symbols
modules.alias      modules.dep                modules.symbols.bin
modules.alias.bin  modules.dep.bin            vdso
modules.builtin    modules.devname

Then, you can run the following command to list all Linux driver modules for various devices:

ls /lib/modules/$(uname -r)/kernel/drivers/

In your output, you will see:

Output
accessibility  cpuidle   hsi         mcb       nvme       rpmsg        uio
acpi           crypto    hv          md        nvmem      rtc          usb
android        cxl       hwmon       media     parport    scsi         vdpa
ata            dax       hwtracing   memory    pci        siox         vfio
atm            dca       i2c         memstick  pcmcia     slimbus      vhost
auxdisplay     dma       i3c         message   phy        soc          video
base           edac      iio         mfd       pinctrl    soundwire    virt
bcma           extcon    infiniband  misc      platform   spi          virtio
block          firewire  input       mmc       power      spmi         visorbus
bluetooth      firmware  iommu       most      powercap   ssb          vme
bus            fpga      ipack       mtd       pps        staging      w1
char           gnss      irqchip     mux       ptp        target       watchdog
clk            gpio      isdn        net       pwm        tee          xen
comedi         gpu       leds        nfc       rapidio    thermal
counter        greybus   macintosh   ntb       regulator  thunderbolt
cpufreq        hid       mailbox     nvdimm    reset      tty

Step 2 – Update Drivers on Linux using Terminal

You can update your Linux drivers to fix security, and errors, and sometimes even add features to the hardware.

To do this, you can easily run the system update by using your Linux package manager to update your drivers.

On Ubuntu / Debian, you can run the system update with the command below:

# sudo apt update
# sudo apt upgrade

On Centos 7 / RHEL 7, you can use the following command:

# sudo yum update -y
# sudo yum upgrade -y

And you can use the command below on AlmaLinux / Rocky Linux / RHEL 8 and 9:

# sudo dnf update -y
# sudo dnf upgrade -y

Step 2 – Are Drivers Automatically Installed in Linux?

When you connect a device to your Linux system, a device file will be created in the /dev directory. Most of the driver modules are available in your system. But for some of them, you need to install driver modules manually in your Linux distro.

Step 3 – How To Install Missing Driver Module in Linux?

Before you start to install a driver, you need to be sure whether the driver is already available on your system or not. To do this, you can use the following Linux commands:

# lscpci | grep driver-name
Or
# dmesg | grep driver-name

In your output, if the driver exists, you will get the results.

If you get nothing in your output, you need to find out if the driver is at least loaded on the disk by using the command below:

# /sbin/lsmod
Or
# find /lib/modules

Load Linux Driver Module

If a driver is found by these commands but not by the lscpi or dmesg commands, it means the driver is on the disk but not in the kernel. In this case, you need to load the module with the modprobe command:

modprobe module-name

Add Repository and Install Driver Module in Linux

At this point, you can use the package manager of your Linux distro like apt, yum, and dnf to add the driver repository and install it. Here we use apt and it is the same as other options.

If the driver repository exists on your Linux system, delete it with the command below:

apt purge driver-name

Then, add your driver repository with the command below:

add-apt-repository driver-repolist

Note: driver-repolist should be specified in the driver documentation. 

Finally, update your system and install your Linux driver with the command below:

# apt update
# apt install driver-name

How do you check if all drivers are installed in Linux?

You can verify your Linux driver installation, by using the commands below:

# lscpci | grep driver-name
Or
# dmesg | grep driver-name

Conclusion

At this point, you have learned to Install the Driver Module in Linux Manually. As you saw, you can easily list your all available Linux kernel modules and install missing drivers, load the modules, and install them.

Hope you enjoy it. You may be interested in these articles:

Install build-essential on Ubuntu 22.04

Fix error Group ‘development-tools’ is not available

Fix modulenotfounderror: no module named ‘distutils’

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular