0

I want to test many of liveCD distributions in VirtualBox (specifically, want to test their installers). Some linux distributions use curses based installers (not X11). By default VM's window is 800x600, which is very inconvenient (menus are hard to navigate, especially at a point of partitioning.). I know that I can pass vga=NNN with nomodeset or just video=XxY parameter to kernel, but I need to do it very often, because of rapidly restarting machines. I know I can remake iso images so they include mentioned parameter by default. But it is not such practical, as I will need to manually edit every iso image that I want to test.

So the question: Is there a way to set VirtualBox machine in such a way so that loaded OS defaults its console resolution to some convenient value?

I know you can set some machine's parameters with VBoxManage setextradata "VM name" ...
For example:

VBoxManage setextradata "VM name" VBoxInternal2/EfiGopMode 2  
VBoxManage setextradata "VM name" VBoxInternal2/EfiGraphicsResolution HxV  
VBoxManage setextradata "VM name" VBoxInternal2/UgaHorizontalResolution 1920  
VBoxManage setextradata "VM name" VBoxInternal2/UgaVerticalResolution 900  
VBoxManage setextradata "VM name" "CustomVideoMode1" "1400x1050x16" 

And you can then get machine's custom settings with: VBoxManage getextradata "VM Name".

May be something useful among them to solve my request?

  • If you are doing that often have a look at vagrant – Rui F Ribeiro Feb 9 at 13:18
  • How vagrant can help? Do you mean something like rebooting to snapshot? I can boot with video= parameter in VirtualBox, then take snapshot and then when I need reboot, I do restore vm and boot to saved state. But it is still less convenient than just hitting host+R. – Ashark Feb 11 at 9:38
1

TLDR: It is possible for efi mode, but with one of pre-defined resolution (not random). For legacy mode I did not found a solution yet.

According to manual, 3.14.1. Video Modes in EFI

EFI provides two distinct video interfaces: GOP (Graphics Output Protocol) and UGA (Universal Graphics Adapter). Modern OSes, such as Mac OS X, generally use GOP, while some older ones still use UGA. Oracle VM VirtualBox provides a configuration option to control the graphics resolution for both interfaces, making the difference mostly irrelevant for users.

The default resolution is 1024x768. To select a graphics resolution for EFI, use the following VBoxManage command:

VBoxManage setextradata "VM name" VBoxInternal2/EfiGraphicsResolution HxV Determine the horizontal resolution H and the vertical resolution V from the following list of default resolutions:

VGA 640x480, 32bpp, 4:3

SVGA 800x600, 32bpp, 4:3

XGA 1024x768, 32bpp, 4:3

XGA+ 1152x864, 32bpp, 4:3

HD 1280x720, 32bpp, 16:9

WXGA 1280x800, 32bpp, 16:10

SXGA 1280x1024, 32bpp, 5:4

SXGA+ 1400x1050, 32bpp, 4:3

WXGA+ 1440x900, 32bpp, 16:10

HD+ 1600x900, 32bpp, 16:9

UXGA 1600x1200, 32bpp, 4:3

WSXGA+ 1680x1050, 32bpp, 16:10

Full HD 1920x1080, 32bpp, 16:9

WUXGA 1920x1200, 32bpp, 16:10

DCI 2K 2048x1080, 32bpp, 19:10

Full HD+ 2160x1440, 32bpp, 3:2

Unnamed 2304x1440, 32bpp, 16:10

QHD 2560x1440, 32bpp, 16:9

WQXGA 2560x1600, 32bpp, 16:10

QWXGA+ 2880x1800, 32bpp, 16:10

QHD+ 3200x1800, 32bpp, 16:9

WQSXGA 3200x2048, 32bpp, 16:10

4K UHD 3840x2160, 32bpp, 16:9

WQUXGA 3840x2400, 32bpp, 16:10

DCI 4K 4096x2160, 32bpp, 19:10

HXGA 4096x3072, 32bpp, 4:3

UHD+ 5120x2880, 32bpp, 16:9

WHXGA 5120x3200, 32bpp, 16:10

WHSXGA 6400x4096, 32bpp, 16:10

HUXGA 6400x4800, 32bpp, 4:3

8K UHD2 7680x4320, 32bpp, 16:9

If this list of default resolution does not cover your needs, see Section 9.7.1, “Custom VESA Resolutions”. Note that the color depth value specified in a custom video mode must be specified. Color depths of 8, 16, 24, and 32 are accepted. EFI assumes a color depth of 32 by default.

The EFI default video resolution settings can only be changed when the VM is powered off.

In previous manual versions there was description of VBoxManage setextradata "VM name" VBoxInternal2/EfiGopMode N

Where N can be one of 0,1,2,3,4 referring to the 640x480, 800x600, 1024x768, 1280x1024, 1440x900 screen resolution respectively. Perhaps it is obsolete now.

I do not know if it is possible to use any custom resolution for efi mode. Seems that setting custom values to EfiGraphicsResolution doesn't work. If you know, please share your knowledge.

Now what about legacy bios mode.
According to manual, 9.7.1. Custom VESA Resolutions

Apart from the standard VESA resolutions, the Oracle VM VirtualBox VESA BIOS enables you to add up to 16 custom video modes which will be reported to the guest operating system. When using Windows guests with the Oracle VM VirtualBox Guest Additions, a custom graphics driver will be used instead of the fallback VESA solution so this information does not apply.

Additional video modes can be configured for each VM using the extra data facility. The extra data key is called CustomVideoMode with x being a number from 1 to 16. Please note that modes will be read from 1 until either the following number is not defined or 16 is reached. The following example adds a video mode that corresponds to the native display resolution of many notebook computers:

VBoxManage setextradata "VM name" "CustomVideoMode1" "1400x1050x16" The VESA mode IDs for custom video modes start at 0x160. In order to use the above defined custom video mode, the following command line has to be supplied to Linux:

vga = 0x200 | 0x160 vga = 864 For guest operating systems with Oracle VM VirtualBox Guest Additions, a custom video mode can be set using the video mode hint feature.

So it seems that you will need use vga= parameter anyway, so it is not usefull for your needs.

I do not know effect of UgaHorizontalResolution and UgaVerticalResolution options, seems it does not work. If you know how to achieve request in legacy mode, please share your knowledge.

I think maybe it is possible for VirtualBox's virtual monitor to answer to kernel that it supports only one of wanted by me resolution, so kms will use that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.