Nvidia Dual monitors on Ubuntu Dapper

This was a separate page on the site, now it’s just a blog post. Here it is:

Ok, so there’s a bit of a dearth of real information on real topics on the Internet, and I try to fix that where I can, here’s how to get (at the moment anyway) dual monitors working in Ubuntu Dapper on an Nvidia video card.

Getting access to the packages

Ubuntu plays nice as far as non-open-source programs and so forth goes, so you’re going to have to activate the Multiverse and Universe repositories in Synaptic.

Becoming god (or escalating your user to root for a while)

I’m a console weenie, and that’s how to get this working, so to save messing around do this:

sudo passwd

Then enter your password, then follow the prompts to change the root password so you can actually su to root and do things easily. Yes, it’ll let you actually log in as root, yes this makes your PC less secure if you’re running without a firewall and an easily guessed password, no, I don’t care about you if you can’t secure your network. Change to the root login:


Put in your password and now you’re effectively logged in as root. Don’t do stupid things like deleting all your files - if you do, that’s your own fault.

Install the nvidia-glx package and its dependencies - here’s the commands via the console:

apt-get update
apt-get install nvidia-glx

The first command updates your apt package list, and the second one installs the files. Read what’s on the screen, make sure it’s going to install things and then say yes when it asks you to.

Setting up xorg.conf

First, make a backup - you want to be able to get back to where you were before you broke something if you did.

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.mybackup

This’ll (if you didn’t guess) make a backup to /etc/X11/xorg.conf.mybackup.

In Linux, ATI has a driver that works, kinda. Nvidia‘s got a great driver, but a sucky config program, so this is going to take a little bit of messing around. What we’re going to have to do is trick it a little. This might be the hard way to do it, but it’s how I got it working, so meh. Do this:

rm /etc/X11/xorg.conf
nvidia-xconfig --twinview

That’ll delete the original file, then you’re running the nvidia config program and telling it to setup your xorg.conf file with twinview enabled. It should also set it up right to use the proprietry nvidia module instead of open source one.

After that, you’ll have to setup multiple screens - this was shamelessly stolen from Nvidia’s Howto on setting up multiple screens which is not exactly what we want to do.

Open /etc/X11/xorg.conf for editing - I use VIM, but you can use gedit by going (from your logged-in-as-root console):

gedit /etc/X11/xorg.conf

Make sure to edit this line in the “Module” section to disable the glx module loading, because the nvidia driver seems to have it built in or something:


Load "glx"


Load "glx"

Delete the section that starts with Section “Device” and then create two new Device sections, each listing the BusID of the graphics card to be shared and listing the driver as “nvidia”, and assign each a separate screen:

Section "Device"
Identifier "nvidia0"
Driver "nvidia"
BusID "PCI:5:0:0"
Screen 0

Section "Device"
Identifier "nvidia1"
Driver "nvidia"
BusId "PCI:5:0:0"
Screen 1

To find the right BusID, you’ll need to run the command:


Look for something with Nvidia VGA in it, and on the left will be something like “00:00:05” which would mean you’d use the same as above.

Then, create two Screen sections, each using one of the Device sections:

Section "Screen"
Identifier "Screen0"
Device "nvidia0"
Monitor "Monitor0"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1024x768"

Section "Screen"
Identifier "Screen1"
Device "nvidia1"
Monitor "Monitor1"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1024x768"

This’ll setup a pair of monitors running 1024×768 at 24bit colour depth. If you want different resolutions or depths, just change it - remember that it won’t work too well if you’re running two different resolutions - I don’t know if it’ll work at all.

Since you’re running a second monitor you’ll need to add another monitor definition to the file, so add this somewhere:

Section "Monitor"
HorizSync 60-110
Identifier "Monitor1"
Option "DPMS"
VendorName "Monitor2"
VertRefresh 65.0-85.0

That’s the right setup for an average 17″ CRT that’ll do 1024×[email protected] I couldn’t find a page that’ll show you the right way to do any other setup, but it’s pretty easy to work out.

Next, edit the ServerLayout section to use and position both Screen sections. Just add these lines (you may need to change “leftOf” to “rightOf” or something like that depending on how you have your monitors setup - or just swap the cables over :):

Screen 0 "Screen0"
Screen 1 "Screen1" leftOf "Screen0"

Run this again:

nvidia-xconfig --twinview

I don’t know why, but it fixed it for me. Restarting your pc (type “reboot” at the console for the easy way) should get you to a graphical desktop on Ubuntu spanned across two screens, with the ability to run 3D applications (they’ll probably span to 2048×768, but that’s half the fun) and maximise normal applications to a single screen only - something that xinerama and plan twinview setups seem to break.

I’m pretty sure that should all work for you, I’ll test it on a spare machine in the next little while - suggestions/corrections? Email me.

#Computers #Graphics #Linux #Programming