Ubuntu 22.04 LTS with GeForce 210 - unable to install NVIDIA drivers

On an older desktop PC with Asus 210-SL-TC1GD3-L graphical adapter (Nvidia GeForce 210 chip) I had Ubuntu 20.04 LTS and successfully installed nvidia-340 driver (through Additional Drivers GUI application).

But after upgrading the system to Ubuntu 22.04 LTS it uses nouveau driver and does not offer any nvidia driver. The problem is that with this configuration GNOME desktop often freezes while working in GUI applications (e.g. Firefox, Thunderbird and WhatsApp).

Here are some tests I’ve done:

Booted the system with live ISO for Ubuntu 20.04.4 LTS:

$ uname -srm
Linux 5.13.0-30-generic x86_64

$ sudo ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0 ==
modalias : pci:v000010DEd00000A65sv00001043sd000083F4bc03sc00i00
vendor   : NVIDIA Corporation
model	: GT218 [GeForce 210]
driver   : nvidia-340 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin

Booted the system with live ISO for Ubuntu 22.04 LTS:

$ uname -srm
Linux 5.15.0-25-generic x86_64

$ sudo ubuntu-drivers devices

$ inxi -G
Graphics:
  Device-1: NVIDIA GT218 [GeForce 210] driver: nouveau v: kernel
  Device-2: Logitech HD Pro Webcam C920 type: USB
    driver: snd-usb-audio,uvcvideo
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: nouveau resolution: 1920x1200~60Hz
  OpenGL: renderer: NVA8 v: 3.3 Mesa 22.0.5

On Ubuntu 22.04, ubuntu-drivers does not find any nvidia driver although the NVIDIA card is present on the system. What could be the cause of the problem?

Attaching the txt files:

sudo lshw > lshw.txt
find /etc/X11 /etc/X11/xorg.conf.d /usr/share/X11/xorg.conf.d -name "*.conf" -print -exec cat '{}' \; > xorg_config.txt

lshw.txt (35.5 KB)
xorg_config.txt (6.5 KB)

See: Support timeframes for Unix legacy GPU releases. Nvidia dropped support for your GPU and the 340 branch in Dec 2019. Ubuntu no longer ships the 340 series driver because of this as it doesn’t officially support the 5.15 series kernel.

There is a PPA where someone has patched the 340 driver for newer kernels: ppa:kelebek333/nvidia-legacy

After adding ppa:kelebek333/nvidia-legacy it has been possible to install nvidia-340 driver in Additional Drivers.

$ inxi -G
Graphics:
  Device-1: NVIDIA GT218 [GeForce 210] driver: nvidia v: 340.108
  Device-2: Logitech HD Pro Webcam C920 type: USB
    driver: snd-usb-audio,uvcvideo
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: nvidia
    gpu: nvidia resolution: 1920x1200~60Hz
  OpenGL: renderer: GeForce 210/PCIe/SSE2 v: 3.3.0 NVIDIA 340.108

That solved issues with freezing of GNOME desktop.