/dev/blog/ID10T

Custom resolution for an Ubuntu Virtual Box guest

• Ubuntu and virtualization • Comments
Advertisement

I’ve encountered this problem more often than I like to admit: I got an Ubuntu or Debian based Virtual Box guest and I’d like to change the resolution of the Desktop to one not being enabled by default. Changing the resolution temporary is easy with cvt and xrandr.

export XRES=1152 \

&& export YRES=864 \

&& xrandr --newmode $(cvt ${XRES} ${YRES}|tail -1| perl -pe 's/^Modeline\ //') \

&& xrandr --addmode $(cvt ${XRES} ${YRES}|tail -1| cut -d ' ' -f2)

But making the change reboot persistent without using those commands in a startup script took me hours of searching the web several times as I have little knowledge with X11, only find parts of the solution and never documented the steps needed on my own… yet.

Advertisement

Lets roll it up from behind. Here’s the end result:
/usr/share/X11/xorg.conf.d/10-monitor.conf

Section "Device"
    Identifier "Device0"
    Driver     "vboxvideo"
EndSection

Section "Monitor"
    Identifier "VGA-0"
  	Modeline "1152x864_60.00"   81.75  1152 1216 1336 1520  864 867 871 897 -hsync +vsync
    Option "PreferredMode" "1152x864_60.00"
EndSection

Section "Screen"
    Identifier "Screen 0"
    Device     "Device0"
    Monitor    "VGA-0"
    DefaultDepth 24
    SubSection "Display"
  		Modes "1152x864_60.00"
    EndSubSection
EndSection

Most of this is static and can just be copy ‘n pasted. There are some parts which are dynamic and some parts which might change, I’d document both so I (hopefully) never want to search the web for a solution again.

Dynamic parts:

Parts that might change:

Afterwards restart the Display manager (depends on which flavor of Debian/Ubuntu you are) or just reboot.

Advertisement
More posts
comments powered by isso

Advertisement