Ubuntu 8.04 Dual Monitor Setup
Monday, 31. March 2008, 08:35:17
Dual screen setup in Linux
One of the more difficult (read temperamental / infuriating) tasks in Linux comparative to MS Windows is the dual screen setup. I had it working in Ubuntu 7.10 by setting up one virtual desktop of size 2960 x 1050. This solution worked in most cases, with the majority of full-screen applications opening on whichever screen it was on when windowed, though some expanded full-screen over both screens. This solution was stumbled upon after much tinkering with xorg.conf, and consequently, this file was a bit of a mess. Nevertheless, I was unable to successfully setup the sort of dual resolution system I can on Windows.
With only four weeks to go before the final release of Ubuntu 8.04, I decided to upgrade my system to the latest beta. Despite the ease of upgrading an Ubuntu installation, I like to perform a fresh install when each new version is released, so this latest beta was simply an opportunity to test out some of the new features, knowing I'll be scrubbing the install in a month. One such feature was the improved support for dual monitors thanks to Xorg 7.3.
So I thought I'd try it out. After a bit of trial and error, I found a relatively simple solution.
Note: I have two LCD monitors of differing resolutions on a single Nvidia 6800 Ultra: a 22inch (1680x1050) on the DVI input, and a 17inch (1280x1024) on the VGA input. By default, Linux identifies the VGA screen as the primary screen, though I have the 22" screen in front of my chair so-to-speak, and the 17" to the right, so I have to ensure this is factored into the setup. Nevertheless, simpler configurations should work using this method, as it basically uses the following steps: start with a clean xorg.conf configuration; use nvidia-settings to automatically identify and configure you screens; save this to xorg.conf. If you are not using an Nvidia video card, then this howto will not help you.
Also, it is always wise to backup you xorg.conf before messing around with it. You can do this a variety of ways, but the easiest is in the terminal:
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
If you find upon restart that X won't start, then reverting to your old configuration is simply a matter of typing $ sudo cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf at the command prompt.
Howto
Pre: having chosen to test the new, apparently automatic, dual monitor support in Ubuntu 8.04, I started with "Screens and Graphics", which can be found at Applications > Other > Screens and Graphics.
This screenshot is actually from after the setup below, but attempting to use it to setup my dual screen configuration, upon restarting the system, served only to stuff up X. Thankfully, since Ubuntu 7.10 (and perhaps earlier), this leads to a pared-down X configuration, which had both my screens at resolution 800x600, and cloned.
My first problem, as it turns out, was that the Nvidia driver was not enabled...
Step 1: (see below for update) ensure Nvidia driver is enabled by navigating to System > Administration > Hardware Drivers.
I found that the driver was not enabled, so put a tick next to "enable". I was then asked to restart the system.
Step 2: start with a clean xorg.conf
$ sudo dpkg-reconfigure -phigh xserver-xorg
and restart X: Ctrl+Alt+Backspace, then log back in.
Step 3: install "nvidia-settings"
$ sudo apt-get install nvidia-settings
Step 4: run Nvidia Settings by navigating to System > Administration > Nvidia X Server Settings (or better still, run it from the terminal using $ sudo nvidia-settings, to ensure you can save your configuration, as I learned...)
Nvidia settings should identify your monitors, and it allows you to configure them the way you want. Clicking on "X Server Display Configuration" displays the following screen:
This screenshot shows the final configuration, but immediately after rebooting to a clean xorg.conf only the 17" screen was enabled (because it is plugged into the VGA port), and the 22" was shown shaded out and on the right-hand side.
Enabling it was as simple as clicking on it in the "Layout" box, clicking "Configure...", and choosing "Twinview". I left "Resolution" to "Auto" which gave me the optimum resolution for the screen, and under "Position" I initially chose "Left of", which swapped the screens over in the "Layout" view at the top, but then I changed it to "Absolute", which shows +0+0 for the 22" and +1680+0 for the 17".
Clicking "Apply" reconfigured my screens to the new configuration, with a 15 second countdown on which you have to click "Accept" if the new configuration works, but will automatically revert if not.
Step 5: assuming the new configuration worked - mine did, with both screens automatically identified by Nvidia - you need to save the settings to xorg.conf. Unfortunately, the Nvidia Settings application was running only with user rights. This meant an error popped up when I tried to "Save to X Configuration File". If I had started the application in the terminal using $ sudo nvidia-settings this problem, I assume would not have occured.
Nevertheless, I found an easy solution. Clicking on "Save to X Configuration" pops up this:
And clicking on "Show preview..." opens a text box with the draft xorg.conf. I simply copied the entire text, opened xorg.conf with elevated rights ($ sudo gedit /etc/X11/xorg.conf), highlighted all the text of the existing document and pasted the new one.
A restart confirmed the setup worked perfectly, and in less than 5 minutes.
UPDATE: now running a fresh install of the final release Ubuntu 8.04, a couple of additional observations. I found that immediately after installation, System > Administration > Hardware Drivers showed Nvidia driver installed but not in use. I'm not entirely sure why, because the default driver was the generic VESA driver. Step 1, above, requires installation of the driver, no matter what Hardware Drivers says. To do this, simply install nvidia-glx-new (note from the Synaptic description of the driver "If you have a TNT, TNT2, or older GeForce, you may need the nvidia-glx-legacy package instead of this one. If you have a GeForce4, you may need the nvidia-glx package."). Step 2 is redundant if you are running a clean install.
One of the more difficult (read temperamental / infuriating) tasks in Linux comparative to MS Windows is the dual screen setup. I had it working in Ubuntu 7.10 by setting up one virtual desktop of size 2960 x 1050. This solution worked in most cases, with the majority of full-screen applications opening on whichever screen it was on when windowed, though some expanded full-screen over both screens. This solution was stumbled upon after much tinkering with xorg.conf, and consequently, this file was a bit of a mess. Nevertheless, I was unable to successfully setup the sort of dual resolution system I can on Windows.
With only four weeks to go before the final release of Ubuntu 8.04, I decided to upgrade my system to the latest beta. Despite the ease of upgrading an Ubuntu installation, I like to perform a fresh install when each new version is released, so this latest beta was simply an opportunity to test out some of the new features, knowing I'll be scrubbing the install in a month. One such feature was the improved support for dual monitors thanks to Xorg 7.3.
So I thought I'd try it out. After a bit of trial and error, I found a relatively simple solution.
Note: I have two LCD monitors of differing resolutions on a single Nvidia 6800 Ultra: a 22inch (1680x1050) on the DVI input, and a 17inch (1280x1024) on the VGA input. By default, Linux identifies the VGA screen as the primary screen, though I have the 22" screen in front of my chair so-to-speak, and the 17" to the right, so I have to ensure this is factored into the setup. Nevertheless, simpler configurations should work using this method, as it basically uses the following steps: start with a clean xorg.conf configuration; use nvidia-settings to automatically identify and configure you screens; save this to xorg.conf. If you are not using an Nvidia video card, then this howto will not help you.
Also, it is always wise to backup you xorg.conf before messing around with it. You can do this a variety of ways, but the easiest is in the terminal:
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
If you find upon restart that X won't start, then reverting to your old configuration is simply a matter of typing $ sudo cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf at the command prompt.
Howto
Pre: having chosen to test the new, apparently automatic, dual monitor support in Ubuntu 8.04, I started with "Screens and Graphics", which can be found at Applications > Other > Screens and Graphics.
This screenshot is actually from after the setup below, but attempting to use it to setup my dual screen configuration, upon restarting the system, served only to stuff up X. Thankfully, since Ubuntu 7.10 (and perhaps earlier), this leads to a pared-down X configuration, which had both my screens at resolution 800x600, and cloned.
My first problem, as it turns out, was that the Nvidia driver was not enabled...
Step 1: (see below for update) ensure Nvidia driver is enabled by navigating to System > Administration > Hardware Drivers.
I found that the driver was not enabled, so put a tick next to "enable". I was then asked to restart the system.
Step 2: start with a clean xorg.conf
$ sudo dpkg-reconfigure -phigh xserver-xorg
and restart X: Ctrl+Alt+Backspace, then log back in.
Step 3: install "nvidia-settings"
$ sudo apt-get install nvidia-settings
Step 4: run Nvidia Settings by navigating to System > Administration > Nvidia X Server Settings (or better still, run it from the terminal using $ sudo nvidia-settings, to ensure you can save your configuration, as I learned...)
Nvidia settings should identify your monitors, and it allows you to configure them the way you want. Clicking on "X Server Display Configuration" displays the following screen:
This screenshot shows the final configuration, but immediately after rebooting to a clean xorg.conf only the 17" screen was enabled (because it is plugged into the VGA port), and the 22" was shown shaded out and on the right-hand side.
Enabling it was as simple as clicking on it in the "Layout" box, clicking "Configure...", and choosing "Twinview". I left "Resolution" to "Auto" which gave me the optimum resolution for the screen, and under "Position" I initially chose "Left of", which swapped the screens over in the "Layout" view at the top, but then I changed it to "Absolute", which shows +0+0 for the 22" and +1680+0 for the 17".
Clicking "Apply" reconfigured my screens to the new configuration, with a 15 second countdown on which you have to click "Accept" if the new configuration works, but will automatically revert if not.
Step 5: assuming the new configuration worked - mine did, with both screens automatically identified by Nvidia - you need to save the settings to xorg.conf. Unfortunately, the Nvidia Settings application was running only with user rights. This meant an error popped up when I tried to "Save to X Configuration File". If I had started the application in the terminal using $ sudo nvidia-settings this problem, I assume would not have occured.
Nevertheless, I found an easy solution. Clicking on "Save to X Configuration" pops up this:
And clicking on "Show preview..." opens a text box with the draft xorg.conf. I simply copied the entire text, opened xorg.conf with elevated rights ($ sudo gedit /etc/X11/xorg.conf), highlighted all the text of the existing document and pasted the new one.
A restart confirmed the setup worked perfectly, and in less than 5 minutes.
UPDATE: now running a fresh install of the final release Ubuntu 8.04, a couple of additional observations. I found that immediately after installation, System > Administration > Hardware Drivers showed Nvidia driver installed but not in use. I'm not entirely sure why, because the default driver was the generic VESA driver. Step 1, above, requires installation of the driver, no matter what Hardware Drivers says. To do this, simply install nvidia-glx-new (note from the Synaptic description of the driver "If you have a TNT, TNT2, or older GeForce, you may need the nvidia-glx-legacy package instead of this one. If you have a GeForce4, you may need the nvidia-glx package."). Step 2 is redundant if you are running a clean install.






