After much searching, I was able to set both the X and virtual console screen resolutions to 1920x1080 of an ubuntu guest while still using the vboxvideo kernel module. Basically, in this post I show how to set all resolutions (from grub, boot (including vboxvideo drm module loading), console, X display manager, and X) to the same value so the display just remains in one resolution.
Normally after installing Guest Additions, the virtual consoles all become 800x600 and are relatively useless because I run fullscreen so the pixels are very small, and if one increases the font size, then very little text remains on the screen (in a small box in the center of the screen).
The trick is to use add the following to /etc/fb.modes
(from http://www.cubieforums.com/index.php?topic=50.0)
Then in /etc/default/grub change:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet video=1920x1080-60 vga=864"
and at the end of /etc/default/grub append the lines
GRUB_GFXMODE=1920x1080x32
GRUB_GFXPAYLOAD_LINUX=keep
Now in the host OS, you need to do something like (from https://www.virtualbox.org/manual/ch09.html , search for "864"):
VBoxManage setextradata "Ubuntu VM" "CustomVideoMode1" "1920x1080x32"
This mode (CustomVideoMode1) is the video mode that the "vga=" kernel parameter will connect with.
Follow the directions in https://askubuntu.com/a/331988 to set lightdm screen resolution, three steps below:
Putting it all together:
Video mode setting in Linux is a mess!
Normally after installing Guest Additions, the virtual consoles all become 800x600 and are relatively useless because I run fullscreen so the pixels are very small, and if one increases the font size, then very little text remains on the screen (in a small box in the center of the screen).
The trick is to use add the following to /etc/fb.modes
mode "1920x1080-60"
# D: 148.500 MHz, H: 67.500 kHz, V: 60.000 Hz
geometry 1920 1080 1920 2160 32
timings 6734 148 88 36 4 44 5
hsync high
vsync high
rgba 8/16,8/8,8/0,8/24
endmode
# D: 148.500 MHz, H: 67.500 kHz, V: 60.000 Hz
geometry 1920 1080 1920 2160 32
timings 6734 148 88 36 4 44 5
hsync high
vsync high
rgba 8/16,8/8,8/0,8/24
endmode
(from http://www.cubieforums.com/index.php?topic=50.0)
Then in /etc/default/grub change:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet video=1920x1080-60 vga=864"
and at the end of /etc/default/grub append the lines
GRUB_GFXMODE=1920x1080x32
GRUB_GFXPAYLOAD_LINUX=keep
Now in the host OS, you need to do something like (from https://www.virtualbox.org/manual/ch09.html , search for "864"):
VBoxManage setextradata "Ubuntu VM" "CustomVideoMode1" "1920x1080x32"
This mode (CustomVideoMode1) is the video mode that the "vga=" kernel parameter will connect with.
Follow the directions in https://askubuntu.com/a/331988 to set lightdm screen resolution, three steps below:
- log in
- use xrandr or the Displays control utility to configure your monitors how you'd like them to be configured in the login screen (ie 1920x1080)
- copy ~/.config/monitors.xml to /var/lib/lightdm/.config
Putting it all together:
- CustomVideoMode1 gets read by the kernel via the "vga" parameter
- GRUB will set its mode using GRUB_GFXMODE
- GRUB will leave that mode in place on boot due to GRUB_GFXPAYLOAD_LINUX
- When vboxvideo loads, it loads the vboxdrmfb framebuffer driver, which normally sets the resolution back to what it thinks is the native resolution of the display, but I've only seen it go to 800x600 on modern laptops, but it will refer to the "video=" kernel parameter, and look that up in /etc/fb.modes, and use that setting for consoles
- When vboxvideo loads and then lightdm (the login screen AKA X display manager) runs, again normally the resolution is set to some random value, so follow the three steps above to get it to start in a sane resolution.
Video mode setting in Linux is a mess!