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.

Geri Geri O. Morales
Maths Grad student at UNAM.
With experience in Linux server administration and web development

September 27 2013
Tuxilero wrote:
Ahh, everything solved!

written own guide to help others, who have troubles!

Check it here!

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

October 2 2013
Physlord wrote:

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

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

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