Overriding Screen Resolution on Xorg in Ubuntu
Posted by Daniel Paul O'Donnell (Apr 27, 11:58 AM)
One of my computers is used for a general family computer. It is an old Dell Optiplex GX 240 that I bought surplus from the University of Lethbridge. It is used for homework and games (well mostly the other way round) by our children and dual boots Windows XP Professional and Ubuntu 8.04 (Hardy Heron).
The computer is connected to two monitors through a video splitter: a Dell E153FPc (a monitor that originally came with a Dell Dimension 3000) and a Toshiba 32HL57 Wide Screen High Definition TV. The Video Splitter is a Star Tech ConvergeAV ST122LE. This is not a Dual Head setup: when both monitors are on they show the same screen. The video card seems to be some kind of generic VESA compatible.
The problem I was having involved screen resolution. When connected to the Dell monitor alone, Ubuntu (actually xorg) would default on login to 1024× 768 (the correct resolution). When connected via the splitter or to the Toshiba, however, it would default on login to 800 × 600. If I logged with only the Dell monitor attached, and then put the splitter in, both monitors would run at 1024 × 768—until I logged out and tried to log in again, at which point it would revert to 800 × 600. If instead of logging out I switched sessions (i.e. logged in as a new user while leaving my old session running using the “switch user” option on the log out screen), the resolution remained the same.
As the issue with logging in and logging out suggests, the problem lies in the detection of screen resolution on login. And that means it is an xorg.conf problem.
The relevant part of xorg.conf is the
monitor section. In Ubuntu 8.04 it looks like this on a clean install:
Section "Monitor" Identifier "Configured Monitor" EndSection
(On earlier versions of xorg there is often additional information there.)
In my particular case, I needed to change this to the following:
Section "Monitor" Identifier "Configured Monitor" Vendorname "Generic LCD Display" Modelname "LCD Panel 1024x768" Horizsync 31.5-48.0 Vertrefresh 56.0 - 65.0 modeline "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync Gamma 1.0 EndSection
Once this substitution was made and the computer rebooted, both screens displayed at 1024×768 on bootup/login.
How do you generate these numbers?
If this doesn’t work for you, or if you have a different setup or require a different resolution or other details, you may want to know how I came up with these numbers. The following is a summary of the steps I took to generate them. There may well be a more elegant method: the one I’m explaining here is a resume of my trial and error.
Step 1: Backup your
In a terminal:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.original
Do this! It is very likely that you will wreck something and need to restore your old
xorg.conf. If it is gone you’ll have a terrible time.
/etc/X11/xorg.conf.original is your backup file (you will edit
/etc/X11/xorg.conf). If you need to restore
xorg.conf (you’ll probably have to do it from a shell, since xorg won’t be working), all you have to do is:
sudo cp /etc/X11/xorg.conf.original /etc/X11/xorg.conf
Step 2: Add the appropriate device size the
monitor section of
- Backup your
xorg.conf(as in step 1 above). This is really important
/etc/X11/xorg.confin an editor (e.g. in a terminal using nano):
sudo nano /etc/X11/xorg.conf
or using gedit:
gksudo gedit /etc/X11/xorg.conf
- Find the section
Section "Monitor"in xorg.conf
DeviceSize 1024 768at the end (i.e. right before
Use Xorg’s native utility to override the plug ‘n play setting
On reboot, and before the login screen, you should get a warning that Ubuntu is running in low graphics mode.
- Choose configure
- Click on the drop-down menu box that says “Plug ‘n Play”
- Select an appropriate monitor (in my case, “Generic” and “LCD Panel 1024 × 768” were already highlighted; I tried “Dell” and “E153FPc” but I received an subsequent error message when I rebooted).
- Click on “OK” and then when you are back to the original screen, “Test.”
- Your screen will then probably go funny—lines, dots, etc. If you have an appropriate setting, you will ultimately get a window asking you if you want to keep the current configuration. (If you don’t get this window, the configuration is not appropriate and you’ll be returned to screen with the “test button”; in this case repeat steps 2, 3, and 4 until you get the “keep current configuration” dialogue.
- Save the new monitor configuration by selecting “Ok” on the dialogue that initially read “Plug ‘n Play” and now reads whatever monitor you selected. You should see a warning that Xorg is backing up your current
At this point you will probably have the original low resolution login screen and desktop. This is because xorg is giving your video card a choice of resolutions including the lower one you want to get rid of. What you now need to do is restrict the options available to xorg. You do this by opening up
/etc/X11/xorg.conf again and removing all options except the resolution you want.
/etc/X11/xorg.confin an editor:
sudo nano /etc/X11/xorg.conf
- Go to the section “Section Monitor” (which should now have much more information that the last version you edited).
- Find the series of modelines (they will read something like this:
modeline "640x480@60" 25.2 640 656 752 800 480 490 492 525 -vsync -hsync)
- Delete all the modelines except for the one you want to use as default (in my case
modeline "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync
- Save and reboot the computer
From now on your computer should boot/login with the desired screen resolution as its default.
Posted: Sunday April 27, 2008. 11:58.
Last modified: Friday December 25, 2009. 15:48.