Custom VirtualBox Linux guest framebuffer size

Whenever I set up Linux guests inside VirtualBox, I usually just start them in the background (Shift + double click in VirtualBox Manager) and then ssh into them. But sometimes I’ll need to run them in the foreground to work. That’s when I want the window to just about cover my screen width and height, so I don’t have to go into fullscreen but still utilize as much of my screen real estate as possible.

So as part of my standard setup for a VM, I now do

> VBoxManage setextradata "Debian 9" "CustomVideoMode1" "1200x900x24"

where "Debian 9" is the name of the virtual machine I want to change and 1200x900x24 is 1200×900 pixel at 24 bpp resolution.

Then I update the kernel args with video=1200x900-241)Check the Linux Kernel documentation for the full video option format by modifying the bootloader configuration. In case of GRUB, one can change GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub2)See the Grub Manual for reference. and then issue

> sudo update-grub

Don’t forget to reboot the VM for changes to take effect. If for some reason the new resolution isn’t available, check with

> sudo hwinfo --framebuffer
...
Mode 0x0360: 1200x900 (+3600), 24 bits
...

Using older bootloaders or other bootloaders might need to use the hexadecimal mode number, 0x0360 above, instead of the resolution and bit-depth.

   [ + ]

1. Check the Linux Kernel documentation for the full video option format
2. See the Grub Manual for reference.

Leave a Reply

Your email address will not be published. Required fields are marked *