E-Mail:

Dual Monitors With Ubuntu

Over and over, I hear people asking me “how do I get dual monitors working in Ubuntu“. Well today, I will show you (note the video) how to make this easy with a fairly modern NVIDIA card, two flat screen LCDs (one DVI, the other VGA) and a little understanding how getting two monitors working in Ubuntu Linux is a snap, once you understand the basics.

What you will need for this:

  • NVIDIA based video card that supports dual monitors.
  • Based on most video cards, one DVI monitor and one VGA – in my case, my LCDs meet these needs. Dual DVI might work too, have not tried it.

Download full size Quicktime video here

(Sorry about the video cropping, Hipcast did a little size trimming)

Before getting too far ahead of ourselves though, you will want to install the envy_0.9.5-0ubuntu2_all.deb package and download this script (right-click, save as) to your desktop as well. The reason for the little bash script is that changes made to nvidia-settings will not keep, without first running as sudo.

59 Comments

Nice intro, though you should show off beryl/compcomm, that’s what makes a Linux Desktop kick that pants off of windows/mac. I have a dual screen setup with Beryl atm, and I absolutely love the flexibility.

(my boss now wants me to setup his quad LCD with beryl, I can’t wait to see how it looks)..

well im not exactly a ubuntu hater, i decided to install it, but i have to say most of the things im required to do something simple go far beyond my capabilities and willingness to fiddle with config files. im sad to say bye bye ubuntu but im going back to xp.

Rene: I hear ya, Ubuntu is not for everyone. You tried it, found that getting things to work as needed was not happening the way you wanted them to. Nothing wrong there, XP is indeed, a better choice for many people.
The only thing I can comment on about this is that no one should ever go in and expect any OS to behave as one they have been used to otherwise. For instance, I have been critical of OS X in the past, which was silly of me being I was expected it to “behave” like Linux or Windows. I missed certain things that might seem silly to others out there.
I think the same applies here. Linux is a much more “hands on” experience than XP. And for a lot of people, it is just not a good match. But that doesn’t mean that looking into a Mac Mini might not be something to consider? Again, thrilled you tried it and hope you at least came away better informed from the experience. :)

Thank you so *** much. Earlier i crashed my whole computer trying to do a dual monitor setup. but after watching your vid, it finally worked. thx (ps beryl looks weird with two different sized monitors)

I just watched the video and am wanting to give it a try. But before I do, I wanted to find out if it will be possible to rotate the second display as I like to have the monitor turned to the portrait orientation. I’m on a Dell XPS laptop with an external monitor on the DVI port.

Nate: Just so I know I have this right. You are asking if this supports taking the monitor (LCD screen, etc) from a horizontal view to a vertical one?

Also, external ports on notebooks designed for Windows do not work well at all in Ubuntu.

Correct.

Hmm… Well, maybe I’ll clone my drive first and then give it a shot. Thanks for the help!

the setup worked really great, i got my second monitor to work no problem, but then when i rebooted my computer and wen into ubuntu it gave and error that x was not configured correctly, and that it couldn’t find any monitors. after which it led me into the terminal interface.
how do i get my x window back?? any help is appreciated.

Roelof: Tons of variables here: which Ubuntu release, what video card and which version of Envy? :)

Obviously, it is a bit difficult to determine which version of Envy, so look to the website and let me know if you used the newest releases (Envy New envy_0.9.8-0ubuntu8_all.deb or Envy Legacy envy_0.9.8-0ubuntu9_all.deb)?

If this was used on Gutsy, read this post:
http://albertomilone.com/wordpress/?p=107

Remember, much like Vista, Gutsy may be officially released, but it should not be used as a mainstream box unless Feisty was failing you.

I use Feisty on my PC and Gutsy on my notebook.

im using ubuntu dapper drake (6.06) my video card is a nvidia GeForce 7600 (dual Dvi) and i used the “envy_0.9.8-0ubuntu9_all.deb” envy package.
i also still have a backup of the original xconf file, maybe there is a way to restore that, and then start from scratch? i also have two of the same monitors, could this create any problems when running on a dual dvi card?

Roelof: Could be that card on Dapper with the legacy Envy install. I do not have Dapper on anything other than a server. The 7600 ought to be fine, even with two of the same monitor. When setting this up – it’s key to make sure that both monitors are recognized in the nvidia-settings tool and you have things set to twinview. You did run nvidia-settings with sudo? Otherwise nothing would have stuck.

To restore your xorg, do this:

Restore
1) boot and see GRUB, then hit Esc, choose (Recovery Mode)
2) type cd /etc/X11/
3) type ls (that is L lower case)
4) Look for something *like* xorg.bak or name of back-up file
5) Type nano name-of-file-to-restore
6) This opens up a command line text editor.
7) Hold Ctrl and press “o” (not zero, O).
8) Rename the file to xorg.conf
9) It’s ask to overwrite, choose Y
10) Now press Ctrl X and then back at the command prompt, then power down PC then restart it.

Again, I would be interested in seeing if you had the driver installed at all, as it should work fine, even in Dapper. In nvidia-settings, make sure you are running as sudo. Make sure that you have actually used the tool to detect the monitors (are they showing up right), hit the *apply* button when finished and remembered to *write it to the xorg.conf* from the tool as well. It will prompt twice when writing it to the xorg. If this did not happen, this is why it failed. :)

Thanks, i restored the old xorg, and then it booted without any problems, and then i went bak into the nvidia settings and enabled the second monitor, and now even after rebooting everything works!!!
Thank You

hi matt, nicely made video. i’ve been stuck with windows xp for some time now (family computer) but have recently put together a box and am dual booting xp and the latest release of xubuntu with grub. it’s been a long time since i’ve been able to use ubuntu (the last version i had installed was before any of the x, e or kde variants). recently i’ve been using twin screens as the monitors i have at my disposal only support up to 1024×768 and coming down from 1280×1024 and up is frustrating. i’ve become used to working with two screens and would like to set up my linux install for it, even after i can upgrade my hardware, so any help is appreciated. i’m very rusty with linux, however i need this to change and i’m eager to get back to it, so i have a question about this tool.

i’ve been using two video cards so far and they’re a little dated, but still working well enough. i have a geforce 4mx 4000 in the agp slot and a geforce 4mx 440 in a pci, and both monitors are vga. i’m wondering if this tool will be of use to me as i’m not using a single card with dual outputs, or if i should look elsewhere.

thanks in advance for any help.

I have followed all the steps in the video (out standing way to do this, by the way!) and got to the point where I am running “settings”. I enable the second monitor, and when I select “enable”, I get the following error:

“Failed to set MetaMode (4) ‘CRT-1: 1280×1024@60 @1280×1024 +0+0, DFP-0: nvidia-auto-select @1680×1050 +1280+0′ (Mode 2960×1050, id: 53) on X screen 0″

It asks “Would you like to remove this MetaMode?”. Selecting either Yes or No has no affect on the display….display 2 still will not come up.

I am using an Nvidia NV25GL Quadro 4 700XGL rev A3
Display 1 : Dell 2000 FP running on VGA,
Display 2 : Dell 20WFP on DVI.

Any suggestions?
Thanks…

Well, I figured out my problem as posted above…I did not have write permission for the xorg.conf file, until I ran it in super user mode…a hint which I found while researching this problem on the Ubuntu forums…for other newbies, you can run graphics programs like nvidia-settings in super user (sudo) mode by pressing ALT-F2, and entering GKSU nvidia-settings.

This allows you to run the program as a super user, with write privileges on the CONF file…

Jim: Quote from the article above:

“Before getting too far ahead of ourselves though, you will want to install the envy_0.9.5-0ubuntu2_all.deb package and download this script (right-click, save as) to your desktop as well. The reason for the little bash script is that changes made to nvidia-settings will not keep, without first running /as sudo/.”

;)

Well, that would do it…

I have the biggest part of my problems solved, the dual monitors are working fine now, but does anyone know if you can use one monitor in Vertical mode? I would like to use my Wide FP in vertical mode for text editing…I actually saw a “Greyed-out” solution for rotating the monitor once or twice while fussing with getting Dual Monitors set up, but can’t get back to that now! How fustrating….but thanks for the help…

Had to uninstall xserver-xgl !
I couldn’t get dual monitor to work – I was getting this problem “Every time I try to
sudo nvidia-settings
it tells me

You do not appear to be using the NVIDIA X driver. Please edit your X configuration file (just run `nvidia-xconfig` as root), and restart the X server.”
until I uninstalled xserver-xgl as per this advice “Are you running xserver-xgl? Try uninstalling it, if so. I had that same message while stuggling to get things working, and I think uninstalling xgl was the trick.” at http://ubuntuforums.org/showthread.php?t=583214 .
Nigel

THANK YOU! for the video. I’m new to Ubuntu/Linux and it has taking me about 7 hours over a period of three days to get the dual monitors setup working. This is probably the 10th website or tutorial I visit and finally your instructions are the only ones that worked. I just started using Ubuntu a month ago and I have gone from the initial love at first site feeling to the I am frustrated but determined feeling.

Thank you you’re the man

Next on the list getting Galleon to work :)

Thanks a lot for this Matt! following the video everything worked perfectly. I now got my laptop and external widescreen set up exactly as i want it.

hey all seems to go well until i hit apply in the x server settings when I get this message:

“The XRandR X extension was not found. This extension must be supported by the X server and enabled for display configuration settings to be dynamically applicable.”

help!?

oisnT: After backing up the /etc/X11/xorg.conf file as xorg.bak (important), then try this:

Try this. In a terminal, paste in this:

gksudo gedit /etc/X11/xorg.conf

Then in that file, locate….

Section “ServerFlags”
Option “Xinerama” “0″
EndSection

Make sure Xinerama is marked at 0 and not 1. You can then either restart X or simply reboot. Understand that if this fails and X crashes, comment back here and I can tell you how to restore your backed up xorg.conf file.

Thank you very much. I was having a lot of troubles getting my dual Dell monitors to work. Your instructions were clear and worked for me.
I am using Nvidia Geforce 7300 LE and Ubuntu 7.10.

I was able to go as far as reloading the “synaptic package manager”, but when I did that, an error message poped up”Could not download all repository indexes”, does anyone have the similar problem as I have? Thanks

Thank you very much, I just got it working. You explanation is simple and easy to follow, much easier than working with xorg.conf for hours. To those who are trying to get the extended monitor working, this instruction really works!

Hi. I got this error when I tried to apply:

Failed to set MetaMode (4) ‘CRT-0: 1024×768@60 @1024×768 +0+0, DFP-0: 1024×768@60 @1024×768 +1024+0′ (Mode 2048×768, id: 54) on X screen 0

Would you like to remove this MetaMode?

anyway Jim Green – December 8, 2007 @ 8:07 am wrote:

Well, I figured out my problem as posted above…I did not have write permission for the xorg.conf file, until I ran it in super user mode…a hint which I found while researching this problem on the Ubuntu forums…for other newbies, you can run graphics programs like nvidia-settings in super user (sudo) mode by pressing ALT-F2, and entering GKSU nvidia-settings.

This allows you to run the program as a super user, with write privileges on the CONF file…

——————————————————————————-
Can you explain step by step how to configure this? Thanks :)

fabian: Ya, the super user issue is covered by the provided script linked above:

#! /bin/sh -f
sudo nvidia-settings

gksudo is even better if you like. ;)

So are you still getting errors?

As long as you always make darn sure to back up your xorg.conf ( I keep extra copies both locally and on a thumb drive), I would apply whatever is needed with the UI. Understand this however – I make no promises when using nvidia-settings on a xorg.conf that has been manually altered in some way or if you are using Heron, as I have not tested it yet.

Hi there matt. When i typed the commands that you gave at the terminal, it leads me to the nvidia x server settings. I configured again and still have the errors.

Anyway, I’ll try to figure on my own abit more. Sorry about that, but I lack of understanding of many terms in Linux (having no background on computer). I am using ubuntu 7.10.

Your video is very useful to people like me though. Good job.

fabian: Might be able to help, but would need to know what the errors actually are.

-Is it a popup, what is being said?
-How was the driver installed? Restricted Driver Mess, er, Manager? Envy?

Thanks Matt, another satisfied laptop w/external display user here.

Hi there.

1. Yes, its a pop up, when I tried to ‘apply’ it.
2. Driver installed through Envy according to your video. Tried remove and re-installed it.

I am using Ubuntu 7.10 with nVidia FX5500. Hope this helps.

The pop-up said, ”Failed to set MetaMode (4) ‘CRT-0: 1024×768@60 @1024×768 +0+0, DFP-0: 1024×768@60 @1024×768 +1024+0′ (Mode 2048×768, id: 54) on X screen 0

Would you like to remove this MetaMode?”

Fabian: Before doing anything, ensure you have a backup of your xorg.conf. This way if we hose things, you can boot to a command line using PICO and restore the back-up xorg file. Again, ensure you have a xorg.conf backup and you have it in the same directory and you name it so you remember it’s name.

With the backup, go ahead and try out following through with the prompt understanding that it may very well hose something. Never had this issue myself, four different NVIDIA cards here, but it has happened to others. Make sure you have access to another PC to come back here with if needed.

Another option, that may yield better results is trying

sudo dpkg-reconfigure -phigh xserver-xorg

Matt
Great tutorial. Easy to follow. I am almost there. This is what my conf looks like after running Envy. IDFP-1 is not wotking at all. Works during boot but goes away when x starts. Any suggestions?
# Removed Option “TwinView” “0″
# Removed Option “TwinViewXineramaInfoOrder” “DFP-1 CRT-0″
# Removed Option “metamodes” “CRT-0: nvidia-auto-select +0+0″
# Removed Option “metamodes” “CRT-0: nvidia-auto-select +0+0, DFP: 1280×1024 +1280+0″
# Removed Option “metamodes” “CRT-0: 1280×1024 +0+0, DFP-1: 1280×1024 +1280+0″
# Removed Option “TwinView” “1″
# Removed Option “TwinViewXineramaInfoOrder” “CRT-0, DFP-1″
# Removed Option “metamodes” “CRT-0: 1280×1024 +0+0, DFP: 1280×1024 +1280+0″
# Removed Option “TwinView” “0″
# Removed Option “metamodes” “CRT-0: 1280×1024 +0+0″
# Removed Option “metamodes” “CRT-0: 1280×1024 +1280+0, DFP: 1280×1024 +0+0″
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
Option “UseDisplayDevice” “CRT-0, DFP-1″
Option “TwinViewOrientation” “DFP-1 RightOf CRT-0″
Option “TwinView” “1″
Option “TwinViewXineramaInfoOrder” “CRT-0, DFP-1″
Option “metamodes” “CRT-0: 1280×1024 +0+0, DFP: 1280×1024 +1280+0″
EndSection

Section “Screen”
Identifier “Screen1″
Device “Videocard0″
Monitor “Monitor1″
DefaultDepth 24
Option “TwinView” “0″
Option “metamodes” “DFP: 1280×1024 +0+0″
EndSection

Chris: Err, let me see. Things looks pretty messy. I am seeing some things that looks like they are being set wrong. If it was me, I might consider starting off with a clean xorg.conf.

Reboot out of X and sudo dpkg-reconfigure xserver-xorg

Here is what my section of that part of xorg.conf looks like:

Section “Screen”

# Removed Option “metamodes” “DFP: 1280×1024 +0+0″
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
Option “TwinView” “1″
Option “metamodes” “CRT: nvidia-auto-select +1280+0, DFP: 1280×1024 +0+0″
SubSection “Display”
Depth 24
EndSubSection
EndSection

No idea what could be giving you that problem. In the GUI for nvidia settings, I have the following:

Two monitors detected.

Configuration: TwinView

Monitor left: 1208*1024
Position: Absolute +0+0

Monitor right: Auto
Position: Absolute +1280+0

This is what I end up with after a fresh install. There are some obvious differences. I will continue to play with it and thanks again for your suggestions!
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
Option “TwinView” “1″
Option “TwinViewXineramaInfoOrder” “CRT-0″
Option “metamodes” “CRT-0: 1280×1024 +0+0, DFP: nvidia-auto-select +1280+0; CRT-0: 1280×960 +0+0, DFP: nvidia-auto-select +1280+0; CRT-0: 1152×864 +0+0, DFP: nvidia-auto-select +1152+0; CRT-0: 1024×768 +0+0, DFP: nvidia-auto-select +1024+0; CRT-0: 800×600 +0+0, DFP: nvidia-auto-select +800+0; CRT-0: 640×480 +0+0, DFP: nvidia-auto-select +640+0″
EndSection

Chris: Sounds like a plan. Again, knowing that trying to edit the Xorg.conf is a fast track to nowhere, I would again take the GUI approach and verify that the following are in play.

GUI for nvidia settings, I have the following:

Two monitors detected.

Configuration: TwinView

Monitor left: 1208*1024
Position: Absolute +0+0

Monitor right: Auto
Position: Absolute +1280+0

If you did exactly this above, then you can fool with the conf file, but if you following the GUI instructions above with a clean Xorg.conf, there is no reason why it should not work fine.

Thank you.I did it!!!!!!!!!!!!!!!

very nice video, helped a linux noob out :).. love how you explain everything in a clear and user friendly fashion. great work dude, I appreciate this. :)

Anyone know where to Download the packages he is on about.

Thanks

Mr. ?:

Quote from above in the article:

“Before getting too far ahead of ourselves though, you will want to install the envy_0.9.5-0ubuntu2_all.deb package and download this script (right-click, save as) to your desktop as well. The reason for the little bash script is that changes made to nvidia-settings will not keep, without first running as sudo.”

The link marked envy_0.9.5-0ubuntu2_all.deb is where you get the package and nvidia-settings comes with it AFTER you use Envy to install the driver.

The hyperlink above marked “this script” is also fairly obvious. ;)

Thank you!!!! :D :D
Don’t ever delete this post, it was beautiful!!!

Now running ubuntu 8.04 with dual screen! :D *celebrating!*

Can’t say it enough: THANK YOU!! :D

And it was so easy! :)

I can’t get it to save changes. running in terminal etc.
can’t change old con fig file, can’t apply all changes
I am new to ubuntu (10 days), am I misi’n something?

looks like old config file is the problem, how can I replace it?

Rene G: Just rememebr when you first started a PC with Windows – it was hard to use, you didnt know what to do and when you got started you had issues with this and that….

Its simply the learning curve and Ubuntu is the same.
Whilst I *know* how to do terminal and config file editting, I only use the Desktop (“Windows”) programs as I want to use this as a “newbie” would.

The HARDEST part of Ubuntu is starting. Everythig else is wonderfully easy. I would recommend sticking it out and using Ubuntu… I believe wholeheartedly that Ubuntu can be used for 90% of all Windows Users (email and internet browsing).

Just my 2 cents worth

i want to thank you for this tutorial!

i’ve had two vga monitors on my desk for so long but i only used dual video mode in winxp. whenever i booted into ubuntu i had to settle for one monitor until i came across your tutorial

i’m a novice linux user but i was able to follow this step by step without encountering a single problem.

http://navetz.com/v/132/Simple-dual-monitor-setup-with-XrandR-in-Ubuntu-Linux

Thats a link to a site on dualscreening useing XrandR that I think might be helpful. I had tried everything and finally adding 1 xorg line and writing a small script fixed my dualscreening issues.

Thanks a zillion. This is what makes the Linux world so great. Sharing information for the good of all.
Actually I got an extra benefit. I need to process documents in Hebrew and the fonts that got downloaded are so much better than the ones in the standard Ubuntu distro.
It was worth doing this exercise just for that.
Thanks again,
David

ok i cant download the script. when ever i click on it or try to save up it simply comes up as not found, is there any other location i can find it at or could someone email it to me, either would be a great help.

yea, i have the same problem. when i save the script, it turns up on my desktop as a html file. i tried to save it as settings.sh and it changed it to a shell script, but it was still to big and didn’t do anything when i tried to run it. if we could get a new link to the script, that would be great!

Mouse and Mike: Script is fixed, the url was broken but repaired now.
http://www.computertroubleshoot.com/settings

Download it and then right click the icon for it to goto properties, then make it executable. :)

Hi Matt.

I followed your tutorial to make my second monitor work as an extension of my laptop screen but I can’t. When I choose the second one to be in the right of my first one, the first one becomes “absolute” what makes all windows to stretch through both screens.

I am new to Ubuntu, actually this is my first day using it, just finished installing it. I would like to use both monitors independent from each other. Leave an eclipse window open in one screen while a website in another screen. But it is stretching, it is considering both monitors together as a one big desktop.

Could you have any hint to fix this issue?

Thanks a lot!

Denis: Hi there,

I am assuming you are using an NVIDIA card in the notebook based on getting both the settings manager and the monitor to work at all? I am also assuming you are using Ubuntu 8.04 Hardy Heron, not the Release Candidate 8.10 Intrepid?

Either way, while I have been able to do what you are describing with a Intel video chipset, I have never tried this with an NVIDIA card for a notebook – always as two separate monitors for a tower.

This being said, something to test out might be as follows. Using nvidia-settings, put things back to what they were from the start. Single monitor on the notebook.

Save to xorg (I think it is labeled as save to file), then ctrl-alt-backspace to restart the video (technical term is restarting X Server).

Turn the notebook off and then plug in the VGA cable for the external monitor to the notebook. Start the notebook up.

Now that things are back to where they were, let’s try going to System>Preferences>Screen Resolution. In theory, you should see two monitors. If you don’t, then NVIDIA is not having any of this and we can forget it.

If you do however, and keep in mind that this is up to the video card vendor, not Ubuntu specifically, cool. Try toggling “clone screens”. If it works…and it may take a few seconds for it to kick onto the monitor, choose “keep settings”. If it does nothing, choose “previous settings”. If it scrambles your view to being unreadable, restart X as described earlier.

In the end, realize that you may very well be out of luck. Good luck!

Hi there Matt,

I was wondering if this would also work on a laptop (i realise this might be a stupid question but i thought it be better to ask :)
Cheers

Mike- With Intel video, yes, there seems to be good support for the VGa output port to a outside monitor. With ATI/NVIDIA, it is possible, be it less likely.

Sure worth trying though, but you will likely want to try this way.

With notebook OFF, plug in the external monitor, turn on notebook with the monitor on or off, does not matter yet as nothing is going to show yet.

On the notebook, login to your Ubuntu user, again, outside monitor still not working, this is normal.

After login is completed, if your notebook is like mine, you will see Ubuntu suddenly appear on the outside monitor automatically. If this does not work, chances are slim you will get it working without screwing with your xorg.conf…even then, it is unlikely.

Hi Matt
Can’t get that script to download from either link.
Your work is great , thank you.

Thank you SO MUCH! This is a great service to the community. I’ve been trying to get two monitors for a month now and this finally did it for me! I have to give your props man, this was easy to follow and every step was explained. thanks a million. (now I can have eclipse take up one monitor and research articles on the other one)

Look this – > http://saulocastelo.net.br/wordpress/?p=76

Automatic Dual Monitor in Portuguese ;)

What Do You Think?