Dual Monitors with NVidia in Ubuntu
Sponsored Link
The first step towards dual monitors involves installing the NVidia 3D drivers. Luckily, NVidia has great Linux support and the drivers can easily be downloaded from the Ubuntu repository. Ubuntu Feisty Fawn gives users the option to install these drivers when first installing, but in case you chose not to install these drivers, all it requires is one line of code in the terminal:
sudo apt-get install nvidia-glx
Now that the drivers are installed, let's make sure that we're using them. First, let's check xorg.conf, the main location for display settings in Linux. Type sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup. This ensures that we have a backup copy in case some of the settings we're about to edit break X and don't allow you to use a graphical interface! I suggest always doing thins before changing settings in Linux manually to ensure easy recovery later. Now we're ready to edit our settings, so type sudo gedit /etc/X11/xorg.conf. Under the module section, replace "nv" with "glx". Under the device heading, make sure that Driver says "nvidia". Under the screen section, add the following line:
Option "RenderAccel" "true".
Now save your changes and close gedit. We're going to reload X to ensure that we're now using the proper drivers. Reload X by hitting Ctrl+Alt+Backspace. This will require you to log back into Ubuntu, so if you're not using a browser that saves your session, like Firefox/Swifterfox, make sure you bookmark this guide to follow the remaining instructions. If our install worked, you should see the NVidia logo flash quickly before the Ubuntu log in screen comes up. Actually, if this doesn't work, you're not going to be able to load X properly. If that's the case, you're going to have to type this into the console to replace the new xorg.conf with the old:
sudo cp /etc/X11/xorg.conf_backup /etc/X11/xorg.conf
Assuming everything went well, we're quite close to having dual screens working. Let's go back into xorg.conf using sudo gedit /etc/X11/xorg.conf. Now go back under the heading "Screen". Let's add a few lines:
##This turns on NVidia's TwinView
Option "TwinView"
##Here I'm setting the resolution to the individual monitors.
Option "MetaModes" "1280×1024 1280×1024"
That should be it! Restart X with Ctrl+Alt+Backspace and you should have two screens. If the orientation of the screens is off, try this under the "Screen" heading...
Option "TwinViewOrientation" "LeftOf"
LeftOf can be LeftOf, RightOf, Below, Above, or Clone.
Hope that was helpful!
BIG THANK YOU!
I spent hours on this.
I now have 19″ CRT with a 17″ TFT
And Compiz desktop cube rotating on my screens
Basically the Nvidia GUI config couldn’t parse the existing xorg.conf????? So I had to manually hack it, your instructions above worked for me.
P.s. ctrl-alt-backspace didn’t seem to do much? So instead i just did a reboot each time.
NShiell; were you running the nvidia config thing as root?
if you didn’t, it wont work
Nshiell: Since version 8.10, Ubuntu has shipped with the Ctrl+Alt+Backspace shortcut disabled by default, to prevent its accidental use. It can be reactivated, but you’ll have to install and run a small program called “dontzap” first:
sudo apt-get install dontzap
dontzap -e
…and then reboot. After this, Ctrl+Alt+Backspace should function normally again.
…My fault, I gave the wrong option for dontzap in my above comment. It’s “dontzap -d“, not “-e”. Sorry for that.
Anyway…
sudo apt-get install dontzap
dontzap -d
…should do the trick.
sudo apt-get install nvidia-glx
yield:
Package nvidia-glx is a virtual package provided by:
nvidia-glx-96 96.43.10-0ubuntu1
nvidia-glx-71 71.86.08-0ubuntu1
nvidia-glx-180 180.44-0ubuntu1
nvidia-glx-173 173.14.16-0ubuntu1
You should explicitly select one to install.
So which one I do pick ?
I picked 1th one. After adding
Option “RenderAccel” “true”.
I get parsing error.
This came up as the first hit in google, so for what it’s worth here’s my two cents. The above method did not work for me — it consistently picked the wrong monitor to make the default. After some screwing around and trying to make nvidia-settings work (may or may not be broken depending on what mood it’s in) I came up with this:
Section “Device”
Driver “nvidia”
Option “NoLogo” “True”
EndSection
Section “Screen”
Option “TwinView” “1”
Option “metamodes” “CRT: 1280×1024 +1680+0, DFP: 1680×1050 +0+0”
EndSection
That’s my ENTIRE xorg.conf file and it works like a charm. Please note that the names ‘CRT’ and ‘DFP’ in the ‘metamodes’ line may be different for you. If you open up nvidia-settings you can find out what it likes to call your monitors. The resolutions are whatever your monitor’s resolutions are, and the ‘+1680+0’ positions the monitor called ‘CRT’ to the right of ‘DFP’ (which is 1680 pixels wide).
@marius: The higher numbers denote later versions, if you have an at all recent graphics card you should try 180 first. Also, many of the Option “blahblahblah” lines are no longer necessary with the later versions of X.
Here is a post that helped me
http://ubuntuforums.org/showthread.php?p=8258827#post8258827
Here’s what I did to get around it:
sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo nvidia-xconfig
sudo nvidia-settings
The first step creates a backup of your currently working xorg.conf file.
Step 2 runs the NVIDIA utility to generate a new xorg.conf file that the utility can actually read.
Step 3 runs the graphical NVIDIA setup tool as root, so you can actually save your changes.
If this does not work then after step 1, do sudo rm /etc/X11/xorg.conf to delete your current xorg.conf file. Then run sudo nvidia-xconfig and sudo nvidia-settings.
I hope this helps someone else…..
Hi, I have dual monitors and I’m using the fancy desktop affects – wobbly windows 3D cube etc. I can’t find a way to move a window from one monitor to the other. Is there one? If I set Xinerama in the NVIDIA settings then I can drag windows across monitors, however Xinerama disables all the fancy desktop affects.
Richard
Similar to this discussion, I have one monitor, but it always loads in VGA, and I have to always go into Display settings (in Ubuntu 9.04 jaunty jackaloupe) and set the HDMI connection as primary on twinview, then go and disable the vga, and click apply to get an HDMI screen. Can anyone tell me how to get it saved so it loads on HDMI every time from bootup? The conf file doesn’t want to save when I click Save To Configuration file.
Much appreciation! Worked the first try in karmic. Many thanks!
Becks way worked out just fine.
Please vote on Adobe’s website so they will fix the twinview-fullscreen bug: http://bugs.adobe.com/jira/browse/FP-562
there less than 50 votes right now!
Thank you soo much for this tutorial. Worked excellent and gave me a little lesson. I actually understood what I was doing and am able to apply this to other tasks in Linux. Much appreciated 🙂
Thanks!! That “RenderAccel” option proved to be the magic line of code. All of a sudden, everything is beautiful 🙂
Just found something that worked for me, as I tried the steps above and they didn’t work.
incredibly short
in terminal window type in:
sudo nvidia-xconfig [enter] (maybe prompted for password)
sudo nvidia-settings [enter]
in the NVidia settings window, then click save configuration, done.
I have used this tutorial so much. Thanks for writing it. Lately though, they have released a GUI through Nvidia on the ubuntu software synaptics that will actually set it up and is easy to install. So you don’t actually have to mess with Xorg.
You just search for nvidia-xconfig.
do a quick little command prompt:
sudo nvidia-xconfig
log out, log back in and it has set up all of the computers in our offices.
It’s worked on all types of cards as well.
I have an NVidia dual-monitor card in my PC. It worked fine with Karmic Koala and I could display a background/ wallpaper across two monitors at a combined resolution of 2560×1024.
When I upgraded to Lucid Lynx, I lost this capability and now any wallpaper is displayed entirely on EACH screen rather than spread across both. A bug has been logged for it….but it’s almosy enough to make me go back to Karmic as there has been no obvious advantage whatever in upgrading to Lucid. My DVD-RW drive is now also behaving strangely….unable to read/write to some disks it created prior to the upgrade.
@Linuxluver: same issue for me, wallpaper no longer fills both devices (either centered across both, but not stretched; or stretched individually across each device). Where did you file the bug report? I want to support it.
Hey im just curious, is there a way to do this on windows xD sorry for posting on ubuntu forum not sure if its legal but I really want a program as such =)
I am new. I tried it, but it didn’t work.
What worked was finding the resolutions of the two screens and changing the “Absolute” and “to right of” to something that made sense to me.
I now have one desktop across two screens.
I love this stuff.
Thanks.
Hi!
Followed your instructions upto the point of changing the xorg.conf file… and then I restarted.
And now, linux (ubuntu 10.04) does not log on ever. I am not even able to log on to change the file back to its back up!
Any suggestions?
I have a whole load of data and programs on my linux partition and reinstalling ubuntu is the worst possible thing for me right now! Please reply…
Hello
Tejas,have you tried using your ubuntu disc to boot from the cd to correct your files or back up the important data you have so that you may reinstall if necessary?
Hi, the live disk didn’t have a ‘repair’ option. however I booted using the recovery mode (terminal mode) and then restored the xorg.config file through command line. It booted after.
I still have no gotten to having dual monitors on ubuntu though …
Thanks for replying
Hi guys
This thread was a great help, thanks.
My solution was using the Nvidia GUI to adjust everything to taste (dual monitors – twin view). Then I opened the preview (there is a button for that) and copied the settings. After that I opened the config file via: sudo gedit /etc/X11/xorg.conf and pasted my settings, saved and closed.
No problem after that.
Hope this helps.
regards,
This may be a stupid question but where is the “module section” you were mentioning in the beginning?
Alright I’ve been at this for weeks and I apologize to comment right after myself. I’ve been trying to get a second monitor working with Ubuntu. I’ve watched numerous videos showing how to use the NVIDIA XServer Settings and I’ve done exactly what they’ve said to do. I’ve read numerous forums about this and nothing is working. I have an 18 in acer monitor I’m trying to hook up to my laptop via VGA. When I connect the second monitor to my laptop and even after doing everything in Nvidia XServer Settings right, the second monitor still displays a “No input signal” message. VERY FRUSTRATING! I’ve been at this for some time now. Here is a copy of everything in my xorg conf: And for some reason I get the feeling I’m missing some stuff. Check it out.
PLEAS PLEASE PLEASE help me out.
Section “Monitor”
# HorizSync source: builtin, VertRefresh source: builtin
Identifier “Monitor0”
VendorName “Unknown”
ModelName “Seiko”
HorizSync 30.0 – 75.0
VertRefresh 60.0
Option “DPMS”
EndSection
Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce Go 6150”
EndSection
Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce Go 6150”
EndSection
Section “Screen”
# Removed Option “TwinView” “1”
# Removed Option “metamodes” “CRT: nvidia-auto-select +1280+0, DFP: nvidia-auto-select +0+0”
# Removed Option “TwinView” “0”
# Removed Option “metamodes” “nvidia-auto-select +0+0”
# Removed Option “TwinView” “True”
# Removed Option “MetaModes” “nvidia-auto-select, nvidia-auto-select”
Identifier “Screen0”
Device “Device0”
Monitor “Monitor0”
DefaultDepth 24
Option “TwinView” “0”
Option “TwinViewXineramaInfoOrder” “DFP-0”
Option “metamodes” “DFP: nvidia-auto-select +0+0”
SubSection “Display”
Depth 24
EndSubSection
EndSection
Hey, this tut worked for me, but I still can’t figure out how to make the montiors display SEPARATE X screens. I had this working on older Ubuntu, but now it broke.
I tried suggestions in the comments, but when I use nVidia’s GUI to change to Separate X screens, Xorg doesn’t load at all.
BTW: seeing a few comments on the subject… if Xorg doesn’t load for you, you can press CTRL+F2 (or CTRL+ALT+F2) to get into plan text-mode shell, log in there and copy over your good, backup xorg.conf file.
One thing. Change double quotes in this article. My X couldn’t parse the xorg.conf file and I wasted half a hour to figure that I copied and pasted it with strange qoutes signs…
Hi guys, I figured this out with natty 11.04, and wanted to post what i did. From the arch linux wiki, i used
nvidia-xconfig –twinview
to enable twinview, then
nvidia-settings –load-config-only
to make sure the settings pages loaded. Then in unity i went into the nvidia settings program and tweaked. Much easier then editing the x11 file manually.
Thankyou!
Followed these instructions and it worked first try.
I didn’t see the Nvida displayed but I forged ahead anyway and rebooted wherever ctrl-alt-backspace was indicated.
Mike