29

So I'm trying to install the nvidia drivers for my laptop (it has GeForce 940MX) but without luck.

I'm trying to install them by typing:

 sudo ubuntu-drivers autoinstall

Unfortunately this fails and gives the following output:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nvidia-driver-396 : Depends: nvidia-dkms-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Depends: nvidia-utils-396 (= 396.54-0ubuntu0~gpu18.04.1) but it is not going to be installed
                     Recommends: nvidia-settings but it is not going to be installed
                     Recommends: nvidia-prime (>= 0.8) but it is not going to be installed
                     Recommends: libnvidia-compute-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-decode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-encode-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-ifr1-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-fbc1-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
                     Recommends: libnvidia-gl-396:i386 (= 396.54-0ubuntu0~gpu18.04.1)
E: Unable to correct problems, you have held broken packages.

Can you please explain me what the exact problem is (I'm having some hard time trying to understand it) and what should I do to fix it?

dephinera
  • 441

2 Answers2

54

Some of the packages have unmet dependencies, likely because the PPA, but it's unclear. My advice is first remove the PPA by using:

sudo apt-add-repository -r ppa:graphics-drivers/ppa

(Note the -r means remove)

Next you want to make sure your package listing is up-to-date:

sudo apt update

Next you should likely remove all the nvidia packages you might have installed:

sudo apt remove nvidia*
sudo apt autoremove

Now with a fresh slate try to invoke the driver auto installer:

sudo ubuntu-drivers autoinstall

If you still get problems with held packages, it could be because you updated some packages while the PPA was enabled, in which case I would suggest running:

sudo apt install aptitude
sudo aptitude install <name_of_package_with_conflicts>

This will invoke an interactive series of questions basically showing you all the ways the package could be installed if you were to remove another package or downgrade one, etc. Step through them until you find the option that fits your needs (you don't have to accept the first option given)

1

You have broken dependencies. Try fixing them with

$ sudo apt -f install