VirtualBox is my virtualization software of choice. It is free and feature-rich, so all my virtual machines are created in VirtualBox.
Sometimes you need to set the exact display resolution which is not listed in the guest OS settings. While you can achieve this by resizing the VM's window, it is a waste of time. Here is how you can do it quickly.
Let's say I want to set the display resolution in my Windows 10 VM to 1366x768. As you can see, it is not listed in available display modes in my setup:
You need to execute the following commands:
VBoxManage setextradata global GUI/MaxGuestResolution any VBoxManage setextradata "Machine Name" "CustomVideoMode1" "Width x Height x Bpp" VBoxManage controlvm "Machine Name" setvideomodehint Width Height Bpp
The first command unlocks all possible display resolutions for virtual machines.
The second command defines a custom video mode for the specific virtual machine with name "Machine Name".
Finally, the third command sets this custom video mode for your virtual machine.
You must run these commands after the virtual machine has been started, when the guest operating system is ready to use and its Guest Additions are installed properly and loaded.
In my case, I need to execute the following commands:
VBoxManage setextradata global GUI/MaxGuestResolution any VBoxManage setextradata "Windows 10 build 14352" "CustomVideoMode1" "1366x768x32" VBoxManage controlvm "Windows 10 build 14352" setvideomodehint 1366 768 32
Under Linux, VBoxManage is accessible from any opened terminal/console.
Under Windows, you need to open a new command prompt window in the folder C:\Program Files\Oracle\VirtualBox. See the following article: All ways to open the command prompt in Windows 10, and the part "Run the command prompt directly from Explorer".
Once you execute these commands, the result will be as follows:
That's it.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Great! Thanks man, you helped me so much! Thank you very much!
I am happy to read this. You are welcome!
VBoxManage.exe: error: Code E_FAIL (0x80004005) – Unspecified error (extended info not available)
VBoxManage.exe: error: Context: “LockMachine(a->session, LockType_Shared)” at line 812 of file VBoxManageMisc.cpp
I’m sorry… Do you know WHERE I can find the manage tool where I input these commands?
it is in the installation folder of the app.
c:\program files\oracle\virtualbox
much usefull for me too, thank you Sergey!
I’d like to highlight the following: if I try to set the commands when the guest machine is opened, then I receive an error message similar to the one indicated by Talon, think because a running machine has its settings locked. I can do it only if the guest machine is down
Wow, worked for me finial! Even on OS X they have been the same cmd’s, so thanks!
Is there a way to do this for just the 2nd display in a 2 monitor set up?
Try providing the display number. This is from its help:
Like this
What does mean? I do not understand what they want.
what do they want for display?
Who?
—> THIS <— This worked!!!!! I could set the grub boot screen size, and the size inside KDE, but it would always change to like 640×480 for the login screen, between those two. It was driving me crazy. I noticed it was doing it right around the time that dbus and guest additions were being loaded. I couldn't tell which one. This worked, so obviously it was guest additions messing with the resolution. Now I have consistent screen size from grub menu all the way through to KDE desktop. Awesome! Thanks!!!!!
did absolutely nothing. changed nothing.
This works to set a resolution,
but when you try to restore the VM you will get VERR_VGA_INVALID_CUSTOM_MODE
Don’t ever save machine state with one of these resolutions…
Removing the resolution before starting works:
VBoxManage setextradata “Machine Name” “CustomVideoMode1” “”
But I’m not sure if this allows you to restore a machine from suspension from file.
Excellent article. Your info helped me a lot!
Thank you so much!!
what is the display field mean? I do not understand what they want.
The X server can handle multiple displays. Each has its own number/
Thank you!
Does resize however the display resolution doesn’t save once I turn back on auto-resize guest display and I can’t find it in the display properties then.
Also, adding on to that, can’t have two custom display resolutions at the same time. Kinda a problem.
I was attempting to run 3440×1440 resolution and whenever I ran the final “controlVM” command it caused my guest machine to blackscreen
The solution to this is that I had to go into my VirtualBox gui’s display settings and crank the video memory up to 128 mb, now it works perfectly after I reran the “ControlVM” command
Yet another fail. Seems like nothing will force virtualbox to use 3440×1440. Entered the commands with my resolution, as directed. No errors.. no confirmation of anything. Just .. it doesn’t work.