Ubuntu 16.04 NVidia Driver works until reboot

I am currently having problems with my Nvidia driver after upgrading Ubuntu to the latest version. I get 640x480 and a log-in loop.

If I drop to a shell and re-install the driver by executing these commands:

sudo service lightdm stop
sudo bash NVIDIA-Linux-x86_64-367.44.run

I can do...

sudo service lightdm start

And everything works again - full resolution, can log in.

After rebooting, I end up with 640x480 and the log in loop again.

I am sure when I originally set up the machine a few years ago, I had to do something else, but I cannot remember what it was.

Any help appreciated.

The card model is a GeForce GTX 750Ti this looks like the same issue as Login Loop, Video Driver Problem, Reinstalling Driver Fixes until Reboot which has no answer, so I'll keep this question up to date with my progress...

Update 1

Followed Graphics issues after/while installing Ubuntu 16.04/16.10 with NVIDIA graphics by doing...

sudo apt-get purge nvidia-*
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-370
sudo reboot

I got some warnings about uninstalling the old driver during the last command...

WARNING: Your driver installation has been altered since it was initially
         installed; this may happen, for example, if you have since installed
         the NVIDIA driver through a mechanism other than nvidia-installer
         (such as your distribution's native package management system).
         nvidia-installer will attempt to uninstall as best it can.  Please see
     the file '/var/log/nvidia-uninstall.log' for details.

... and then it outputs some errors like this...

ERROR: Unable to create '/usr/lib32/nvidia-370/libGLESv1_CM_nvidia.so.370.28'
       for copying (No such file or directory)

...but it looks like this is due to the uninstall.

Now after a reboot, I do not get the log in loop, but I still only have 640x480 as the only available screen size

I'm going round in circles on this one...


Solution 1:

After wasting about 10 hours of my life over this for the past few weeks, I've finally found out what the problem was.

I went back to my original way of installing the driver as in the question.

After powering on my machine, I was in 640x480 mode, so I opened a shell and typed...

> lspci -nnk | grep -iA2 vga

After a fresh reboot it was listing...

bret@bret-Precision-WorkStation-T5500:~$ lspci -nnk | grep -iA2 vga
03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)
        Subsystem: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380]
        Kernel modules: nvidiafb, nouveau, nvidia_352

After stopping lightdm, re-installing the driver and starting it again, the command output was...

03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)
        Subsystem: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380]
        **Kernel driver in use: nvidia**

I then remembered what I did when I originally set up the machine with Ubuntu 14.11, I had to blacklist the other two modules by adding...

# Blacklist modules that conflict with NVidia driver...
blacklist nouveau
blacklist nvidiafb

to /etc/modprobe.d/blacklist.conf

Now when I reboot, everything works.

Solution 2:

This can happen if you update your nvidia driver and the old one is not completely removed. Have faced this and similar ones many times as I had to install/update/reinstall for Deep Learning,CUDA related work.

Step 1

If you are able to get a command line login via Cntrl +Alt + F1 ( or F2 depending on your Distro) proceed to Step 2.

Else Edit Grub and get into console mode login -- This is the simplest and surfire way

Step 2

Purge current driver on Nvidia driver

sudo apt-get purge nvidia*

Step 3

reboot

Step 4

Check if GUI is working - should work

Else-- Note if you have tried starting GUI from sudo via startx then there would be permission problems, and you need to change the permission of.Xauthority

Step 5

Assuming you are in the GUI or having a network. Install the latest drivers for your card from https://www.nvidia.com/Download/index.aspx. Note sometimes it is better to take a slightly older and more stable version of the driver as the new driver may not work with the old card.

 sudo add-apt-repository ppa:graphics-drivers
 sudo apt-get update
 sudo apt-get install nvidia-430

like - https://medium.com/techlogs/install-the-right-nvidia-driver-for-cuda-in-ubuntu-2d9ade437dec

Step 6

reboot and test using nvidia-smi command enter image description here

That's all should solve your problem. If you are having the same problem then try to install a lower more stable version of the driver. For example, I first tried with nvidia-430 and it did not work then tried with nvidia-410 and it was fine.