#1033092 spice-vdagent: Can't resize window in KDE

Package:
spice-vdagent
Source:
spice-vdagent
Description:
Spice agent for Linux
Submitter:
Jun Nogata
Date:
2023-06-25 05:01:56 UTC
Severity:
normal
#1033092#5
Date:
2023-03-17 08:05:51 UTC
From:
To:
Dear Maintainer,

I installed Debian bookworm and KDE desktop in a virt-manager virtual machine. Then I installed spice-vdagent, but the screen size does not change when I resize the window.

When I run spice-vdagent from the terminal, the screen size changes to fit the window.

I put spice-vdagent.desktop in ~/.config/autostart/ but it does not run.

#1033092#10
Date:
2023-03-17 17:16:28 UTC
From:
To:
Hello

I don't have a KDE machine at the moment to test this. But I need
some more clarity. After installing spice-vdagent, have you tried
logging out the user and logged in again.

Can you check the spice-vdagent(d).service are running.

#1033092#15
Date:
2023-06-12 10:45:51 UTC
From:
To:
Hello.

I believe this issue is same as https://bugs.debian.org/1033092

So I am Ccing 1033092@bugs.debian.org.

[[Work around mentioned at the bottom of the mail]]

Please refer https://www.debian.org/Bugs/Reporting for future bug
reporting. For this one, just reply to this mail and it will be
archived at https://bugs.debian.org/1033092.

I was able to reproduce this issue and will look into it. For now can
you try the workaround mentioned here.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1033092#5

ie, run `spice-vdagent` command from your terminal.

#1033092#20
Date:
2023-06-16 20:17:18 UTC
From:
To:
Just upgraded from bullseye to bookworm and encountered this, host is on
bullseye guest was on bullseye but is now on bookworm, unlike the
original reporter adding a spice-vdagent.desktop file does work, the
contents are:

[Desktop Entry]
Exec=/usr/bin/spice-vdagent
Icon=dialog-scripts
Name=spice-vdagent
Path=
Type=Application
X-KDE-AutostartScript=true

Without the desktop file at login spice-vdagent.service and
spice-vdagentd.service are both not running.

Manually starting them with sudo systemctl start spice-vdagent.service
and systemctl start spice-vdagent --user doesn't seem to help the
services start but screen resizing doesn't work.

Please let me know if you need me to debug further.

#1033092#25
Date:
2023-06-19 18:57:52 UTC
From:
To:
There's a workaround posted on the forums
https://forums.debian.net/viewtopic.php?p=774201#p774201

 >https://github.com/systemd/systemd/issues/18791

 >tl;dr: copy /etc/xdg/autostart/spice-vdagent.desktop to
~/.config/autostart/ then comment out the "X-GNOME-Autostart-Phase" line.

#1033092#30
Date:
2023-06-22 20:10:29 UTC
From:
To:
More on this, the autostart works but it only works for increasing in
size, if I decrease it doesn't.

I have found another workaround here
https://superuser.com/questions/1183834/no-auto-resize-with-spice-and-virt-manager
which involves adding a script to watch for display events and trigger
xrandr

#!/bin/sh

sleep 2

xrandr --output "$(xrandr | awk '/ connected/{print $1; exit; }')" --auto

xev -root -event randr | \
grep --line-buffered 'subtype XRROutputChangeNotifyEvent' | \
while read foo ; do \
     xrandr --output "$(xrandr | awk '/ connected/{print $1; exit; }')"
--auto
done

Below is the debug log for spice-vdagent when the script isn't in use.

spice-vdagent[1776]: Root size of screen 0 changed to 1920x1080 send 1
spice-vdagent[1776]: display: failed to call GetCurrentState from mutter
over DBUS
spice-vdagent[1776]:    error message: Cannot invoke method; proxy is
for the well-known name org.gnome.Mutter.DisplayConfig without an owner,
and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag
spice-vdagent[1776]: Unable to find a display id for output index 2)
spice-vdagent[1776]: Unable to find a display id for output index 3)
spice-vdagent[1776]: Sending guest screen resolutions to vdagentd:
spice-vdagent[1776]:    display_id=0 - 1920x1080+0+0
spice-vdagent[1776]:    display_id=1 - 0x0+0+0
spice-vdagent[1776]: 0x563e06c189e0 sent guest xorg resolution, arg1:
1920, arg2: 1080, size 40
spice-vdagent[1776]: display: failed to call GetCurrentState from mutter
over DBUS
spice-vdagent[1776]:    error message: Cannot invoke method; proxy is
for the well-known name org.gnome.Mutter.DisplayConfig without an owner,
and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag
spice-vdagent[1776]: Unable to find a display id for output index 2)
spice-vdagent[1776]: Unable to find a display id for output index 3)
spice-vdagent[1776]: Sending guest screen resolutions to vdagentd:
spice-vdagent[1776]:    display_id=0 - 1920x1080+0+0
spice-vdagent[1776]:    display_id=1 - 0x0+0+0
spice-vdagent[1776]: 0x563e06c189e0 sent guest xorg resolution, arg1:
1920, arg2: 1080, size 40