Can't get nVidia drivers working with 16.04, logs out right after login

Thanks to the collective effort of the community, I have managed to get it working.

First, get to a Terminal (by pressing ctrl-alt-f1 if you can't log in, or through recovery mode). Install nVidia drivers version 364 (package nvidia-364).

sudo apt-get install nvidia-364

If the package is not found, add the ppa that contains it:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update

Reboot your computer.

sudo reboot -i NOW

If you're not thrown back to the login screen, but you get to see only your background, force it to recreate your user settings (saving a backup):

sudo mv ~/.config/dconf/user ~/.config/dconf/user.old

Then, restart lightdm:

sudo service lightdm restart

If you want to install bumblebee, beware that its configuration will be set badly and it will look for nvidia-current even if nvidia-current is not installed. I have edited it to refer to nvidia-364 instead (because the installed files are in /usr/lib/nvidia-364) and I was able to start programs with optirun.


I had some problems with Nvidia and 16.04 - finally got it working. on an nvidia gtx980m (asus G752 gaming laptop) - I suggest making sure you try to install from command line, and not simply enabling the proprietary drivers from the gui...(read on)

I am not getting the boot loop described, but I was getting low res (800x600) and it would not work at all - but the nouveau one was fine. (all via the drivers gui)

I finally dropped to command line and installed the same package via "sudo apt-get install nvidia-xxx (in my case was 361 - also tried 352)

it then installed as normal, but a menu popped in the terminal up that said "UEFI" secure boot was enabled and you would have to put in a one time password to disable it on reboot" to boot into insecure mode. So I did that.

Once that was done, on reboot - sure enough a UEFI window menu popped up and I choosed to change boot mode to insecure. It then asked me several characters "by position" (EG...type in character 6, then type in character 4, etc) followed by enter each time. Eventually after 3-4 characters, it allowed me to turn off secure boot. Then the machine rebooted again, and said "booting insecure mode" and the drivers then worked.

Also discovered then when installing virtualbox as well via synaptic, but at least it worked and popped up a menu using that method....

hope that helps...


How do I get my desktop back?

By pressing ctrl-alt-f1 from the login screen, you can go to a commandline. Login using your username and password. From this commandline, you can uninstall the nvidia drivers by running the following commands:

sudo apt remove nvidia-361
sudo apt autoremove

Note that the specific version of nvidia might be different. You can find out the version of the installed nvidia driver by running apt search nvidia | grep installed | grep nvidia

or if you just want to switch to the Intel graphics card without removing the nvidia driver, run

prime-select intel

But I want to use my nvidia card!

There are a few options you can try:

Disable secure boot

As @biff said, Secure Boot might block the nvidia driver from loading. To disable secure boot, install the nvidia driver using the commandline. Ubuntu will ask you to disable secure boot during the installation.

Install the older nvidia driver

Some problems might be fixed by installing the older nvidia driver.