VirtualBox screen resolution WITHOUT guest additions

I have read many posts about screen resolutions for Ubuntu as VirtualBox guest. May be I failed to read the good one... So.

I "just" want to make more screen resolutions available WITHOUT installing/modifying anything requiring superuser access in the Ubuntu guest VM (then WITHOUT guest additions). This requirement is a mandatory security issue for my project.

I am quite confident that it must be somehow possible, because setting "GRUB_GFXMODE=1280x1024" in /etc/default/grub uses 1280x1024 in grub boot menu only. This shows that the Virtual Box virtual graphic card does support it.

PS: please don't reply anything involving guest additions..


Run

xrandr

You get similar to

Screen 0: minimum 320 x 200, current 800 x 600, maximum 1280 x 1280

VGA connected 800x600+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
       1280x1024      60.0 +   75.0  
       1280x960       59.9  
       1152x864       75.0     74.8  
       1024x768       75.1     70.1     60.0  
       832x624        74.6  
       800x600        72.2*    75.0     60.3     56.2  
       640x480        75.0     72.8     66.7     60.0  
       720x400        70.1

    * item is current.

It is list of resolutions you can set. Now you can change by using

xrandr -s Index

index is number starting from 0 as the first line.

OR

xrandr -s widthxheight


You will need to boot in EFI mode and install Ubuntu in EFI mode for this to work.

VBoxManage modifyvm "VM name" --firmware efi
VBoxManage setextradata "VM name" VBoxInternal2/UgaHorizontalResolution 1440
VBoxManage setextradata "VM name" VBoxInternal2/UgaVerticalResolution 900

Without guest additions there is no way to randomly change resolutions from the guest. You will have to pick one resolution and stick with it, though you can change resolutions between reboots. For example, power down, change resolution, boot.

You would be much better off making an image with Guest Additions already installed, and just using that as your locked down base image. However the commands above will work.

There is a lot of data about running without guest additions here.

You may wish to use a resolution of 1920x1080 and enable "scaling mode" so the window can be re-sized. It's not the same as changing resolutions but it is a good start at it.