Skip to content

Instantly share code, notes, and snippets.

@vmx
Created October 11, 2021 13:17
Show Gist options
  • Save vmx/35fa02d7cb84e5effc367476debdae10 to your computer and use it in GitHub Desktop.
Save vmx/35fa02d7cb84e5effc367476debdae10 to your computer and use it in GitHub Desktop.
Installing Nvidia drivers on Debian testing 2021-10-11

Current (2021-10-11) Debian testing cannot install Nvidia drivers properly. There bug report 994860, which contains a patch.

Here are the steps I took to apply that patch and make things work.

Download the fix-kernel514.patch from this Gist.

Then run these commands:

$ sudo apt install nvidia-installer-cleanup glx-alternative-nvidia update-glx glx-diversions glx-alternative-mesa  nvidia-support nvidia-kernel-common  nvidia-modprobe xserver-xorg-core libvdpau1
$ sudo apt-get build-dep nvidia-kernel-dkms
$ apt-get source nvidia-kernel-dkms
$ cd  ./nvidia-graphics-drivers-470.57.02
$ cp ../fix-kernel514.patch ./debian/patches/
$ echo 'fix-kernel514.patch' >> ./debian/patches/series-postunpack
$ debuild -us -uc
$ sudo dpkg -i nvidia-kernel-support_470.57.02-2_amd64.deb libgl1-nvidia-glvnd-glx_470.57.02-2_amd64.deb nvidia-driver-libs_470.57.02-2_amd64.deb xserver-xorg-video-nvidia_470.57.02-2_amd64.deb nvidia-vdpau-driver_470.57.02-2_amd64.deb nvidia-driver_470.57.02-2_amd64.deb nvidia-kernel-dkms_470.57.02-2_amd64.deb

If you need OpenCL:

$ sudo dpkg -i nvidia-libopencl1_470.57.02-2_amd64.deb nvidia-opencl-common_470.57.02-2_amd64.deb nvidia-opencl-icd_470.57.02-2_amd64.deb
$ sudo apt install nvidia-opencl-dev

I've re-installed a lot of things, so it can well be that some things that need to be installed are missing. Please report those.

Author: Bug 994860 <[email protected]>
Description: Fix for kernel 5.14: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994860#25
Forwarded: not-needed
--- a/NVIDIA-Linux/kernel/common/inc/nv-time.h
+++ a/NVIDIA-Linux/kernel/common/inc/nv-time.h
@@ -214,7 +214,7 @@ static inline NV_STATUS nv_sleep_ms(unsi
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
- current->state = TASK_INTERRUPTIBLE;
+ current->__state = TASK_INTERRUPTIBLE;
do
{
schedule_timeout(jiffies);
--- a/NVIDIA-Linux/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/NVIDIA-Linux/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -922,7 +922,7 @@ static void nv_drm_register_drm_device(c
dev->dev_private = nv_dev;
nv_dev->dev = dev;
if (device->bus == &pci_bus_type) {
- dev->pdev = to_pci_dev(device);
+ dev->dev = device;
}
/* Register DRM device to DRM sub-system */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment