This blog is ad-supported. If you find it useful, please consider disabling adblock for this site

making Linux even simpler

main page

how-to Install official Optimus Nvidia driver on Ubuntu/Mint

September 16 2013

This is a how-to based on my experience installing the official Nvidia-319 driver and enabling the Optimus support, The result: working HDMI output, improved performance in the Dolphin emulator and Steam and pcsx2 . But, no powersaving features.

This is a step-by-step walkthrough, but requires some experience using a Linux terminal. I take  no responsibility if while following the process described here you break your Linux installation or lose some sensitive data. 

Important Note: It's not necessary a downgrade of packages as suggested by other tutorials that I've seen around. Let's begin.

1. Dowload latest nvidia drivers and uninstall bumblebee. you need the latest stable drivers, version 319 (I tried the beta version too, It also works fine); save the file somewhere, mine is in ~/Downloads/NVIDIA-Linux-x86_64-319.32.bin.

Then you must uninstall, if installed, bumblebee and the nvidia drivers provided by the package manager  (i will use # for root commands, > for user commands):

> sudo apt-get remove nvidia-current nvidia-settings bumblebee bumblebee-nvidia

Now add the xorg-edger repo and upgrade.

> sudo apt-add-repository ppa:xorg-edgers/ppa

> sudo apt-get update

> sudo apt-get upgrade

2. Install Kernel 3.9 Let's install the Linux Kernel 3.9.8, (IMPORTANT: For Saucy Salamander you can skip this. You don't need a new kernel) open a terminal and type.

> wget

> chmod a+x kernel-3.9.8 

> sudo ./kernel-3.9.8 

> sudo update-initramfs -u

> sudo update-grub

then reboot your system. 

3. Install Nvidia drivers. Let's proceed with the Nvidia divers installation, you have to run a virtual terminal without graphic interface, so press Ctrl+Alt+F1, become root ("sudo su" should do the trick) and kill the graphic interface with.

# service mdm stop

Then make the file you downloaded executable and run the installer

# chmod a+x Downloads/NVIDIA-Linux-x86_64-319.32.bin

# Downloads/NVIDIA-Linux-x86_64-319.32.bin

At the final step of the installation process, when the installer asks about creating the xorg.conf file, choose "No"; then reboot the system. After rebooting we are going to configure a few things, as recommended in the Nvidia web page

4. Create Nvidia configuration file. First you have to identify your PCI Bus ID:

> inxi -Gx
Graphics:  Card-1: Intel 2nd Generation Core Integrated Graphics Controller bus-ID: 00:02.0 
           Card-2: NVIDIA GF108M [GeForce GT 525M] bus-ID: 01:00.0 

As you can see my Nvida bus Id is 01:00.0 we are going to need this. Now open your favorite text editor and copy the next text:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
    # Uncomment this line if your computer has no display devices connected to
    # the NVIDIA GPU.  Leave it commented if you have display devices
    # connected to the NVIDIA GPU that you would like to use.
    Option "UseDisplayDevice" "none"

Section "Device"
    Identifier "intel"
    Driver "modesetting"

Section "Screen"
    Identifier "intel"
    Device "intel"

Here, next to BusID, put your nvidia ID and save the file as 10-optimusnvidia.conf in your home folder (or anywhere else, just remember the location), now copy,  the file to  /usr/share/X11/xorg.conf.d/. DO NOT use mv instead of cp

> sudo cp 10-optimusnvidia.conf /usr/share/X11/xorg.conf.d/

again, go to a virtual terminal with Ctrl+Alt+F1, become root and stop the X.

# service mdm stop

now exit from your root account and as user, start the X server:

> startx

5. Solve the black screen problem, configure Xrandr. If everything goes OK you should get a black screen. After the black screen, go to another terminal Ctrl+Alt+F2, if your computer is frozen try rebooting and stopping the X again. In that second terminal type:

> xrandr -d :0 --listproviders
Providers: number : 2
Provider 0: id: 699 cap:0x1 ... name:NVIDIA-0
Provider 0: id: 69  cap:0x1 ... name:modesetting

this should give you two lines as shown above (I cropped some info, yours should be longer), write down or "echo"  the id's (699 and 69 in the example). Now run this command, change the 69 and 699 for your corresponding ids

> xrandr -d :0 --setprovideroutputsource 69 699

then check if a monitor is active with:

> xrandr -d :0

If it is, write down its name, mine was LDVS-0. That's all the info we need lets go back to a normal desktop (if you can edit text files from terminal then you can continue there). First go to the virtual terminal where you typed startx and press Ctrl+C to stop it. Then as root, remove the file 10-optimusnvidia.conf you copied to /usr/share/X11/xorg.conf.d/ and start mdm (or startx).

# rm /usr/share/X11/xorg.conf.d/10-optimusnvidia.conf

# service mdm start

open a text editor and copy the text below:


xrandr --setprovideroutputsource 69 699
xrandr --output LVDS-0 --off
xrandr --auto

As you see 69 and 699 are the id's of my intel and nvidia cards. Also LVDS-0 is the output I got when checked if the monitor was on, if you didn't get anything you can comment/delete that line. Save the file as .xsessionrc in your home folder. Now give it permissions to run:

> chmod a+x .xsessionrc

Now again, go to a virtual terminal, kill the x server and copy the file that was in /usr/share/X11/xorg.conf.d/ (Repeat the deleting/copying thing to use Intel only or the nvidia sessions). Then do startx as user again and this time there should be your desktop!, no black screen.

# service mdm stop

> sudo cp 10-monitor.conf /usr/share/X11/xorg.conf.d/ 

> startx

Check nvidia-settings, everything should be OK. Have fun! (hope it was worth it). At every reboot repeat the "kill X server", "startx" steps.

If you are done with that and want to go back to bumblebee, delete /usr/share/X11/xorg.conf.d/10-optimusnvidia.conf, .xsessionrc and uninstall the nvidia drivers (you might also want to uninstall the kernel you just installed). Then reinstall nvidia-current, bumblebee-nvidia and so on.


6 September 27 2013 Tuxilero wrote:Hi, thanks for the guide!

I just messing with this for two days...

My base system is Linux MINT 15 Mate 64bit.
It took me a lot of time, before I managed to get actul Xrandr 1.4 and Xorg server 1.14 ...

For others, best way to do that on mint is:

1) Clear instalation of mint 15
2) Add ubuntu 13.10 repository
3) Install ONLY "gcc, g++, linux-generic(for kernel 3.11.0), xserver-xorg-core"
4) remove ubuntu repo (you dont want to mess up your system!)
5) install nvidia drivers as write above :)

Im now testing if instaling nvidia-235 from repo, work as well

I'l be in touch!

3 September 27 2013 Tuxilero wrote:Ahh, everything solved!

written own guide to help others, who have troubles!

Check it here!

1 September 28 2013 Tuxilero wrote:My appologize...

FB sux, and removed my note, so I had to write it again :(

You cant find it here.

PS: please remove my top uselles comment .) thank you.

5 October 2 2013 Mysterious Commenter wrote:Physlord : Can you please provide the link for ubuntu package
Is it bumblebee ?

6 October 2 2013 Physlord wrote:Check this post:

22 October 3 2013 How to use this method in Ubun wrote:How to use this method in Ubuntu 12.04?

4 October 23 2013 Physlord wrote:There's no such directory in my Ubuntu installation. Would it work if I create it?

9 October 23 2013 Mysterious Commenter wrote:@Physlord: yes, it would

5 April 7 2014 Mysterious Commenter wrote:hi i don't have 10-monitor.conf in /usr/share/X11/xorg.conf.d/ , what's the purpose of this last step ? modify 10-monitor.conf ? i'm on ubuntu 13.10


max length: 1200, min length: 3, supports LaTeX typesetting