Skip to content

GPU - NVIDIA Drivers - Ubuntu Desktop

Installation

From an Ubuntu desktop, download the latest version of the NVIDIA drivers from the Google repository, for Linux-based operating systems.

Start the desktop with the SPICE viewer.

In the terminal, run the following command:

sudo apt update
sudo apt install build-essential libglvnd-dev pkg-config

Configure the desktop so that it does not detect the "nouveau" driver, as it prevents the installation from completing correctly:

sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"

Check that the file contains the following text:

cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf 

Regenerate initramfs:

sudo update-initramfs -u

Restart the desktop with sudo reboot.

Return to the terminal and run:

sudo telinit 3

A full-screen terminal opens. Log in with the desktop credentials and go to the directory where the drivers were downloaded.

Run the following commands:

sudo bash NVIDIA-Linux-x86_64-525.105.17-grid.run

Follow these steps:

Restart the desktop with sudo reboot.

Error Building Kernel Modules

If an error appears in building kernel modules when installing the drivers, install the dependencies and the following compiler:

sudo apt install build-essential libglvnd-dev pkg-config dkms linux-headers-$(uname -r) gcc-12 -y

Restart the desktop with sudo reboot and reinstall the drivers with the compilation flag:

sudo CC=gcc-12 bash NVIDIA-Linux-x86_64-525.105.17-grid.run
Errors during the process

During installation, several errors may occur. The most common one is that the graphical interface does not work.

Solution: inside the SPICE viewer, press Ctrl+Alt+F6 from the special keys index of the top-left menu.

A terminal opens. Log in with the desktop credentials and run sudo reboot. This restarts the graphical interface and allows logging in again as usual.

Before starting it again, in the desktop edit form, leave Videos at Default, choose one of the profiles available on the platform in vGPU and click Save changes.

When it is started again, the NVIDIA Settings program is available:

License client

The process is performed using a token, a file that is generated once a CLS license server is configured on the NVIDIA licensing platform.

The token must be moved to the desktop exactly as it is downloaded. Copying its content and creating a new file on the desktop does not work: the file (with the .tok extension) contains data that cannot be regenerated by copying and pasting the encrypted code inside it. It can be moved with the SPICE viewer, by dragging the file from the host computer to the Ubuntu viewer. If dragging is not available, a USB drive with the .tok file can be used to copy it directly from there. SPICE may not work correctly with the "Only GPU" video; in that case, change the video, download the file and set "Only GPU" again once the file is in place.

Move the token to the /etc/nvidia/ClientConfigToken directory and change its permissions:

sudo mkdir ClientConfigToken
sudo mv client_configuration_token_*.tok /etc/nvidia/ClientConfigToken/
sudo chmod 744 /etc/nvidia/ClientConfigToken/client_configuration_token_*.tok

If the gridd.conf file does not exist, create it from the gridd.conf.template file (no content modification is required):

sudo cp gridd.conf.template gridd.conf

Start the service and, in the terminal, type the following command:

nvidia-smi -q

Scroll down to find the following section. If License Status shows Licensed with an expiration date, the Ubuntu client license is correct.

vGPU Software Licensed Product
        Product Name                      : NVIDIA RTX Virtual Workstation
        License Status                    : Licensed (Expiry: 2023-5-25 12:53:35)
Error Unlicensed

The command nvidia-smi -q shows the license as Unlicensed because the installer does not register the license daemon in the Ubuntu service system. To fix this, manually create the configuration file and the systemd service, adding a delay to allow the virtual machine's network to be ready at startup.

  1. Create the system service: Run sudo nano /lib/systemd/system/nvidia-gridd.service and paste the following content:
[Unit]
Description=NVIDIA Grid Daemon
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/nvidia-gridd
Restart=on-failure
RestartSec=15

[Install]
WantedBy=multi-user.target
  1. Load and enable the service:
sudo systemctl daemon-reload
sudo systemctl enable systemd-networkd-wait-online.service
sudo systemctl enable nvidia-gridd
sudo systemctl start nvidia-gridd
  1. Final verification: After restarting or starting the desktop, wait approximately one minute to allow the service to start and contact the license server.

Check the license:

nvidia-smi -q | grep License # "Licensed..." should appear