UTM icon indicating copy to clipboard operation
UTM copied to clipboard

Wrong resolution sent to `spice-vdagent` for external monitor when waking from sleep.

Open umanwizard opened this issue 1 month ago • 0 comments

Describe the issue
macOS host, linux guest.

My macbook is hooked up to an external monitor and I have the guest running full-screen in that monitor. When the host laptop sleeps, and then is woken from sleep, a message is sent to the guest's spice-vdagent informing it that the monitor's resolution is 1920x1080, which is wrong, since my monitor is in fact 3840x2160.

To prove this, I am running spice-vdagent in the guest with this patch applied:

diff -ur spice-vdagent-0.22.1-pristine/src/vdagent/x11-randr.c spice-vdagent-0.22.1/src/vdagent/x11-randr.c
--- spice-vdagent-0.22.1-pristine/src/vdagent/x11-randr.c	2025-11-18 13:51:00.450511896 -0700
+++ spice-vdagent-0.22.1/src/vdagent/x11-randr.c	2025-11-18 14:00:10.050468579 -0700
@@ -841,6 +841,12 @@
                                     VDAgentMonitorsConfig *mon_config,
                                     int fallback)
 {
+    syslog(LOG_INFO, "[btv] vdagent_x11_set_monitor_config: %d", mon_config->num_of_monitors);
+    for (int i = 0; i < mon_config->num_of_monitors; ++i) {
+        VDAgentMonConfig *m = &mon_config->monitors[i];
+        syslog(LOG_INFO, "[btv] %d: %d/%d/%d (%d/%d)", i, m->width,
+               m->height, m->depth, m->x, m->y);
+    }
     int primary_w, primary_h;
     int i, real_num_of_monitors = 0;
     VDAgentMonitorsConfig *curr = NULL;

It is causing messages like this to be printed to the syslog:

2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] vdagent_x11_set_monitor_config: 16
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 0: 1920/1080/32 (0/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 1: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 2: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 3: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 4: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 5: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 6: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 7: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 8: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 9: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 10: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 11: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 12: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 13: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 14: 0/0/0 (1920/0)
2025-11-19 09:21:17 localhost spice-vdagent[986]: [btv] 15: 0/0/0 (1920/0)

I'm not sure why it thinks I have 16 monitors, but anyway, that's a separate question. The point is that the wrong resolution is being reported for monitor 0.

Configuration

  • UTM Version: 4.7.4
  • macOS Version: Sequoia 15.6
  • Mac Chip (Intel, M1, ...): Apple M3 Max

Debug log
For all issues related to running a VM, including crashes, you should attach a debug log. (This is unavailable for macOS-on-macOS VMs. Attach an excerpt of your system log instead.) To get the Debug log: open UTM, and open the settings for the VM you wish to launch. Near the top of the QEMU page is Debug Log. Turn it on and save the VM. After you experience the issue, open the VM settings again and select Export Log... and attach it here.

debug.log

umanwizard avatar Nov 19 '25 16:11 umanwizard