MATE 24.04 in KVM doesn't resize client desktop resolution

Host is 24.04.2 LTS Ubuntu MATE. I'm attempting to set up another instance of the same version inside a KVM virtual machine. I've got the VM created, along with a second VM running Windows 11. (Why I'm doing this: my favorite version of Windows is 7, and that is simply getting difficult to run because so many packages have stopped updates. I really dislike all subsequent Windows versions, so I'd like to convert to using MATE as my full time OS.) I use virt-viewer to display the VMs on the host computer.

I've configured the Windows 11 VM using Video QXL, and ironically, it is working perfectly. Germane to this post, I can resize the VM window with the mouse, and the desktop inside the VM is resized; to be specific, the windows and applications inside the VM are not resized; instead, the desktop resolution if changed, then the open windows are adapted to this new resolution. That's what I want to happen, and this is the way that VirtualBox has always worked.

Unfortunately, I cannot get the Ubunt MATE VM to behave like this. Instead, the VM contents are simply zoomed in or out to fill the resized VM window. So, for example, if I double the VM window size, then the windows on the VM desktop are doubled in size, as are the fonts used in the applications. So basically, it is doing a bitmap resize. I have spice-vdagent installed, and verified it is running. It's not shown in my personal startup applications, so i suppose it was installed via the standard startup scripts:

guyr@kvmlinux:~$ ps -ef | grep spice
guyr 2290 1 0 05:48 ? 00:00:00 /usr/bin/spice-vdagent
root 2484 1 0 05:48 ? 00:00:00 /usr/sbin/spice-vdagentd

I can get the VM desktop to resize if I use System Menu -> System -> Preferences -> Hardware -> Displays, and change the desktop resolution there. Obviously, just resizing the VM window with the mouse is much easier.

I've tried switching to "Video Virtio", but I get the same results with that. I've done lots of Googling, but cannot find a solution. I'd be shocked if I was the first person to encounter this issue. If all else fails, I can just keep using VirtualBox.

Thanks.

I'm not sure who are the KVM / VM experts in the community. I'm more a VirtualBox man myself, but I'll try and help you out:

In virt-manager, are the virtual machine settings definitely set to:

  • Display → Type = "Spice"
  • Video → Model = "Virtio"

And from the menu bar, is View → Scale Display → Auto resize VM with window checked?

It seems the VM itself is configured correctly, with the spice-vdagent package providing that resizing functionality. Even though it appears to be running, for good measure, you could instruct systemd again that it should be enabled and running:

sudo systemctl enable --now spice-vdagent
sudo systemctl start spice-vdagent
4 Likes

@lah7 Thank you for the reply. Yes, I have specified the settings you identify. I actually set up two different VMs (using the same .vdi disk image), one using virtio video and the other using QXL. Both work; I verified when booting the two VMs that the correct video driver is being used in each. Unfortunately, with either virtio or QXL, changing the VM window size with the mouse always just zooms the contents in or out. So for example, if I enlarge the VM window, then everything on the desktop inside the VM just gets larger, including open app windows, and app and desktop fonts. I even tried unchecking "Auto resize VM with window", and that did not cause the desktop resolution to increase.

What version of Ubuntu MATE are the guest operating systems? What resolution is your host?

From a quick look online, guest operating systems might not resize beyond a certain resolution if there's insufficient graphics memory. Might be worth a try:

in the video adapter settings of virtual manager for the machine, edit the XML to increase the RAM size from 16MB to 64MB vgamem='65536'. To enable XML editing, go to Preferences and enable it. Then reboot [the guest VM]

https://www.reddit.com/r/linuxquestions/comments/pa8ha4/how_can_i_get_max_res_using_virtmanager_and_a/

(Also mentioned here and here, particularly if it's a HiDPI/4K display)

The QXL Video Driver for the guest is in the xserver-xorg-video-qxl package. It might be already installed, but could be worth checking:

sudo apt install xserver-xorg-video-qxl

From what I gather, there needs to be some serial device that the host and guest communicate over to say "Hey! Change resolution!" - in case that's been deleted for the VM?

If it still doesn't work, we (the community) could try replicating this if we've got some spare moments to try installing :ubuntu_mate: via virt-manager.

3 Likes

Host is Ubuntu 24.04.2 LTS; resolution is 1920x1200 on each of 2 Dell 2410 LCD IPS monitors. I wanted to minimize my testing setup time, so I just grabbed a pre-existing VM off OSBoxes: VMware Images

I downloaded the VMware Ubuntu MATE image, then used qemu-img to convert it to qcow2.

Regarding video adapter settings, I followed that post, and set:

<model type="qxl" ram="131072" vram="65536" vgamem="65536" heads="1" primary="yes"/>

Unfortunately, these changes did not alter the outcome.

Regarding your comment about a serial device for communicating resolution change requests, I think you may be referring to a "channel" device. I found mention of it. For QXL, the only option that works for Channel is (spice), which is Device type: spicevmc, and Target type: virtio. I didn't see that when I added that, so it is irrelevant to a QXL configuration. I tried adding a Channel device with Device Type qemu-vdagent, but that just messed up the VM entirely; the mouse no longer would activate the menus. So this Channel option doesn't seem to accomplish anything useful with QXL. For completeness, since I already have a VM with virtio configured, I'll try the Channel device there and see if it changes anything. I'm back, no, adding a Channel device with qemu-vdagent did not alter the resizing experience at all, but at least with the virtio video driver, the Channel device doesn't cause the UI to become unresponsive. But it doesn't accomplish anything useful either, so I removed it following the experiment.

Regarding someone in the community trying to replicate this issue, I would appreciate someone there trying to see if they can get the VM guest session to resize the desktop resolution when the VM window is resized. That's an easier solution than manually changing the desktop resolution within the guest, which does work. But for anyone who may find this discussion via search, it is likely helpful to document the options.

Thanks.

2 Likes