How to install Nvidia drivers on Ubuntu 24.04


How to install Nvidia drivers on Ubuntu 24.04. This article explains how to install Nvidia drivers based on open source GPU kernel modules. For data center GPUs in the NVIDIA Turing and NVIDIA Ampere architecture families, open source GPU kernel modules are available.

If you install the Nvidia RTX 5090/80 driver but can’t find the device, you must install the Nvidia open source GPU kernel module together to use it.

ZOTAC GAMING Geforce RTX 5090 AMP EXTREME INFINITY
ZOTAC GAMING Geforce RTX 5090 AMP EXTREME INFINITY

Therefore, in this article, I will explain how to install Nvidia drivers on Ubuntu 24.04 environment based on Nvidia open source GPU kernel module.

1. If the device is not recognized after installing the Nvidia driver

This explains what to do if you install the Nvidia driver in the same way as before, but the nvidia-smi device device cannot be found after installing the driver.

$ nvidia-smi
No devices were found

When I checked the detailed log of /var/log/kern.log, it occurred as follows.

Mar  7 22:41:29 kernel: [   44.537015] NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:2b85)
Mar  7 22:41:29 kernel: [44.537015] NVRM: installed in this system requires use of the NVIDIA open kernel modules.
Mar  7 22:41:29 kernel: [44.537040] NVRM: GPU 0000:01:00.0: RmInitAdapter failed! (0x22:0x56:884)
Mar  7 22:41:29 kernel: [44.538348] NVRM: GPU 0000:01:00.0: rm_init_adapter failed, device minor number 0
Mar  7 22:41:30 kernel: [46.053476] NVRM: The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:2b85)

2. Cause of the problem

The above message means to use NVIDIA open kernel modules. For information about NVIDIA open kernel modules, please refer to the page below.

https://developer.nvidia.com/blog/nvidia-transitions-fully-towards-open-source-gpu-kernel-modules/

First, use the command below to delete files related to the previously installed nvidia driver.

$ sudo apt remove --purge nvidia*
$ sudo apt remove --purge libnvidia*

3. How to install Nvidia drivers on Ubuntu 24.04

Select your hardware and operating system information on the page below to download the installation drivers.

https://www.nvidia.com/en-us/drivers/

In this article, I will explain based on version 570.124.04.

$ sudo apt install pkg-config libglvnd-dev build-essential
$ sudo sh ./NVIDIA-Linux-x86_64-570.124.04.run --no-kernel-modules

Since we will compile and install the kernel module ourselves, we will only install the Nvidia user driver with the above command.

Nvidia Driver Installer
Nvidia Driver Installer


After installing the user driver, we will use the following command to download the source code of the kernel module.

$ git clone https://github.com/NVIDIA/open-gpu-kernel-modules
$ cd open-gpu-kernel-modules

Select the source code with the same tagged version as the downloaded driver using the command below.

open-gpu-kernel-modules$ git checkout 570.124.04

Compile the kernel module using the following command:

open-gpu-kernel-modules$ make modules -j$(nproc)

Then install the kernel module using the command below.

open-gpu-kernel-modules$ sudo make modules_install -j$(nproc)

4. Verify installation

If the driver and kernel module are successfully installed in the above steps, reboot the system to check. If you use the nvidia-smi command, you can check that the driver is successfully installed.

To use Nvidia GPU Cloud, please refer to the article below.

https://hiseon.me/data-analytics/nvidia-gpu-cloud/

nvidia-smi

( 본문 인용시 출처를 밝혀 주시면 감사하겠습니다.)