Ubuntu – Ubuntu stuck after login when Nvidia driver installed

driversgraphicskubuntunvidia

I have 2 graphics cards (Tesla k10, K40) in my supermicro SuperServer (7047GR-TPRF). I installed Ubuntu Server 14.04, but when I install cuda or Nvidia graphics driver (version 311 or 340), my Ubuntu desktop hangs on login.

Best Answer

Your problem may have been caused by the NVIDIA proprietary graphics driver that is bundled with the NVIDIA CUDA Toolkit from official NVIDIA CUDA Downloads website. This driver has been known to cause freezing and black screens in Ubuntu. So try using the NVIDIA proprietary graphics driver and NVIDIA CUDA Toolkit from the Ubuntu Software Center.

The NVIDIA CUDA Toolkit package from the Ubuntu Software Center is version 5.5 which is not as up-to-date as the NVIDIA CUDA Toolkit 6.5 package from the official NVIDIA CUDA Downloads website, but is it more stable and reliable. The same goes for the proprietary NVIDIA graphics driver from the Ubuntu Software Center, the latest version of which is nvidia-331.

  1. Bring up a text-only virtual console from the hung login screen, using the keyboard combination Ctrl+Alt+F3 and then you will get a text-only console which shows you a login prompt. Login to the console at the login prompt with your username and password.

  2. Uninstall the NVIDIA proprietary graphics driver from a text-only console. Find the file you used to install the NVIDIA graphics driver from the NVIDIA website. It's in whatever folder you downloaded it to (your Downloads folder, for example). It should be named something like NVIDIA-Linux-x86-340.58.run. If so, the command to uninstall it is:

    sudo ~/Downloads/NVIDIA-Linux-x86-340.58.run --uninstall  
    sudo reboot 
    

    If the NVIDIA-Linux-x86-XXX.XX.run file has a different name or location, then change the name and/or location in the above command. The name and location of the .run file in the above command have to match exactly to the name and location of the .run file that is in your computer.

  3. After you reboot, uninstall all the CUDA packages you previously installed. They won't work properly without the NVIDIA proprietary driver from the NVIDIA website, so you will have to install the CUDA packages from the Ubuntu Software Center instead.

  4. Identify the recommended proprietary graphics driver for your system. Open the terminal and type:

    ubuntu-drivers devices  
    
  5. The Ubuntu require the nvidia-331 or more recent graphics driver, so these are the NVIDIA graphics drivers you will have to choose from if you want to install CUDA packages. Install the recommended NVIDIA proprietary graphics driver and reboot.

  6. If you have installed nvidia-331 or more recent NVIDIA graphics driver, install the CUDA packages. Open the terminal and type:

    sudo apt-get install libcudart5.5 nvidia-cuda-toolkit  
    

That's all. It's quite a lot of things to do, but it all could have been avoided if you had identified the correct graphics driver before you installed it using the command: ubuntu-drivers devices .


P.S. I hope you didn't change any PATH variables in the terminal after you installed the CUDA package from the official NVIDIA CUDA Downloads website. If you did change the PATH variable from the terminal, please comment and let me know, so I can tell you how to change it back.

Related Question