Posted on

Forcing Display Resolution on VirtualBox and CentOS 6.5

VirtualBox Display Resolution

Last evening my Oracle VM VirtualBox development system stopped auto-detecting my guest display resolution when I re-connected my laptop to the docking station.   The maximum resolution I could get was 1600 x 1200 instead of the native display resolution of 1920 x 1200.   After literally hours of research this morning with many dead-ends I found the proper solution.  Here is my “cheat sheet” on how I got it working in my dev environment.

For CentOS 6.x systems the system-config-display command is obsolete.  The replacement, for today anyway, is xrandr.

VBoxManage is useless unless you are running the virtual box management service, which is not a typical default setup for VirtualBox on a Windows host.

Updating VirtualBox guest additions does not help if you already have a current version.  You WILL need VirtualBox guest additions for the display driver interface on the guest operating system to function properly.   If you don’t have that installed you can use the GUI interface and finding the “machine / install guest additions” option.   It should drop a CD image on your CentOS 6.5 desktop that you can run with autoprompt.  Run it as a priv’ed user such as root.

Once you have VirtualBox guest additions installed login to your system and get to the command prompt.    Switch to a priv’ed user.  I login as my standard account and execute the command:

# sudo su -

To setup xrandr and add a manual resolution to your list you need to get the configuration setting line.   Use the utility cvt to get the right command line.  Here is the command to find the xrandr mode for a 1920 x 1200 resolution:

# cvt 1920 1200

It returns the line:

Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync

Those are the parameters for my particular monitor configuration.  It is a basic reference label, a configuration tag, and monitor timing, resolution, and sync timings.  This will be specific to your monitor so run the cvt command, don’t just copy the line here.

For xrandr you will need everything AFTER the Modeline portion.

Find out what monitors your system thinks it has.  I have 3 monitors so this is my output:

# xrandr
Screen 0: minimum 64 x 64, current 4800 x 1200, maximum 16384 x 16384
VBOX0 connected 1600x1200+0+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX1 connected 1600x1200+1600+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
VBOX2 connected 1600x1200+3200+0 0mm x 0mm
   1600x1200      60.0*+
   1440x1050      60.0  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.0  
   640x480        60.0  
  1920x1200_60.00 (0x10c)  193.2MHz
        h: width  1920 start 2056 end 2256 total 2592 skew    0 clock   74.6KHz
        v: height 1200 start 1203 end 1209 total 1245           clock   59.9Hz

Now to add the manual entry so I can later use the CentOS 6.5 GUI display manager to set the resolution:

# xrandr --addmode VBOX0 "1920x1200_60.00"
# xrandr --addmode VBOX1 "1920x1200_60.00"
# xrandr --addmode VBOX2 "1920x1200_60.00"

Now I can go to System / Preferences / Display on the system admin menu.

CentOS 6.5 Forced Display Resolution
CentOS 6.5 Forced Display Resolution