Increase resolution for debian guest in virtualbox

I found a solution for that in the meanwhile.

There are two descriptions that show how this works:

1st: How to adjust the screen resolution in Debian?

2nd: http://forums.debian.net/viewtopic.php?f=16&t=78330#p429581

In short:

$ 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
$ xrandr --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
$ xrandr --addmode VBOX0 "1920x1080_60.00"
$ xrandr --output VBOX0 --mode 1920x1080_60.00

After execution these commands automatically the new resolution appears. Additionally these commands must be executed after each start of the operating system.

In the meantime I wrote a blog post about that topic: http://www.robert-franz.com/2015/06/28/adding-new-resolution-to-the-x-window-server/


A straightforward way of achieving that would be to change the specific configuration in the grub2 bootloader directly:

  1. Find out the resolutions supported by your debian guest

    • Reboot debian and keep pressing c until you see the grub console.
    • Press vbeinfo and hit enter. It will give you a list of supported resolutions.
  2. Edit /etc/grub.d/00_header

    • Replace autoin the line if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi with the new resolution. e.g.: if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=1920x1080 ; fi
    • Right underneath, make a copy of the line edited and replace MODE with PAYLOAD. e.g.: if [ "x${GRUB_GFXPAYLOAD}" = "x" ] ; then GRUB_GFXPAYLOAD=1920x1080 ; fi
    • Further below, you'll find the following line: set gfxmode=${GRUB_GFXMODE}. Add the following line below it: set gfxpayload=${GRUB_GFXPAYLOAD}
  3. Reload grub2 configurations by running the command update-grub2 and rebooting afterwards reboot

[Note]
I've seen many examples in which the default line #GRUB_GFXMODE=640x480 in the file /etc/defaul/grub in uncommented. It was proven to be unnecessary for me but in case you need it, remember to update-grub2 after you've uncommented it.


I know this question realtes to different versions but it might be usefull for someone that has installed the latest version of VirtualBox (5.2)

My setup:

  • VirtualBox 5.2.0 r118431
  • Host OS: Windows 10
  • Guest OS: Linux Debian 9.2.1 with XFCE
  • Guest Additions ISO: VBoxGuestAdditions_5.2.1-118447 (please note that this is not the ISO you get with the default installer, there is a note on virtualbox site to download a newer version)

The following commands must be run in super user mode on guest OS rebooted:

mkdir -p /lib/modules/$(uname -r)/build/include/drm

touch /lib/modules/$(uname -r)/build/include/drm/drm_rect.h

The VBoxLinuxAdditions.run must be executed again, and then guest OS need a reboot

There is also a newer Guest Additions ISO in the development downloads which should fix this problem Virtualbox Test builds

Credits:

  • Ticket #17203
  • vboxvideo build is skipped, Debian 9.2, GA 5.2.1-r118447

Check the screen size in Windows:

Control panel -> Sound & Hardware -> Screen

Y the left of the windows select Adjust resolution, and you can see what is the actual resolution of the host screen, use that in your Ubuntu/Debian. In Debian go to Settings -> Displays, choose the display and adjust the resolutions, that's all.


I'm using a Debian 10 image in VirtualBox under Windows 10, and installed Debian with the default GUI.

I found that within the GUI, I was able to select a resolution directly (eg. 1920x1440 in my case, my host machine's max res), avoiding having to wrangle with the CLI.

Settings (app) -> Devices -> Displays -> Resolution

Choosing a resolution caused the VM to assume the selected screen size and the VirtualBox window resized appropriately.