Cannot install NVIDIA drivers for lowlatency kernel
https://askubuntu.com/questions/1564909/cannot-install-nvidia-drivers-for-lowlatency-kernel
Background
I am using an Ubuntu system (24.04.4 LTS) to develop Psychtoolbox code, a common tool used in the vision sciences to present stimuli in a controlled and precise way. The system has two displays. One is used to show the visual stimuli for demonstration purposes during development, the other is used for coding etc.
The machine has a GPU, GeForce GTX 1070. I would like to install the NVIDIA drivers to operate the graphics card for improved performance. Unfortunately, however, the proprietary drivers cannot be installed, i.e., nvidia-smi returns:
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
A peculiarity about this case is that I succeeded at installing the driver for the kernel 6.8.0-106-generic. Crucially though, it did not succeed for 6.8.0-106-lowlatency. The lowlatency kernel is recommended for Psychtoolbox because it provides better temporal performance. Therefore I would like the NVIDIA driver to run on the lowlatency kernel.
Solution attempts
I checked that the NVIDIA hardware is detected by typing lspci | grep -i nvidia, which indeed indicated the presence of the correct graphics card:
04:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
04:00.1 Audio device: NVIDIA Corporation GP104 High Definition Audio Controller (rev a1)
I used lsmod | grep nvidia to check the current driver status but it returned nothing. I also used dmesg | grep -i nvidia to check if any NVIDIA driver is loaded and it returned what appears to be related only to the audio device:
[ 4.631308] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/0000:04:00.1/sound/card1/input6
[ 4.631393] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.0/0000:04:00.1/sound/card1/input7
[ 4.631509] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.0/0000:04:00.1/sound/card1/input8
[ 4.631623] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.0/0000:04:00.1/sound/card1/input9
I tried different methods to install the NVIDIA drivers. I used Ubuntu's "Software & Updates" GUI > "Additional Drivers", where I selected the nvidia-driver-535 because it is labelled "proprietary, tested". I also tried installing the drivers from the Terminal with ubuntu-drivers autoinstall, which sometimes installed a more recent driver version. So I also tried installing the 535 version from the Terminal. All approaches, however, caused the same problem.
I then tried to look into why the NVIDIA drivers work fine for the generic kernel but not the lowlatency kernel. One difference I found was that the file nvidia.ko existed only in the folder /lib/modules/6.8.0-106-generic but not in /lib/modules/6.8.0-106-lowlatency. Interestingly, the timestamp for the file in the "generic kernel" folder looked recent. So I suspect that perhaps the installation of the NVIDIA drivers was built in the wrong location. Alternatively, one might expect the files to be built in the folders for all installed kernels by default, in which case it is interesting that the files were not built for the lowlatency kernel, which I am interested in.
I also dabbled with dkms, which I think is a method to manage drivers across multiple kernels but my understanding of this is so superficial that it is difficult to report what I did here.
Question
What can be done to use the NVIDIA drivers with the Linux lowlatency kernel?
Thanks & best
Michael