Tag Archives: ubuntu

Fixing External Monitor Resolution/Mode in Ubuntu

I have an LG 22″ display capable of running 1920×1080 resolution. If I plug the monitor before booting Ubuntu 10.04, all will go well, the monitor brand is shown properly in Monitor Preferences dialog and I can use the monitor in its highest resolution.

The problem is if I attached it after Ubuntu is started, Monitor Preferences will show it as “Unknown” monitor, and I will only get much lower resolution. And restarting X (with Ctrl-Alt-Backspace), or running “xrandr -q” don’t help, somehow the bad resolution stucks. The only way to fix this is to reboot the whole system, which is annoying.

If that sounds like the problem you have, this post may help you.

Step 1.

Find the so called X mode line for your desired resolution/mode. The best way is to look it in /var/log/Xorg.0.log file when the system is booting with the correct resolution. The whole line will look something like:

(II) intel(0): Modeline "1920x1080"x0.0  148.50  1920 2008 2052 2200  1080 1084 1089 1125 +hsync -vsync (67.5 kHz)

but the needed part is:

"1920x1080"x0.0  148.50  1920 2008 2052 2200  1080 1084 1089 1125 +hsync -vsync

If your system can’t boot with the desired resolution, you will have to find the mode line for your resolution elsewhere, or use mode line calculators for this. You can use gtf or cvt tool:

~$ gtf 1920 1080 60
# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz  Modeline "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync

$ cvt 1920 1080 60
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

In my experience, gtf or cvt may not get the correct numbers for you (in my case, the display is shifted up by few pixels), YMMV.


Step 2.

Add new mode with xrandr:

$ xrandr --newmode "1920x1080_60.00"  148.50  1920 2008 2052 2200  1080 1084 1089 1125 +hsync -vsync


Step 3.

Register the mode with you monitor:

$ xrandr --addmode VGA1 "1920x1080_60.00"

Replace VGA1 with the identifier for your monitor (just run xrandr without any argument to view detected monitors).

The last argument of –-addmode is the mode name, it must match the mode name added with –newmode command previously. Also, cAPiTalizAtion matters.


Step 4.

Now the mode is ready to be used:

$ xrandr --output VGA1 --mode "1920x1080_60.00"

I’m not expert on this, I only got this after hours of searching, but hopefully this helps. Good luck!





Filed under Uncategorized