Sunday, February 9, 2014

[Linux] HOW TO: Official NVIDIA drivers installation guide for Optimus graphic cards. (Linux MINT 16)

Hello guys, Last guide was a quite deprecated... There were a lot of people having problems with it so I wrote another tutorial for current version of MINT.

(Tested on Linux MINT 16 - Cinnamon 64bit edition)

- Xorg   >= 1.13.4
- xrandr >= 1.3.5
- kernel  >= 3.9

NOTE: To get rid of the black screen problem at the end, you can set your OS to autologin your user, so you don't have to put your username and password!

1) Perform a clean install linux.

2) Add repository for X-server updates and install all updates!

sudo apt-add-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get upgrade

3) As in linux MINT 16 is already kernel >= 3.9, there is no need to update it anymore...

4) Use repository to install nvidia drivers.
NOTE: You can maybe install nvidia-331, but I didn't test it!
sudo apt-get install nvidia-319

5) Download xorg.conf to /etc/X11/ folder.
NOTE: There are already filled PCI numbers! At 90% you have the same, but check it with "lspci | grep vga" and change it, if needed!

sudo wget -O /etc/X11/xorg.conf-new

6) REBOOT system. After boot enter tty1 (Ctrl + Alt + F1). Stop mdm and move xorg.conf.
NOTE: mdm is in Linux MINT. In Ubuntu use gdm instead. In other distributions it can be even lightgdm or kdm.
NOTE: If something goes wrong, and you will have problem running, or this guide will just won't work for you, just remove this xorg.conf file, and reboot. Everything should be OK then.

sudo service mdm stop
sudo mv /etc/X11/xorg.conf-new /etc/X11/xorg.conf

7) Get your xrandr IDs. Startx on tty1(you get blackscreen), then switch to tty2 and write down your IDs.

a) tty1:
b) tty2:
xrandr -d :0 --listproviders

You should get output like this:

Provider 0: id: 0x2cb cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 1 name:modesetting

as you can see, my IDs are 0x2cb for NVIDIA and 0x46 for intel.

8) Create file .xseesionrc, make it executable and open it for edditing.

touch .xsessionrc
chmod +x .xsessionrc
nano .xsessionrc

9) Write those line into .xsessionrc, but replace my IDs with yours!

xrandr --setprovideroutputsource 0x46 0x2cb
xrandr --auto

10) Now, when you restart, you should get black screen, don't worry there is login screen, you just can't see it. Just wait for a sec, write your login, wait another sec, write you pass and hit enter. Be careful! Sometimes it want only password, if you have just one user. Now you should see desktop. Also you can set autologin to get rid of this.

UPDATE: As one Anonymous noted, the black screen can be avoided by putting those lines in step 9) into script that's run BEFORE the display manager. 

For lightdm it can be done by editing /etc/lightdm/lightdm.conf and un-comment the line display-setup-script=/path/to/the/script. Where /path/to/the/script is path to the script that contains code from step 9). 

For mdm it can be done by editing file /etc/mdm/Init/Default and adding code from step 9) to the end of file, right before "exit 0" code. 

This is not tested so please proceed carefully!

Thats it!

To check if NVIDIA is running:

inxi -GSx

you should see something like this:

System: Host: Sierra Kernel: 3.11.0-12-generic x86_64 (64 bit, gcc: 4.8.1) Desktop: Gnome Distro: Linux Mint 16 Petra

Card-1: Intel 3rd Gen Core processor Graphics Controller bus-ID: 00:02.0
Card-2: NVIDIA GF108M [GeForce GT 630M] bus-ID: 01:00.0

X.Org: 1.14.5 driver: nvidia Resolution: 1366x768@60.0hz
GLX Renderer: GeForce GT 630M/PCIe/SSE2 GLX Version: 4.4.0 NVIDIA 331.38 Direct Rendering: Yes
Please let me know, if something goes wrong :)


  1. I cannot download your xorg.conf from the URL listed. It is blank. Please help. Thanks!

    1. I just entered to my browsers... it works...
      Are you sure you have it right?

    2. It appears my school is blocking the site ... Got it through a proxy. Thanks and sorry for the false alarm!

    3. Never mind :) Its ok :) Glad you get it working.

  2. Hey Lukas,

    Thanks for your tuto. I tried to follow it but cannot finally.
    After seaching, there is a utility software calles bumblebee which can help you for this hybrid laptops

    1. Yes, I know about it. But I think you are not able to let it accelerate your GUI. Also you don't get such a good performance from it.

  3. Hey Lukas,

    Thanks for your tutorial.
    I have nvidia GeForce 650M and I can clearly see it from lspci.

    I tried to follow your tutorial, but my problem is xrandr only gives one provider and NVIDIA is not there.

    Besides, even if I add that intel ID to xsessionrc and reboot. I got that black screen and cannot login when I input my password(I only have one user).

    Any suggestions?

    Thanks a lot :)

    1. Hey, thanks for comment :)

      What you describe is pretty weird. Are you sure you that have optimus laptop? Do you have both Intel and Nvidia card in lspci?

      Also, try to contact me over google+, and I try to help you.

    2. Hi Lukas,

      Thank you for the tutorial, I have followed your step and it is work very well when I type startx directly from the other tty..

      But I am still getting the blank screen in the login screen, so I have to type startx manually from the tty.. :(

    3. Howdy,

      Yes, you always get the blank screen. But dont worry... There is login screen, you only can't see it!

      One of workaround is to set it to autologin, so you don't have to put your login and password.

      Second option is to reme,ber what to type. (For example, I know that I have to type only my password. So I start my computer, wait for screen to turn off, wait 3 seconds, type my password, and press enter. Then I get loged in, and screen turn on.)

  4. Hmm.. I see..

    We just can't see the login screen, but actually the login screen is exist..

    Anyway, I have set the autologin.. After reboot the system, I just see the blank screen although i can hear the startup sound.. :-/

    1. If I were you, I would rename Xorg.conf, to get back graphic, and first of all solved the login problem. I gues there is some problem with taht autologin. It should work. Try it, and you will see.

  5. Hmm..I think I will try to find the solution for the autologin..

    Thank you very much! :D

  6. Thanx a lot,
    works flawlessly...

  7. Hey I didn't try it yet, seems a little complicated for me since I'm still new to linux in general.
    Say how can I update the drivers? Do I have to do the whole procedure over again?

    1. Hi, If you already intalled drivers this way, you have to update your drivers via apt-get.

  8. Hey Lukas,

    Thanks a lot for this tutorial, it totally worked. I did it with the nvidia-331 driver by the way and it was no problem.
    Since the Linux Mint 17 LTS is coming out I will try to do the same procedure as you explained as I'm switching to 17 now. I'll report back if it worked or not (maybe you're trying it too?). This Optimus technology just doesn't seem to be ready yet. It's a shame.
    What do you consider the most important knowledge to achieve a fix like this? Can you give me some advice?
    I reckon that a deep knowledge of xorg and xrandr are quite important for such a procedure, but do you have some concrete tips as to what I could have a look at to understand this problem better? Like, what did you need to understand first to come up with such a fix?
    I want to learn, especially since graphics drivers still seem to suffer from core problems (laptops mostly) and because I want to control my Linux Mint installation as best as possible. I'd be glad for some advice.

    Also do you know a fix for the black screen problem? Can you explain what might be the problem that the login screen is not shown, what could be the issue here?

    Kind regards

    1. Howdy,

      Thanks a lot. On mint 17, you don't need it anymore. There is already support from NVIDIA, or at least, you can chose which graphic card use, in NVIDIA drivers. To your question, about achieving fix like this, I have just try to figure aut the problem. Googled a lot, and reinstalled my OS about 50 times. And, about that black screen problem, it should be problem of GDM/MDM. So if you try to install and use something else, like LightDM, it might work. But I'm not sure...

    2. I see, thanks.

    3. Wow, I just saw it now. Those new NVIDIA X Server Settings where you can choose your GPU is really awesome. Makes bumblebee kind of superfluous for me.

  9. Downgrade to kernel 3.9.9 and nvidia 319.32 for now.

  10. Thank you for that tutorial!
    I am on Sparky linux (debian testing based, with LXDE)

    I foud out that the "black login screen"-problem can be avoided by putting the xrandr commands in a script that runs BEFORE the display manager runs the login session.
    for lightdm i had to edit /etc/lightdm/lightdm.conf and modify/uncomment the line

    for other display managers there are typically some predefined scripts that run before the login-session and where one would add the two lines from your script

    1. Wow, thanks for the tip! Unfortunately,
      I can't test it right now. But I definitely update the tutorial :)

  11. Hi,

    I have followed your tutorial and I have to say that I'm a few steps ahead with the installation of my NVIDIA card. However, I still have a few issues and I hope you could assist me a little bit:

    1. I don't have a black screen at the login screen.
    2. My X loads normally
    3. inxi -GSx shows the following output:

    System: Host: PRODiGY Kernel: 3.13.0-37-generic x86_64 (64 bit, gcc: 4.8.2)
    Desktop: Gnome Distro: Linux Mint 17.1 Rebecca
    Graphics: Card: NVIDIA GK107M [GeForce GT 650M] bus-ID: 01:00.0
    X.Org: 1.15.1 drivers: fbdev,nouveau (unloaded: nvidia,vesa) Resolution: 1920x1080@77.0hz
    GLX Renderer: N/A GLX Version: N/A Direct Rendering: N/A

    So apparently for some reason the nvidia driver is unloaded, why? And why are fbdev and nouveau loaded?

    4. nvidia-detector its output tells me "none"

    5. Upon startup, cinnamon crashes - do you have any idea how I could fix this?

    Thanks in advance! And thanks for your great post!

  12. Hi! i did the exact procedure, and i have linux min 17 (sorry i had problems with my nvidia video card anyway) when i rebooted the pc for last time i didnt got a black screen. I loged in without trouble but when i start the terminal i cant see it, neither the desktop icons and other software windows :C. I deleted the xorgconf file and the problem is still there. HALP! (sorry about my english if there whas anything unclear :P)

    1. Howdy! In your case I would try to open terminal (using CTRL + ALT + F1), and uninstall nvidia driver (sudo apt-get autoremove nvidia-*). This could help.