HOWTO: change resolution/refresh rate in Xorg

IMPORTANT: This is a very old howto (2005), please check more recent documentation for your version of Ubuntu if you need assistance with setting up Xorg, display resolution or anything like that. This howto is not up to date.
------------------------------------------------------------------------------------------------------------------------------------Howto: change resolution/refresh rate in XorgIf you can't change your display resolution or refresh rate (no desired option available) these instructions may help.

Backup your configuration file

Code:

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup

How to reconfigure XorgNotice that auto detection of devices works best if Xorg is not running. Therefore it's recommended to stop X before reconfiguring this will put you to text only mode / command line:

Code:

sudo /etc/init.d/gdm stop (or kdm for KDE)

You can do the whole X configuration process by entering:

Code:

sudo dpkg-reconfigure xserver-xorg

To start Gnome/KDE again:

Code:

sudo /etc/init.d/gdm start (or kdm for KDE)

How to test configuration without restarting X?See this excellent tip from henriquemaia (Thanks!) How to edit xorg.conf file
Run in terminal or console:

Code:

sudo nano /etc/X11/xorg.conf

online help in nano: ctrl+g (ctrl+x exits)

Where is the log file, how to debug?File:

Code:

/var/log/Xorg.0.log

contains lots of invaluable debugging information about what's going on as Xorg starts. Watch for lines with EE (errors) and WW (warnings).

How to edit or add HorizSync and VertRefresh lines
Find your monitors manual (manufacturers website and Google are useful).
Look for hozizontal sync and vertical refresh rates, also if bandwidth or maximum dot clock / pixel clock is mentioned, write it down.

Watch that the hsync is in range with the HorizSync on the same section (in this example the range is 31-101 and this modelines hsync is 60.15, so we're safe). Also the VertRefresh and the refresh rate you selected (75Hz in this example) should match - in this example VertRefresh is 60-160 and modeline is 75Hz, so that's all good.

Now you can select the default resolution and colordepth by tweaking the Screen section. It should look something like this:

Monitor name here (CM752ET) matches the Identifier on your Monitor Section. Device line here matches the identifier on your Device section - you get the idea? It ties together some settings for your screen - the graphics card and your monitor. You may have more Subsections here, but only one is needed.

Change the DefaultDepth to what you would want it to be, 16 (65536 colors) or 24 (16M colors). Change the Modes line to match the resolutions you want to use - Depth must match DefaultDepth (here it's 16).

Save the config. If you're in X, hit CTRL+ALT+BACKSPACE to restart X (if you're running logon manager like xdm, kdm or gdm). Change between virtual consoles with CTRL + F1 F2 F3 and so on - your X should be on F7.

Starting the X:startx OR sudo /etc/init.d/gdm start (in KDE it's kdm)

If that doesn't work, try fixing the xorg.conf or get back to your original by copying the backup over your changed one with:

Code:

sudo cp /etc/X11/xorg.conf_backup /etc/X11/xorg.conf

When you're back in X, you can cycle through different modes by pressing CTRL+ALT++ (plus sign on numpad), or go to System->Preferences->Screen Resolution.

How to adjust position of your screen?open terminal(Applications->Accessories->Terminal), run xvidtune (type: "xvidtune"), adjust the screen and hit Show-button. You'll see a line with something like this on the terminal screen:

That should do it. There should be no need to restart X if you did make the change (hit Apply in xvidtune), but you should test that this new change works. Hit ctrl+alt+backspace to restart X. If it doesn't work, you can copy back the old configuration file using:

if you have Intel graphics chip, try installing 855resolution, or 915resolution

if having problems to get very high resolution working with nvidia drivers, try adding some or all of these at your own risk (some of these may be driver specific - check other documentation before using)

Re: HOWTO: change resolution/refresh rate in Xorg

Originally Posted by frodon

Hi heimo, nice guide ... really complete

Thanks! There are lots of tips and tricks from all over Ubuntuforums and I've just collected some of those together in one post. I'm quite happy to see that there's not so much need for this guide anymore, Xorg configuration in Breezy is working better than it was in Hoary.

Originally Posted by frodon

The first 2 links under Integrated Intel graphics card? and the link under Problems with login screen refresh rate? are broken.

Re: HOWTO: change resolution/refresh rate in Xorg

OOPS, i cut and pasted
sudo /etc/init.d/gdm stop into the terminal.

My computer starts but nothing is displayed. I hear the hard drive spinning but my bios doesn't even display. The monitor says it's working properly and to check my cables and computer. I can't boot anything on cd either.

i did sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup first though but still. With nothing displaying i can't really reset the backup. Any and all help would be great. I'm a newbie so i should have known better that to make changed in the terminal but i'm still stuck anyway. Any help or should i just throw it away. Sony Viao p2 400mgz, 128mb ram, 10gig hd

Re: HOWTO: change resolution/refresh rate in Xorg

Originally Posted by ubuntuzilla

OOPS, i cut and pasted
sudo /etc/init.d/gdm stop into the terminal.

My computer starts but nothing is displayed. I hear the hard drive spinning but my bios doesn't even display. The monitor says it's working properly and to check my cables and computer. I can't boot anything on cd either.

i did sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup first though but still. With nothing displaying i can't really reset the backup. Any and all help would be great. I'm a newbie so i should have known better that to make changed in the terminal but i'm still stuck anyway. Any help or should i just throw it away. Sony Viao p2 400mgz, 128mb ram, 10gig hd

Ok, you shouldn't have put that command into the terminal but the problems you describe sound to me as a hardware problem, a coincidence perhaps. The same fact it doesn't display your bios can't be caused by your operative system.

Either the monitor or the graphic card might have stopped working. If you have another monitor (if your notebook has a VGA port) you can try to connect it to your notebook.

Re: HOWTO: change resolution/refresh rate in Xorg

Heimo, thanks for a great howto. I haven't tried it out yet, but it reads easily and seems very complete.
One thing however. Since this guide seems mostly for beginners, I suggest updating the guide with the remark tseliot made ("Ok, you shouldn't have put that command into the terminal..."). Beginners do make beginnner's mistakes, and this saves them from having to read through the comments.

Re: HOWTO: change resolution/refresh rate in Xorg

I want to be able to connect an external monitor and use it to extend my desktop. The monitor will be running at 1280x1024 @ 60Hz (what it supports) and my notebook screen runs natively at 1280x800 (15,4 inch panel) also @ 60 Hz.

Should I use nVidia's TwinView option, the xinerama option or two separate X screens?

I know I have to define two Devices (with same Bus ID) when using two screens, but is TwinView dependant on two Monitor sections or does it simply detect the other monitor and configure it internally using the Option stements in the Device section for my graphics card?

Re: HOWTO: change resolution/refresh rate in Xorg

Originally Posted by briancurtin

how would one go about removing the nvidia drivers and returning to the original, or VESA driver?

Choosing vesa / nv / nvidia during reconfiguration or setting Driver line by editin xorg.conf. As far as I know, nv supports 2D acceleration, but you need nvidia-glx from repositories or directly from Nvidia for 3D acceleration.

I'm not confident at all here, but I believe the nvidia driver in repository is binary only (not Free), just an older version of the one available directly from Nvidia. I don't know how to change between these too versions "properly", but I've never had any problems. I think you can uninstall nvidia-glx and then install the latest from Nvidia and to change back to older version run the setup program (from Nvidia) to uninstall and then reinstall from Ubuntu repository.

Other drivers, vesa, nv and so on, can coexist without problems and you can change between those just by editing Driver line in xorg.conf

Hopefully this cleared something, I welcome all the comments and corrections.