How To get Dual Monitors in Ubuntu with NVidia
by Stephen Fluin 2009.03.162009-03-19: There are some new responses to feedback here.
For me, Dual Monitors is an absolute necessity for a modern desktop environment. Not only does it provide you with more screens real-estate, it also extends the desktop metaphor to give you new techniques for managing multiple windows. For example, I am often opening multiple Firefox windows, or a browser and a PDF, or a document and a console at the same time, and putting them on multiple monitors, each maximized to one monitor. It would be a huge pain to attempt to do this using tiling or cascading every time I wanted to do this.
What you will need
- Two or more monitors you want to use simultaneously
- A working Ubuntu (or derivatives like Kubuntu) installation
- At least 2 heads on single NVIDIA card or multiple NVidia cards
Getting Started
You will need to use the proprietary NVIDIA drivers, but fortunately Ubuntu has packages you can use to make sure you keep getting updates as your kernel and other userland programs get updated. I have manually installed the NVIDIA drivers in the past, but my X configuration was ruined every time the restricted kernel modules were updated by Ubuntu, so it is best to use the packages.
When you start this process, be prepared to restart your X server a few times, so bookmark any URLs you are using and save any unsaved progress.
Step 1 - Install NVIDIA drivers
Intrepid Ibex (8.10) has split the Nvidia drivers into several categories, I'm do not fully understand the differences between the categories so I always end up using the latest drivers. At the time of this writing, this meant running:
If this is no longer the case, or this doesn't work, try typing sudo apt-get install nvidia-glx and using tab completion to figure out the latest package.
Step 2 - Run NVIDIA's xconfig
This step will take your existing /etc/X11/xorg.conf file, fill in any missing entries that the NVIDIA drivers will need, and switches all "nv" driver references to the proprietary "nvidia".
Go ahead and restart X either by quitting to your login manager, or by hitting CTRL+ALT+Backspace (this will work on versions before Jaunty Jackalope). This step has ruined my X configuration a few times, and I found that this means that the new drivers don't understand your monitor layout. You will need to reboot into recovery mode, remove the nvidia packages, and run sudo dpkg-reconfigure -phigh xserver-xorg. To get around this problem, I run nvidia-xconfig, and then I manually fix my xorg.conf file by adding a BusId line, correctly identifying my monitor layout: BusID "PCI:0:13:0" before restarting X.
Step 3 - Reconfigure X using nvidia-settings
You first need to install nvidia-settings if it wasn't installed with the drivers.
If you are running on the proprietary drivers, you will be able to startup a GUI for managing your configuration.
In the configuration manager, click on "X Server Display Configuration", right click on the greyed out monitors in the right pane and enable all of the monitors you want to use. If you are asked, you want separate screen sessions for each, and you want Xinerama enabled.
Click on "Save to X Configuration File" and we should be finished. Exit the nvidia-settings program and restart X again. When it comes back, all specified monitors should come on and be connected with Xinerama.
Other Notes
If anyone has any additional notes, post them in the comments and I will try to integrate them into the article.
First of all, randr doesn't work with this setup. I'm not sure if this has to do with Xinerama being incompatible with RandR, but the extension won't load with X, and you won't be able to use any of its capabilities. You will need to depend on the proprietary NVIDIA control panel for management of window layout, resolutions, etc.
Compiz doesn't work. Although your dual monitor system will be able to use OpenGL and graphics acceleration for games just fine, Compiz will not work. For some reason, about half of the advanced KDE 4.x visual effects will work. It is my understanding that anything that doesn't depend on desktop compositing will work.
In the past I have also had some intermittent issues where OpenGL wouldn't work on one of my monitors, but I believe this was a temporary driver issue that I haven't experienced in awhile.
KDE 4.x supports dragging maximized windows between monitors. Changing this in my workflow has saved me a ton of time compared to the Windows equivalent of "double click, drag, double click".
Summary
The state of dual monitor support in Ubuntu is better than or as-good-as its Windows counterpart. The bad news is that we are dependent on proprietary drivers because "nv" doesn't yet support dual monitors or graphics acceleration, but these drivers work. Hopefully soon we will have open source drivers to match the closed source ones, and this sort of thing will work flawlessly out of the box.
permalink