Unable to use proprietary NVIDIA graphics driver after upgrading from Lubuntu 20.10 to 21.04 (20.04 LTS to 22.04 LTS)
I have a laptop running Lubuntu 21.04, but which was previously running 20.04 LTS. The system has an NVIDIA GeForce 9400M graphics processor.
Under 20.04 LTS, the "Software Sources" dialog was able to find the graphics card easily, and show me the option to toggle between either the Nouveau driver or the proprietary NVIDIA driver. I was able to choose the latter option and the driver was working just fine. The same also worked after I upgraded to Lubuntu 20.10: it was using that driver.
However, after I upgraded to Lubuntu 21.04, it switched to the Nouveau driver. The option to toggle to the NVIDIA driver is no longer present in the Software Sources dialog.
I tried using
sudo apt-get install nvidia-driver-340, but it couldn't find the package.
nvidia-340 showed up as a Nouveau package when I used
apt-cache search, so I didn't try that. I also tried
sudo add-apt-repository ppa:graphics-drivers/ppa, but the above first command still didn't work.
I also tried downloading the 340 driver from the Nvidia website and manually installing that, but the installation failed. (If necessary, I can post the log file.)
How can I use the proprietary NVIDIA driver for graphics under 21.04? Why did it stop working there?
I imagine the same problem will also apply to those sticking with LTS versions of Ubuntu, when upgrading from 20.04 LTS to 22.04 LTS.