I have installed basic debian system in my virtualbox to play with a docker inside it. Debian has no x windows system installed and by default has a resolution 800x600. Id didn’t bother me much cause I log there by ssh from my host system. But I started to play with x windows inside some containers recently, so I needed to figure out, how to change console resolution.

First valuable information was about how to find supported possible resolutions. With info taken from find out resoution from grub console I rebooted debian, pressed c key to enter to grub console and run vbeinfo command. Unfotunately there was no fullhd resolution - native resolution of my host system - listed.

Here helped me this resolution discussion thread which redirected me to virtualbox add custom resolution. Here in section “9.7.1. Custom VESA Resolutions” is instruction how to add custom resolution.

I run following command to add fullhd resolution. Docker2 is name of my virtual machine, CustomVideoMode1 is name constructed based on info from virtualbox-advanceddisplayconfiguration. You can have from 1 up to 16 custom modes defined.

vboxmanage setextradata "docker2" "CustomVideoMode1" "1920x1080x32"

New mode was now listed with vbeinfo.

Btw other handy command to display all extra data is

vboxmanage getextradata "docker2" enumerate

Next I used file /etc/defult/grub to take new resolution into account. Based on vga param info I added video=1920x1080 to linux default command line parameter and added setting of GRUB_GFXPAYLOAD_LINUX variable so those rows in my /etc/defult/grub file looks like this:

...
GRUB_CMDLINE_LINUX_DEFAULT="quiet video=1920x1080"
...
GRUB_GFXPAYLOAD_LINUX=1920x1080
...

Based on instructions I used update-grub command to actualize grub.cfg. But unfortunatelly this command didn’t work as expected and din’t change anything in grug.cfg. I used grub-mkconfig instead and my new resolution has finally started to work.

grub-mkconfig -o /boot/grub/grub.cfg

Btw whe I run update-grub first time it gave me message “command not found”. I found a solution here and use su - root indeed helped me.

Links: