Enabling native screen resolution in VMs in QEMU+KVM

So, here’s a fun one.

I am using QEMU with KVM to run virtual machines.

I’ve set up a Debian 11 and it is perfect in every respect - except one.

The virtual Debian 11 is not offering me the native resolution of the laptop; I’m getting what look to me like a standard range of resolutions, which of course does not include the non-standard res of the framework.

Googling brings up this;

https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/

Which involves manually modifying the seabios package.

I was hoping for something simpler, like a command line argument…

Anyone have anyone knowledge about this, observations on the single known solution, or other, simpler solutions?

More Googling, found the answer to my own question.

I’m using Debian.

The page is not very well structured.

First, note all the work is done in the VM.

Second, most of the page is how to dynamically change the resolution, and a reboot will undo that work. So it’s useful, it gets you in the picture, but it’s not the solution. I think none of it is necessary, only the changes to the X11 config file are necessary.

Third, the name of the display (“Virtual-0”, “Virtual-1”, etc) is for me, “Virtual-1”, but in the code on the page, “Virtual-0”, which does not work - the VM boots to a console, rather than the GUI.

In short, I made the new X11 config file, with the “Monitor” section, pasted in the output from “cvt” (command line utility) and then after rebooting, the new resolution (which is the native resolution) was available, and I selected it and made it the default.

(The “PreferredOption” option affects the screen resolution of the log-in screen only; once you log in, the screen res you’ve chosen in Deb is then used.)

However, having made full-res work, I’m finding 1856x1392 is the res I’m actually using - it gives 1:1, no scaling, and fits just about perfectly, with the window decoration, in my normal, full-res desktop, so I can treat it as a single big window, which is convenient to move around desktops and so on, rather than being full-screen.

2 Likes

Great share @Xenophon!