How To: Set Linux resolution for a virtual display

Here’s a fix I found to a problem I encountered running a Linux server with no screen attached. Without a screen, Linux didn’t want to list any useful resolutions which I’d require for connecting over VNC (x11vnc to be precise).

Use xrandr to make sure that the new mode can fit within the maximum framebuffer size

xrandr | grep maximum
Screen 0: minimum 320 x 200, current 1440 x 900, maximum 1680 x 1680
The maximum virtual framebuffer size of 1680 x 1680 is sufficient to support our 1440 x 900 mode. Please note that this cannot be increased but can be decreased.

Use gtf to create a mode line


gtf 1440 900 59.9

# 1440x900 @ 59.90 Hz (GTF) hsync: 55.83 kHz; pclk: 106.29 MHz
Modeline "1440x900_59.90" 106.29 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync

gtf is a program to calculate the VESA GTF (Generalized Timing Formula) mode lines. Given the desired horizontal and vertical resolutions and refresh rate (in Hz), the parameters for a matching VESA GTF mode are printed out.

Add new mode using xrandr

xrandr --newmode "1440x900_59.90" 106.29 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync

Copy the text after Modeline from the above output as is and paste it after the –newmode option in xrandr.

Add this newly added mode to the desired output (VGA/LVDS etc)

xrandr --addmode VGA 1440x900_59.90

As my monitor is connected via VGA, i will add this new mode to VGA

Choose the new mode

xrandr --output VGA --mode 1440x900_59.90

Tags

Like this Article? Share it!

About the Author

Related Posts

Leave a Comment