Schmorp's POD Blog a.k.a. THE RANT
a.k.a. the blog that cannot decide on a name

This document was first published 2019-08-03 15:37:09, and last modified 2020-02-01 09:46:55.

nvidia-legacy-304 patch for post-5.0 linux kernels

Update 2020-02-01: Patch updated for Linux 5.3/5.4.

Because seemingly nobody else did it for me, I had to patch the nvidia-legacy-304.137-7 Debian package to work with post-5.0 linux kernels (tested with 4.19.36, 5.1.21, 5.2.4, 5.4.15 on Debian buster).

The patch is here and can be applied by executing something like the following, after installing nvidia-legacy-304xx-kernel-dkms:

wget -O /tmp/nvidia-legacy-304xx-304.137-linux5.patch \

cd /usr/src/nvidia-legacy-304xx-304.137
patch -p1 -NEl </tmp/nvidia-legacy-304xx-304.137-linux5.patch

As another hint, the last xserver version that works with this is from stretch, you can install it (assuming you have stretch repos enabled) like this:

apt install xserver-xorg-core=2:1.19.2-1+deb9u5

For further reference, here are some relevant package versions I have installed:

ii  glx-alternative-nvidia                    1.0.0             amd64
ii  libgl1-nvidia-legacy-304xx-glx:amd64      304.137-7         amd64
ii  libgl1-nvidia-legacy-304xx-glx:i386       304.137-7         i386
ii  libnvidia-legacy-304xx-cfg1:i386          304.137-7         i386
ii  libnvidia-legacy-304xx-glcore:amd64       304.137-7         amd64
ii  libnvidia-legacy-304xx-glcore:i386        304.137-7         i386
ii  libnvidia-legacy-304xx-ml1:amd64          304.137-7         amd64
ii  nvidia-installer-cleanup                  20151021+9        amd64
ii  nvidia-kernel-common                      20151021+9        amd64
ii  nvidia-legacy-304xx-alternative           304.137-7         amd64
ii  nvidia-legacy-304xx-driver                304.137-7         amd64
ii  nvidia-legacy-304xx-driver-bin            304.137-7         amd64
ii  nvidia-legacy-304xx-driver-libs:amd64     304.137-7         amd64
ii  nvidia-legacy-304xx-driver-libs:i386      304.137-7         i386
ii  nvidia-legacy-304xx-driver-libs-i386:i386 304.137-7         i386
ii  nvidia-legacy-304xx-kernel-dkms           304.137-7         amd64
ii  nvidia-legacy-304xx-kernel-support        304.137-7         amd64
ii  nvidia-legacy-304xx-vdpau-driver:amd64    304.137-7         amd64
ii  nvidia-modprobe                           418.56-1          amd64
ii  nvidia-settings-legacy-304xx              304.137-2         amd64
ii  nvidia-support                            20151021+9        amd64
ii  xserver-xorg                              1:7.7+19          amd64
hi  xserver-xorg-core                         2:1.19.2-1+deb9u5 amd64
ii  xserver-xorg-input-evdev                  1:2.10.6-1        amd64
ii  xserver-xorg-input-libinput               0.28.2-2          amd64
ii  xserver-xorg-input-mtrack                 0.3.1-1+b2        amd64
ii  xserver-xorg-input-synaptics              1.9.1-1           amd64
ii  xserver-xorg-legacy                       2:1.20.4-1        amd64
ii  xserver-xorg-video-nvidia-legacy-304xx    304.137-7         amd64

Lastly, the patch is supposed to be minimal and functional, not clean, nice, or anything else.