As many will know, Nvidia drivers are a mess in Ubuntu. I have an Nvidia GeForce 9600GT (super old card, I know), and the default system offered driver for it (version 340.108) natively just doesn't support kernel versions newer than 5.8 .
It apparently was just a small error since I found a nice patch that allowed me to manually install the driver on the latest kernel. problem is - now every time there's a kernel upgrade I have to again drop to root shell and reinstall the driver to build it on the latest kernel installed.
I saw someone referring to the issue in here:apt upgrade breaks a manually installed nvidia driver.
But I would like to ask something specific - Is there a neat option to add a script that checks before booting whether the latest kernel has any Nvidia driver install and if not then install it?
The patch that I used is found in here:
The system I'm using:
Linux 5.13.0-41-generic #46~20.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linuxthe graphics card:
lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation G94 [GeForce 9600 GT] (rev a1) 3 Reset to default