[KUbuntu 22.04 - iGPU + dGPU] Driver installation procedure

Dear All,

after some troubles, I think I’ve solved.

Here are all the steps for my configuration:


Apt required’s packages

sudo apt-get install -y --no-install-recommends \
   pkg-config \
   make \
   gcc \
   g++ \
   linux-headers-$(uname -r)

Installing driver using .run file

nvdriver=525.125.06
curl -fsSLO https://download.nvidia.com/XFree86/Linux-x86_64/$nvdriver/NVIDIA-Linux-x86_64-$nvdriver.run
chmod +x NVIDIA-Linux-x86_64-$nvdriver.run

Blacklist nouveau

echo blacklist nouveau | tee -a /etc/modprobe.d/blacklist-nvidia-nouveau.conf
echo options nouveau modeset=0 | tee -a /etc/modprobe.d/blacklist-nvidia-nouveau.conf
sudo update-initramfs -u

Driver installation

The thing that let my system work, is using --m=kernel-open option.
More info on these links:

sudo service sddm stop && init 3;
sudo ./NVIDIA-Linux-x86_64-$nvdriver.run \
   --no-opengl-files \
   --no-wine-files \
   --dkms \
   --m=kernel-open

then enable NVreg_OpenRmEnableUnsupportedGpus open kernel module option:

sudo echo options nvidia NVreg_OpenRmEnableUnsupportedGpus=1 | tee -a /etc/modprobe.d/nvidia.conf

Let X11 driven from Intel / Integrated GPU only

Copy the following inside /etc/X11/xorg.conf

Section "ServerLayout"
   Identifier "layout"
   Screen 0 "intel"
EndSection

Section "Device"
   Identifier "intel"
   Driver "modesetting"
   BusID "PCI:0:2:0"
   Option "AccelMethod" "SNA"
EndSection

Section "Screen"
   Identifier "intel"
   Device "intel"
EndSection

Enable persistenced Daemon

From this link, you can initialize NVIDIA GPU and keep it enable even if there isn’t any X11 instance connected to it; this is available thanks to nvidia persistenced daemon.

Using systemctl, you can enable this daemon just creating this file inside /etc/systemd/system:

[Unit]
Description=NVIDIA Persistence Daemon
Wants=syslog.target

[Service]
Type=forking
ExecStart=/usr/bin/nvidia-persistenced --user %HERE-PUT-YOUR-USERNAME%
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced
[Install]
WantedBy=multi-user.target

and enable it

chmod +x /etc/systemd/system/nvidia-persistenced.service
systemctl reenable nvidia-persistenced.service

Test Setup

Check if everything works in this way: nvidia-smi
and the output should be:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.125.06   Driver Version: 525.125.06   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
| 50%   33C    P8    N/A /  75W |      6MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

That’s all
Nicola

1 Like