Forcing a screen resolution of an Ubuntu guest OS in VirtualBox

I figured that doing this would be nontrivial but turns out it took a little work:

I’m trying to emulate an official 7″ Raspberry Pi Touch Display in a VM, so for this post the target resolution is 800 x 480. If you want to change it to another resolution swap in yours for the rest of this guide.

First, make sure Auto-resize Guest Display is deselected in Virtualbox:

Run the following command in your terminal:

The output should look something the the following, starting with Modeline

Copy the text after Modeline so in this case it would be

And paste it after the following command:

NOTE! You may want to change the 800x480_60.00 to something without an underscore in it, it was causing problems on my system. I changed it to pidisplay. The resulting command for this example is:

You should be able to run the above command without error. Next, run:

You’ll be greeted with output similar to this. Note the name of the display device, in this case VGA-1.

With that output name, enter the following two commands:

After running that second command, the window should jump to it’s new resolution! You’re done!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.