May 12, 2007 · General · Email This Post

Sponsored Link
It's quite a pain to get dual monitors working your first time using Linux, however I hope this guide will make the process relatively quick and painless.

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!

Sponsored Link

Incoming search terms:

Related posts

96 Comments to “Dual Monitors with NVidia in Ubuntu”

  1. Suzan says:

    Thank you all.

    I managed to get it running for 2 screens and spanning accross.

    Thank you very much

    [Reply]

  2. Arunabh Das says:

    In addition to the instructions above, I followed the instructions here –
    http://www.alterzone.net/blog/2007/03/01/dual-monitors-in-ubuntu-edgy-eft-with-nvidia-card/

    Stage 1: Get the driver working! (1) Install binary driver at console (X will die on startup) a. apt-get install linux-generic (or whatever version you have) b. apt-get install nvidia-glx (2) Enable driver a. sudo nvidia-xconfig –no-composite (3) Check driver with glxinfo

    Then I altered the xorg.conf as follows –

    # nvidia-xconfig: X configuration file generated by nvidia-xconfig
    # nvidia-xconfig: version 1.0 (buildmeister@builder26) Tue Aug 1 22:01:29 PDT 2006

    # /etc/X11/xorg.conf (xorg X Window System server configuration file)
    #
    # This file was generated by dexconf, the Debian X Configuration tool, using
    # values from the debconf database.
    #
    # Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
    # (Type “man /etc/X11/xorg.conf” at the shell prompt.)
    #
    # This file is automatically updated on xserver-xorg package upgrades *only*
    # if it has not been modified since the last upgrade of the xserver-xorg
    # package.
    #
    # If you have edited this file but would like it to be automatically updated
    # again, run the following command:
    # sudo dpkg-reconfigure -phigh xserver-xorg

    Section “ServerLayout”
    Identifier “Default Layout”
    Screen “Default Screen” 0 0
    InputDevice “Generic Keyboard”
    InputDevice “Configured Mouse”
    InputDevice “stylus” “SendCoreEvents”
    InputDevice “cursor” “SendCoreEvents”
    InputDevice “eraser” “SendCoreEvents”
    EndSection

    Section “Files”

    # path to defoma fonts
    FontPath “/usr/share/X11/fonts/misc”
    FontPath “/usr/share/X11/fonts/cyrillic”
    FontPath “/usr/share/X11/fonts/100dpi/:unscaled”
    FontPath “/usr/share/X11/fonts/75dpi/:unscaled”
    FontPath “/usr/share/X11/fonts/Type1″
    FontPath “/usr/share/X11/fonts/100dpi”
    FontPath “/usr/share/X11/fonts/75dpi”
    FontPath “/usr/share/fonts/X11/misc”
    FontPath “/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType”
    EndSection

    Section “Module”
    Load “i2c”
    Load “bitmap”
    Load “ddc”
    Load “extmod”
    Load “freetype”
    Load “glx”
    Load “int10″
    Load “type1″
    Load “vbe”
    EndSection

    Section “InputDevice”
    Identifier “Generic Keyboard”
    Driver “kbd”
    Option “CoreKeyboard”
    Option “XkbRules” “xorg”
    Option “XkbModel” “pc105″
    Option “XkbLayout” “us”
    Option “XkbOptions” “lv3:ralt_switch”
    EndSection

    Section “InputDevice”
    Identifier “Configured Mouse”
    Driver “mouse”
    Option “CorePointer”
    Option “Device” “/dev/input/mice”
    Option “Protocol” “ExplorerPS/2″
    Option “ZAxisMapping” “4 5″
    Option “Emulate3Buttons” “true”
    EndSection

    Section “InputDevice”

    # /dev/input/event
    # for USB
    Identifier “stylus”
    Driver “wacom”
    Option “Device” “/dev/wacom” # Change to
    Option “Type” “stylus”
    Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
    EndSection

    Section “InputDevice”

    # /dev/input/event
    # for USB
    Identifier “eraser”
    Driver “wacom”
    Option “Device” “/dev/wacom” # Change to
    Option “Type” “eraser”
    Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
    EndSection

    Section “InputDevice”

    # /dev/input/event
    # for USB
    Identifier “cursor”
    Driver “wacom”
    Option “Device” “/dev/wacom” # Change to
    Option “Type” “cursor”
    Option “ForceDevice” “ISDV4″ # Tablet PC ONLY
    EndSection

    Section “Monitor”
    Identifier “XspedVision”
    Option “DPMS”
    EndSection

    Section “Device”
    Identifier “nVidia”
    Driver “nvidia”
    EndSection

    Section “Screen”
    Identifier “Default Screen”
    Device “nVidia”
    Monitor “XspedVision”
    DefaultDepth 24
    Option “RenderAccel” “True”
    Option “TwinView” “True”
    Option “MetaModes” “1440×900,1440×900″
    SubSection “Display”
    Depth 1
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    SubSection “Display”
    Depth 4
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    SubSection “Display”
    Depth 8
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    SubSection “Display”
    Depth 15
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    SubSection “Display”
    Depth 16
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    SubSection “Display”
    Depth 24
    Modes “1440×900″ “1280×1024″ “1280×960″ “1280×800″ “1024×768″ “832×624″ “800×600″ “720×400″ “640×480″
    EndSubSection
    EndSection

    Section “Extensions”
    Option “Composite” “Disable”
    EndSection

    ———————-
    That’s it. It worked!!

    [Reply]

  3. Greg Marine says:

    Thank you so much for this tutorial! It works perfectly for me! This is what I was looking for :-)

    God Bless <

    [Reply]

  4. Marco Fang says:

    Thank you, this is a real professional instruction on the net unlike other lame ones. Now I happily enjoy my dual monitor plus exciting 3d effects! :D

    [Reply]

  5. Hriundel says:

    Thanks a lot for the tutorial – it works perfectly for me…until I reboot. Then it enters into a low-res mode (of 800×600), and does not detect a second monitor at all. My xorg.conf remains unchanged.
    Anyone has any ideas on what might be happening?

    I have Ubuntu Hardy, GeForce 9600GT, and two Samsung Syncmasters (22- and 19- inch)

    Thanks in advance!

    [Reply]

  6. Carlos says:

    Wow!
    Finally it worked! cant believe this!
    I have a notebook and was really loosing hopes on this…..
    Its working better than windows, for the first time in my Linux experience!
    Great, thx.

    [Reply]

  7. Jay says:

    Notes about this:
    * worked well for me :)
    * the double quote marks in the web page paste as something strange in the text editor. Type it in yourself.
    * there’s an option not to display the nvidia logo- so the comment about seeing the logo may not work for you.
    * my hardy heron doesn’t have the nvidia-settings program.

    [Reply]

  8. Sébastien says:

    Hello!

    Thanks for the post. I setup my two monitors using nvidia-settings and everything works like I want, but I have one little problem. The second screen isn’t always available (used by my girlfriend’s computer when she’s here). My question is, how can I easily switch dual/single monitor configurations?

    [Reply]

  9. Jon says:

    Ok, I have an 8800gtx and Ubuntu 8.04 and dual monitors went up automatically. However they are just clones. What do I have to do in order to get them to work independently? Thanks.

    [Reply]

  10. Matiz says:

    modestmelody, Thanks a lot for your effort. It works for me too!!! Cheers!

    [Reply]

  11. Garbonzo says:

    Man, thanks! Tried a few, way more complicated tutorials before I found this one, with no luck. This was simple and it worked. Mo honor!

    [Reply]

  12. Gabriele says:

    Thanks a lot!!! fast, sharp and smart.

    [Reply]

  13. Thanks man ;D

    It works 100% here.

    You’re the man !

    [Reply]

  14. A great tutorial, pretty easy to follow, in less than 5 minutes I got compiz running with no problems. The restricted drivers installer that Hardy ships makes this even more easy. Great blog, I’m adding this to my feeds.

    [Reply]

  15. miriyala srinivas says:

    i am not able to find “nv” word after typing sudo gedit /etc/X11/xorg.conf ,
    please help me out

    [Reply]

  16. Vivien says:

    Perfect tute- thank you!

    [Reply]

  17. Adrya says:

    Worked like a charm – thanks!

    [Reply]

  18. calvin says:

    I have also gotten dual monitors to work on my dell latitude D830 laptop. Like post 38 above, by sabastien, I have only duel monitors at work, when I bring the laptop home, I lose the second screen. I would like to easily be able to switch between screen configurations, and by easily I mean I’d like it to auto-detect, or at the very least be able to save the configurations to be able to switch at the press of a button.

    Currently I use EnvyNG to install my drivers, which installs the NVidea Config tool. Starting this I can enable/disable the extra monitor. If I forget to do this before I leave work I cannot change it till I get back to work because the menus are all on the left of the screen, which is where my second monitor would be. I know nobody else leaves work in a hurry. j/k

    It would even suffice to have 2 users use different monitor configurations, is this possible?

    Is any of this possible?

    [Reply]

  19. Rick Pember says:

    Thank you! This worked exactly as advertised. My immediate reason for looking for a solution like yours was that I was suffering from random crashes back to the login screen, which I finally narrowed down to two or more glx apps (like glxgears) running simultaneously. I looked at what I had done months ago, and discovered I was running the Mesa drivers. Why, I asked myself? Well when I tried again installing the non restricted Ubuntu Nvidia drivers (using the synaptic package manager — yes, I’m a weeny) I couldn’t even get one glx app to run — got a strange messsage about the display not being glx enabled. (The mesa drivers had worked just fine for me, other than being slow and this random crash problem.) So I then retried the restricted drivers — these did work but I couldn’t get the nice “clone” look I had gotten for free under the Mesa drivers. Well your solution got it all working. I’m sure a much more clever person than me could have gotten the non-restricted drivers to work, that being the Ubuntu way, but your way was the path of least resistance (and least thrashing/wasted time.) Thanks again. BTW, I’m running Gutsy on a Dell Precision M6300, with a Dell LCD second monitor.

    [Reply]

  20. bramlet says:

    You no longer have to modify xorg.conf manually when getting dual monitors set up. The nvidia-settings program mentioned in an earlier comment does all the heavy lifting. The only issue is you must run it from termial with gksudo to save the xorg.conf file. The settings program doesnt come in with the nvidia drivers so you will have to apt-get it first.

    [Reply]

  21. Jordan Garn says:

    Thanks for the good tutorial, I got it working, however I’m having a problem with my laptop, instead of making the Laptop screen the primary monitor it makes the Second Monitor the Primary monitor, how do I choose which one is primary monitor?

    [Reply]

  22. Richard says:

    Let me add my thanks for your excellent guidance.

    It works as described.

    I had to go through a couple of steps to get the drivers downloaded and installed…

    a hint to others: if you edit the xorg.conf file and do not find the ‘nv’ ‘glx’ and ‘nvidia’ labels already in place, reload the appropriate driver using “hardware drivers” and restart ubuntu. The xorg.conf file should be updated with the nvidia-specific entries so that you can go through the remainder of the editing steps.

    Thanks again!

    [Reply]

  23. Joy says:

    Thank you so much! It works perfectly now! You have just made my life so much happier. Thank you, sir.

    [Reply]

  24. Franklin says:

    These instructions solved my duel monitor issue. Thanks, franklin

    [Reply]

  25. maxwell says:

    Hi,

    i fight since hours but at the end my twienview looks not so great :-( … i have two different resolutions 1600×1200 and 1280×960

    Here a part of my xorg.conf:

    Section “Screen”
    Identifier “Screen0″
    Device “Videocard0″
    Monitor “Monitor0″
    DefaultDepth 24
    Option “TwinView” “1”
    Option “HorizSync” “DFP-0: 30.0-83.0; DFP-1: 30.0-81.0″
    Option “VertRefresh” “DFP-0: 56.0-76.1; DFP-1: 56.0-76.0″
    Option “metamodes” “1600×1200, 1280×960@1280×960 +1600+240″
    Option “AddARGBGLXVisuals” “True”
    SubSection “Display”
    Depth 24
    Modes “1280×960″
    EndSubSection
    EndSection

    Now i start my x-server but the second monitor run in a resolution of 1280×1200 … so i can not see all parts … so i add “+240″ to see my taskbar …
    can anybody help me or has the same probs :(

    Thanks a lot in advance.

    [Reply]

  26. Erik says:

    Many many thanks!
    This is the first time I’ve configured Linux for dual screen this quick and without any hassle at all!

    [Reply]

  27. Ristretto says:

    Excellent post, thanks!! One problem…

    Got a Dell D830 here, using nvidia-setting to configure second monitor when I need it.

    But, some menus open on the other screen.

    When I use menus on a window that is on the secondary monitor (not the screen that I set ‘Make this the primary display for the X screen’ on), the menu’s open on the primary screen at the edge closest to the secondary one. Would like them to open in the normal place below the pointer.

    Any ideas? Thanks!

    [Reply]

  28. Javier says:

    Worked for me as well. Thanks a lot!

    [Reply]

  29. Tony says:

    Worked for me as well.

    Thank you very much.

    [Reply]

Leave a Reply