Forward to Navigation

Overriding Screen Resolution on Xorg in Ubuntu

Posted by (Apr 27, 11:58 AM)

The setup

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

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.

The solution

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 /etc/X11/xorg.conf file

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 /etc/X11/xorg.conf

  1. Backup your xorg.conf (as in step 1 above). This is really important
  2. Open /etc/X11/xorg.conf in an editor (e.g. in a terminal using nano):

sudo nano /etc/X11/xorg.conf

or using gedit:

gksudo gedit /etc/X11/xorg.conf

  1. Find the section Section "Monitor" in xorg.conf
  2. Add DeviceSize 1024 768 at the end (i.e. right before EndSection)
  3. Reboot

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.

  1. Choose configure
  2. Click on the drop-down menu box that says “Plug ‘n Play”
  3. 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).
  4. Click on “OK” and then when you are back to the original screen, “Test.”
  5. 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.
  6. 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 xorg.conf file
  7. reboot

Fine tune /etc/X11/xorg.conf

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.

  1. Open /etc/X11/xorg.conf in an editor: sudo nano /etc/X11/xorg.conf
  2. Go to the section “Section Monitor” (which should now have much more information that the last version you edited).
  3. 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 )
  4. 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
  5. 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.

----  

Comment [12]

  1. Lyndon (Sun May 4, 2008 (22:04:25)) [PermLink]:

    Thank you so much! This works like a charm.

    Previously I could only get ‘visual effects’ at 640×480 on my 52 inch plasma, which totally sucked. Now I’m never going back to windows :)

  2. Jim (Mon Jul 7, 2008 (10:17:32)) [PermLink]:

    I would like to use this space to express how much I appreciate this blog, both for its content, but more pointedly, for its literary style and composition. Seldom, on the internet, does one actually enjoy reading through the murdered prose, emasculated punctuation, text-speak spelling and less-than-logical development of the subject to finally reach an “uninformative” conclusion. This article is a pleasurable exception to that indictment. So, please, keep up the good work!

  3. dan (Thu Jul 10, 2008 (16:06:53)) [PermLink]:

    Well that’s enough praise to make me fix the typos. Thanks (blush).

  4. Nick (Sun Jul 27, 2008 (10:46:30)) [PermLink]:

    Dan! You really helped a Linux Newbie out here! On day 2 of Linux, this is a pretty daunting task, even for someone who considers themselves pretty PC literate (in the Windows world, anyway). Your description doesnt assume you know anything about Ubuntu (which I dont!) and that means it worked first time! All this now means that I can actually SEE the login screen! Thanks again!

  5. Matthew (Sun Dec 14, 2008 (23:42:35)) [PermLink]:

    looked all over for what I needed. Finally found it here. THANK YOU!!!!

  6. seek8" (Tue Feb 3, 2009 (04:41:44)) [PermLink]:

    what’s best for my netbooks with 8” lcd??
    how to set? thank you.

  7. dan (Fri Feb 6, 2009 (20:58:32)) [PermLink]:

    I don’t know the answer. My netbook screen works as is.

  8. Landob-Jamaica (Fri Dec 18, 2009 (12:56:21)) [PermLink]:

    Bredren you are the boss. Worked like a charm. My mistakes were from the start where I was adding an additional monitor and making reference to it in the screens section. This was really helpful.

  9. Don (Wed Dec 23, 2009 (13:36:03)) [PermLink]:

    When I did step 2, I added “DeviceSize 1280 1024”. When Ubuntu 9.10 booted it, put me into a shell to login (newbie may not be the right term). But I could not get into Ubuntu. I reverted to your great backup of the original! Any ideas?

  10. dan (Fri Dec 25, 2009 (15:45:03)) [PermLink]:

    Don, That’s usually a sign that something is seriously wrong with your xorg.conf—meaning that whatever you did, it didn’t just mess up the bit you think you changed.

    What editor did you use? I once had hours of trouble because the editor I was using (nano) was truncating lines when I cut and pasted text in my configuration file (not its fault: that is the expected behaviour, I just didn’t realise what the problem was). It took me hours to find the problem.

  11. matt (Tue Feb 2, 2010 (16:15:36)) [PermLink]:

    I NEED HELP! i put the resolution on my computer higher and now the screen doesnt work!! I need to change the resolution back but dont know how! BECAUSE WHEN I LOG IN the monitor screen doesnt work!!!! HELP????? you can write me at lilspeedymat@hotmail.com
    please help me

  12. matt (Thu Feb 4, 2010 (11:16:49)) [PermLink]:

    Have you tried a remote login? I.e. via ssh? This sounds like a monitor problem. You should always have the option of going to a shell or safe gnome. If you log in remotely, you won’t have any issues with the monitor not working.

:
:

Textile Help

Back to content

Search my site

Quick links for students

Tags

anglo-saxon studies, computers, digital humanities, digital pedagogy, editorial studies, english 2810, exercises, grammar, history, linguistics, medieval studies, moodle, morphology, old english, pedagogy, students, study tips, testing, tips, tutorials, universities, yii

See all...

Follow me on Twitter

Recent changes to this site

At the dpod blog