Thursday, 15 October 2009

VirtualBox gets upset about screen resolution

I've just spent considerable time trying to get a Fedora 12 (beta) VirtualBox guest running (on a Windows 7 host). The guest was working perfectly before, and when I shut it down it was running in seamless mode. Apparently this was a bad idea.

When trying to boot the guest, I got the normal splash screen, but instead of the login window I just got a black screen with a blinking cursor in the corner. When I logged in on another virtual terminal, I found the following messages in the X log file:

[...]
(II) VBoxVideo(0): Not using built-in mode "1920x1170" (unknown reason)
(II) VBoxVideo(0): No remaining probed modes for output VBOX1
(II) VBoxVideo(0): Output VBOX1 connected
(WW) VBoxVideo(0): Unable to find initial modes
(EE) VBoxVideo(0): Output VBOX1 enabled but has no modes
(EE) VBoxVideo(0): Initial CRTC configuration failed!
(II) UnloadModule: "vboxvideo"
[...]
This indicated that the driver was unhappy with the desired resolution for an increadibly helpful "unknown reason". Apparently, attempting to set the resolution used in seamless mode was failing, possibly because it was too high for windowed mode.

As it turns out, VirtualBox stores the last resolution in the machine description file in the guest property /VirtualBox/GuestAdd/Vbgl/Video/SavedMode:

$ VBoxManage guestproperty get Fedora /VirtualBox/GuestAdd/Vbgl/Video/SavedMode
VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Value: 1920x1170x32

After spotting this, the fix was reasonably straight-forward:

$ VBoxManage guestproperty set Fedora /VirtualBox/GuestAdd/Vbgl/Video/SavedMode 800x600x32
fixed the problem.