Skip to content

Commit 74ca9d7

Browse files
authored
Merge pull request #119354 from gjolly/ubuntu_nvidia_drivers
Use NVIDIA drivers from Ubuntu
2 parents 1a0b7f3 + 8c36a9f commit 74ca9d7

File tree

1 file changed

+24
-111
lines changed

1 file changed

+24
-111
lines changed

articles/virtual-machines/linux/n-series-driver-setup.md

Lines changed: 24 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -47,131 +47,44 @@ Then run installation commands specific for your distribution.
4747

4848
### Ubuntu
4949

50-
1. Download and install the CUDA drivers from the NVIDIA website.
51-
> [!NOTE]
52-
> The example shows the CUDA package path for Ubuntu 20.04. Replace the path specific to the version you plan to use.
53-
>
54-
> Visit the [NVIDIA Download Center](https://developer.download.nvidia.com/compute/cuda/repos/) or the [NVIDIA CUDA Resources page](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network) for the full path specific to each version.
55-
>
56-
```bash
57-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
58-
sudo dpkg -i cuda-keyring_1.0-1_all.deb
59-
sudo apt-get update
60-
sudo apt-get -y install cuda-drivers
61-
62-
```
63-
64-
The installation can take several minutes.
65-
66-
2. Reboot the VM and proceed to verify the installation.
67-
68-
#### CUDA driver updates
69-
70-
We recommend that you periodically update CUDA drivers after deployment.
71-
72-
```bash
73-
sudo apt-get update
74-
sudo apt-get upgrade -y
75-
sudo apt-get dist-upgrade -y
76-
sudo apt-get install cuda-drivers
77-
78-
sudo reboot
79-
```
80-
81-
#### Install CUDA driver on Ubuntu with Secure Boot enabled
82-
83-
With Secure Boot enabled, all Linux kernel modules are required to be signed by the key trusted by the system.
84-
85-
1. Install pre-built Azure Linux kernel based NVIDIA modules and CUDA drivers
50+
Ubuntu packages NVIDIA proprietary drivers. Those drivers come directly from NVIDIA and are simply packaged by Ubuntu so that they can be automatically managed by the system. Downloading and installing drivers from another source can lead to a broken system. Moreover, installing third-party drivers requires extra-steps on VMs with TrustedLaunch and Secure Boot enabled. They require the user to add a new Machine Owner Key for the system to boot. Drivers from Ubuntu are signed by Canonical and will work with Secure Boot.
8651

52+
1. Install `ubuntu-drivers` utility:
8753
```bash
88-
sudo apt-get update
89-
sudo apt install -y linux-modules-nvidia-525-azure nvidia-driver-525
54+
sudo apt update && sudo apt install -y ubuntu-drivers-common
9055
```
91-
92-
2. Change preference of NVIDIA packages to prefer NVIDIA repository
93-
56+
2. Install the latest NVIDIA drivers:
9457
```bash
95-
sudo tee /etc/apt/preferences.d/cuda-repository-pin-600 > /dev/null <<EOL
96-
Package: nsight-compute
97-
Pin: origin *ubuntu.com*
98-
Pin-Priority: -1
99-
Package: nsight-systems
100-
Pin: origin *ubuntu.com*
101-
Pin-Priority: -1
102-
Package: nvidia-modprobe
103-
Pin: release l=NVIDIA CUDA
104-
Pin-Priority: 600
105-
Package: nvidia-settings
106-
Pin: release l=NVIDIA CUDA
107-
Pin-Priority: 600
108-
Package: *
109-
Pin: release l=NVIDIA CUDA
110-
Pin-Priority: 100
111-
EOL
58+
sudo ubuntu-drivers install
11259
```
113-
114-
3. Add CUDA repository
115-
116-
```bash
117-
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/3bf863cc.pub
118-
```
119-
120-
```bash
121-
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/ /"
122-
```
123-
124-
where `$distro/$arch` should be replaced by one of the following:
125-
126-
```
127-
ubuntu2004/arm64
128-
ubuntu2004/x86_64
129-
ubuntu2204/arm64
130-
ubuntu2204/x86_64
131-
```
132-
133-
If `add-apt-repository` command is not found, run `sudo apt-get install software-properties-common` to install it.
134-
135-
4. Install kernel headers and development packages, and remove outdated signing key
136-
137-
```bash
138-
sudo apt-get install linux-headers-$(uname -r)
139-
sudo apt-key del 7fa2af80
140-
```
141-
142-
5. Install the new cuda-keyring package
143-
144-
```bash
145-
wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.1-1_all.deb
146-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
147-
```
148-
149-
Note: When prompt on different versions of cuda-keyring, select `Y or I : install the package maintainer's version` to proceed.
150-
151-
6. Update APT repository cache and install NVIDIA GPUDirect Storage
152-
60+
3. Download and install the CUDA toolkit from NVIDIA:
61+
> [!NOTE]
62+
> The example shows the CUDA package path for Ubuntu 22.04 LTS. Replace the path specific to the version you plan to use.
63+
>
64+
> Visit the [NVIDIA Download Center](https://developer.download.nvidia.com/compute/cuda/repos/) or the [NVIDIA CUDA Resources page](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network) for the full path specific to each version.
65+
>
15366
```bash
154-
sudo apt-get update
155-
sudo apt-get install -y nvidia-gds
67+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
68+
sudo apt install -y ./cuda-keyring_1.1-1_all.deb
69+
sudo apt update
70+
sudo apt -y install cuda-toolkit-12-3
15671
```
15772

158-
Note that during the installation you will be prompted for password when configuring secure boot, a password of your choice needs to be provided and then proceed.
159-
160-
![Secure Boot Password Configuration](./media/n-series-driver-setup/secure-boot-passwd.png)
161-
162-
7. Reboot the VM
73+
The installation can take several minutes.
16374

75+
4. Verify that the GPU is correctly recognized:
16476
```bash
165-
sudo reboot
77+
nvidia-smi
16678
```
16779

168-
8. Verify NVIDIA CUDA drivers are installed and loaded
80+
#### NVIDIA driver updates
16981

170-
```bash
171-
dpkg -l | grep -i nvidia
172-
nvidia-smi
173-
```
82+
We recommend that you periodically update NVIDIA drivers after deployment.
17483

84+
```bash
85+
sudo apt update
86+
sudo apt full-upgrade
87+
```
17588

17689
### CentOS or Red Hat Enterprise Linux
17790

0 commit comments

Comments
 (0)