How to recover from a Nvidia fail on Ubuntu 16.04?

I have an older Nvidia video card and my PC crashes when installing the driver for the video card in Ubuntu 16.04. When I get to the login screen but no further: after entering my password, the system went into a loop and returned always back to the login screen [with funny stripes present].

How do I fix this problem?


Solution 1:

Edited out of the question posted by Rob grune:

To recover, follow these steps:

Ctrl+Alt+F1 [to exit and get into the TTY mode]

sudo apt-get remove --purge nvidia*
sudo apt-get install ubuntu-desktop
sudo apt-get autoremove
sudo rm /etc/X11/xorg.conf
echo "nouveau" | sudo tee -a /etc/modules
sudo reboot

[after reboot, you should be back to operational with the nouveau driver, and can login]

sudo add-apt-repository --remove ppa:graphics-drivers/ppa
sudo apt-get autoremove
sudo apt-get autoclean

Solution 2:

Ubuntu has this guide on their own wiki - but that one was last updated 2013-02-06, so I wouldn't put too much trust/hope/faith/work/time in it.

Here is a recipe which removes all old video drivers, and reinstalls nouveau:

sudo nvidia-settings --uninstall
sudo apt-get remove --purge nvidia*
sudo apt-get remove --purge xserver-xorg-video-nouveau xserver-xorg-video-nv
sudo apt-get install nvidia-common
sudo apt-get install xserver-xorg-video-nouveau
sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
sudo dpkg-reconfigure xserver-xorg

Solution 3:

I was having the same issue with Dell Vostro 1500 (GeForce 8400M GS) after updating to the recent Ubuntu 16.04.2 and using the nvidia-340 driver. It took me almost a day to resolve it. Here in shortcut what you can try:

First of all press CTRL+ALT+F1 to get to the text console. Then log in.

Do cat /var/log/gpu-manager.log. If you see something like this:

Looking for nvidia modules in /lib/modules/4.4.0-72-generic/updates/dkms
Found nvidia module: nvidia_340_uvm.ko
Is nvidia loaded? yes
Was nvidia unloaded? no
Is nvidia blacklisted? yes
...

Then the reason for the login loop is most likely that the nvidia kernel DRI module is blacklisted. This might be because bumblebee was previously installed with an older version of the nvidia driver (in my case nvidia-304) and now is no longer used. If not purge deleted it leaves config files in /etc, among them also module blacklists. The blacklisted module causes the X server to fail to initialize after logging in, which results in the login loop.

Check whether bumblebee is installed:

apt list --installed | grep bumble

If not (no output of the above command) check if /etc/modprobe.d/bumblebee.conf exists:

ls -l /etc/modprobe.d/bumblebee.conf

If it exists just delete it:

sudo rm /etc/modprobe.d/bumblebee.conf

And now try again either by rebooting or by running:

sudo service lightdm restart

You can also see the detailed problem analysis in my other post.