The installation of the NVIDIA display driver 340 fails in Kubuntu 20.10
dpkg
fails to configure the NVIDIA display driver 340 in Kubuntu 20.10 with this error message:
dpkg: error processing package nvidia-340 (--configure):
installed nvidia-340 package post-installation script subprocess returned error exit status 10
First you should know that NVIDIA supports different graphic driver packages for different GPUs.
NVIDA ended the support of their Linux legacy drivers earlier this year; specifically with the NVIDIA display driver 340 the last supported Linux kernel is 5.4; newer kernels are not supported.
Kubuntu 20.10 ships with Linux 5.8, which is not supported by the latest NVIDIA display driver 340.108. On the other hand Kubuntu 20.04 has long term support until April 2023 and will continue to work with the NVIDIA display driver (provided you don't make use of the newer kernel which comes as part of the LTS Enablement Stacks).
Some third parties are trying to patch the NVIDIA display driver 340 to make it work with newer versions of Linux according to this Launchpad ticket. But keeping up with the new Linux version is not trivial (other distributions already decided against it) and the maintenance of a proprietary driver in a GPL context raises some legal issues.
Alternatively one can remove the proprietary driver (sudo apt-get autoremove --purge nvidia-340
) and use the built-in driver of the kernel instead (nouveau). My experience is that the 3D and even the 2D acceleration suffer a lot after switching from the proprietary driver to the open source driver. This would be fine with a more powerful GPU but since my GPU is very old and slow I decided to retire it and to replace it with a newer model which comes with recent drivers.
I am using Ubuntu 20.04 with a NVIDIA GT216. It looks like the nvidia-340 driver is only working with kernel 5.4., so check your devices:
ubuntu-drivers devices
Install the missing kernel:
sudo apt install linux-generic
Check wich kernels are installed:
dpkg -l | egrep -e 'image|generic' | egrep -e linux
Remove the actual kernel:
sudo apt-get remove --purge linux-generic-hwe-20.04 linux-*-5.11.*
Reboot ;-):
reboot
and install the nvidia-driver:
sudo apt install -y nvidia-340