Bug 31513 - QEMU/KVM automatic guest screen resizing and shared clipboard don't work, in a Cauldron guest with Plasma
Summary: QEMU/KVM automatic guest screen resizing and shared clipboard don't work, in ...
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: KDE maintainers
QA Contact:
URL:
Whiteboard: MGA9TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-05 20:21 CET by Andrew Piubellini
Modified: 2024-04-12 21:35 CEST (History)
4 users (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments
What it looks like in Plasma, and the state of spice-vdagentd.service (216.51 KB, image/png)
2023-02-05 20:31 CET, Andrew Piubellini
Details
What it looks like in MATE, and the state of spice-vdagentd.service (244.76 KB, image/png)
2023-02-05 20:36 CET, Andrew Piubellini
Details
systemctl and spice logs (2.68 KB, text/plain)
2023-02-11 14:57 CET, Ulrich Beckmann
Details
grepping for "spice" in journalctl (Cauldron Plasma) (232 bytes, text/plain)
2023-02-21 16:49 CET, Andrew Piubellini
Details
grepping for "spice" in journalctl (Cauldron MATE) (8.49 KB, text/plain)
2023-02-21 16:56 CET, Andrew Piubellini
Details
systemctl status spice-vdagentd.service (1.22 KB, text/plain)
2023-05-25 20:10 CEST, Ulrich Beckmann
Details
CLI output of spice logs (3.17 KB, text/plain)
2023-08-28 21:07 CEST, Ulrich Beckmann
Details

Description Andrew Piubellini 2023-02-05 20:21:03 CET
# Description of problem:

Automatic guest screen resizing for QEMU/KVM (controlled by virt-manager on a Mageia 8 host) isn't working in a Mageia Cauldron guest, when logging in to a Plasma Desktop (X11) session (I haven't tested Plasma Wayland). Furthermore, I can't even set the appropriate resolution manually, via the "Display Configuration" module of KDE System Settings - 1920x938 isn't listed as an option.

However, automatic guest screen resizing does partially work in the same guest, when logging in to a MATE session. While it didn't select the correct resolution out of the box, I was able to manually set it to 1920x938 in the Display preferences, and this setting is persisting in MATE between reboots.

The appropriate packages (qemu-guest-agent and spice-vdagent) are installed in the Cauldron guest out of the box (just like in Mageia 8 guests). However, the service "spice-vdagentd.service" is inactive and dead in Cauldron under Plasma (whereas it's active and running in my Mageia 8 guests, and in this same Cauldron guest when running MATE) - maybe this is why automatic guest resizing isn't working?

To be clear, automatic guest resizing in Plasma works out of the box for me with Mageia 8 guests, so this bug is a regression in Cauldron.

According to Giuseppe on the dev mailing list, it looks like Cauldron Plasma guests experience this same problem when running in VirtualBox (see https://ml.mageia.org/l/arc/dev/2023-02/msg00062.html), though I haven't tested this myself.

# How reproducible:

Always

# Steps to Reproduce:

1. If you haven't done so already, install virt-manager, and make sure it's working correctly (e.g. you may need to play around with PolicyKit and firewall rules)
2. In the main virt-manager window (on the host), go to "Edit" - "Preferences"
3. Select the "Console" tab
4. Set "Resize guest with window:" to "On"
5. Click "Close"
6. Create a QEMU/KVM virtual machine, with the Mageia 9-alpha1 Classical Installer 64-bit ISO as the initial installation image
7. Do **not** add any online mirrors during the installation (this might not matter, but it's how I tested)
8. Select "Custom" as the desktop environment
9. In the "Package group selection" step, select the following package groups:
  * Office Workstation
  * Game station
  * Multimedia station
  * Internet station
  * Network Computer (client)
  * Configuration
  * Console Tools
  * Development
  * Documentation
  * LSB
  * Plasma Workstation
  * MATE Workstation
10. Do **not** allow the installer to perform any post-installation updates (this might not matter, but it's how I tested)
11. Reboot the system, log in to a Plasma Desktop (X11) session, and observe whether automatic guest resizing works
12. Reboot the system, log in to a MATE session, and observe whether automatic guest resizing works

## Actual results:

Automatic guest resizing doesn't work at all in Plasma, and the resolution is painfully low (and installing updates at this point doesn't help). Automatic guest resizing does work in MATE, after manually setting the resolution once, and this setting persists in MATE between reboots.

## Expected results:

Automatic guest resizing doesn't work prior to logging in, but starts working upon logging in to Plasma, as is the case with Mageia 8 guests.
Comment 1 Andrew Piubellini 2023-02-05 20:31:44 CET
Created attachment 13675 [details]
What it looks like in Plasma, and the state of spice-vdagentd.service

Automatic guest screen resizing doesn't work in Plasma, and spice-vdagentd.service is inactive and dead (see the output of the commands I ran in Konsole).
Comment 2 Andrew Piubellini 2023-02-05 20:36:02 CET
Created attachment 13676 [details]
What it looks like in MATE, and the state of spice-vdagentd.service

Automatic guest screen resizing works in MATE (after I manually selected 1920x938 from the list of available resolutions, on an earlier occasion), and spice-vdagentd.service is inactive and dead (see the output of the commands I ran in MATE Terminal).
Comment 3 Marja Van Waes 2023-02-05 21:14:58 CET
Assigning to the KDE maintainers.

Assignee: bugsquad => kde
CC: (none) => marja11

Ulrich Beckmann 2023-02-06 14:01:53 CET

CC: (none) => bequimao.de

Comment 4 Ulrich Beckmann 2023-02-11 14:57:36 CET
Created attachment 13695 [details]
systemctl and spice logs

I confirm, spice-vdagentd.service is not running here in a Plasma KDE guest. It's an installation from the classical iso from QA beta test. Though I have a resonable resolution (1600 : 900).

I am not shure, if automatic resizing ever worked on virt-manager and KDE Plasma. I use virt.manager and remote-viewer instead.

Of my test cases
USB redirection, works,
Shared folders, works,
Shared clipboard, works not!

NB. spice-vdagentd.service is running in a separate Gnome guest. I don't install KDE Plasma together with other desktops.

Best regards,
Ulrich
Comment 5 Andrew Piubellini 2023-02-21 16:38:47 CET
(In reply to Ulrich Beckmann from comment #4)
> Though I have a resonable resolution (1600 : 900).
That's a good point. I tried manually changing Plasma's resolution from the default 1024x768, to 1600x900 (the highest I could get it, within my window size of 1920x938). This works, and persists between reboots.

Nonetheless, the lack of automatic resizing is extremely problematic if you frequently change the window size, or want portrait resolutions in your guests (e.g. so you can snap one guest to the left of the screen, and another to the right).

(In reply to Ulrich Beckmann from comment #4)
> I am not shure, if automatic resizing ever worked on virt-manager and KDE
> Plasma.
It currently works perfectly for me with my Mageia 8 Plasma guests, once I log in (though it doesn't work before logging in, i.e. in GRUB, Plymouth and SDDM).

In my Mageia 8 Xfce guests, it requires manually adjusting the resolution every time I log in - nonetheless, something is clearly working, because 1920x938 (the size of my window) is displayed at the top of the list of supported resolutions, and works once I switch to it (whereas 1920x938 isn't available at all in Cauldron with Plasma).

(In reply to Ulrich Beckmann from comment #4)
> Shared folders, works,
Shared folders are also working for me in my Cauldron guest, in both Plasma and MATE.

(In reply to Ulrich Beckmann from comment #4)
> Shared clipboard, works not!
Indeed, testing just now, I have the same issue. The shared clipboard works perfectly in my Mageia 8 guests, regardless of whether I'm using Plasma or Xfce. It also works perfectly in my Cauldron guest, when I log in to a MATE session. However, it doesn't work in either direction when I log in to a Plasma session (in Cauldron).

This is particularly interesting, because I'm pretty sure that the shared clipboard is also controlled by spice-vdagentd.service (I base this assumption, on the procedure for disabling the shared clipboard: insert the line <clipboard copypaste="no"/> into the XML for virt-manager's "Display Spice" device).

So it seems that the spice-vdagentd.service failure and the automatic guest resizing / shared clipboard failures in Cauldron Plasma are related.

(In reply to Ulrich Beckmann from comment #4)
> Created attachment 13695 [details]
> systemctl and spice logs
I tried starting spice-vdagentd.service manually, as you did in your logs. It appears to start without error messages, but automatic guest resizing and the shared clipboard still don't work.

I also ran 'journalctl -b -1 | grep "spice"', for both a Plasma session, and a MATE session. No error messages appear in the journalctl output for Plasma, but nor is there any reference at all to "spice-vdagentd.service" (though "spice-vdagentd.socket" is mentioned), so something is clearly wrong. On the other hand, the journalctl output for MATE is full of error messages related to spice, but maybe this is harmless and normal, since the intended functionality is mostly working in MATE.
Andrew Piubellini 2023-02-21 16:40:24 CET

Summary: QEMU/KVM automatic guest screen resizing doesn't work in a Cauldron guest with Plasma => QEMU/KVM automatic guest screen resizing and shared clipboard don't work, in a Cauldron guest with Plasma

Comment 6 Andrew Piubellini 2023-02-21 16:49:08 CET
Created attachment 13711 [details]
grepping for "spice" in journalctl (Cauldron Plasma)

This attachment demonstrates the journalctl output of a typical Cauldron Plasma boot (grepping for "spice"). There's no references to "spice-vdagentd.service" (though there are references to "spice-vdagentd.socket"), so presumably, it isn't even being started.
Comment 7 Andrew Piubellini 2023-02-21 16:56:44 CET
Created attachment 13712 [details]
grepping for "spice" in journalctl (Cauldron MATE)

This attachment demonstrates the journalctl output of a typical Cauldron MATE boot (grepping for "spice"). It's full of all sorts of messages, that don't appear in the corresponding output for Plasma. There's plenty of error messages in here, but I'm not sure if they indicate any genuine problems, given that the intended functionality is mostly working in MATE.
Comment 8 Ulrich Beckmann 2023-05-25 20:10:46 CEST
Created attachment 13857 [details]
systemctl status spice-vdagentd.service

I took another look when testing Beta2 Plasma Live DVD in a virtual machine.

I started manually /usr/sbin/vdagent (not vdagentd) and switched then to remote-viewer.

Shared clipboard works then, but not automatic screen resizing. I can set the proper resolution manually though.

Ulrich
Comment 9 Ulrich Beckmann 2023-07-01 22:24:55 CEST
* /usr/sbin/spice-vdagent *
Comment 10 Frédéric "LpSolit" Buclin 2023-07-11 14:04:43 CEST
(In reply to Andrew Piubellini from comment #0)
> To be clear, automatic guest resizing in Plasma works out of the box for me
> with Mageia 8 guests, so this bug is a regression in Cauldron.
> 
> According to Giuseppe on the dev mailing list, it looks like Cauldron Plasma
> guests experience this same problem when running in VirtualBox


I confirm that this is working fine with Mageia 8 guest and that I can reproduce the problem with VirtualBox, so the problem with Mageia 9 is not limited to QEMU/KVM.
Comment 11 Giuseppe Ghibò 2023-08-20 10:54:16 CEST
Did you still get the same under latest version? BTW, note that, despite to what was happening in the past, right now an installation in Virtualbox using the latest mga9 final ISO would produce a working desktop (at least under plasma) with autoresize working.

CC: (none) => ghibomgx

Comment 12 Ulrich Beckmann 2023-08-28 21:07:50 CEST
Created attachment 13953 [details]
CLI output of spice logs

I tested now the Mga 9 final KDE Plasma Live iso.
Host is Fedora 38 on a Sony Vaio E Series notebook.

Automatic resizing does not work under Virt-Manager. I think it did not work under Mga 8 on the same hardware either.

Switched testing to remote viewer. As spice.vdagentd.service was inactive (dead), I had to start spice-vdagent manually as indicated in comment #8.

Automatic resizing still does not work,
Shared clipboard works,
USB redirection works,
Shared folder does not show up in Dolphin,
though I can mount the selected folder manually, i,e.

mount -t davfs http://127.0.0.1:9843 /mnt

spice-vdagentd.service might fail because
a) command spice-agentd is invoked (instead of spice-vdagent) or invoked with wrong arguments
b) file  /etc/sysconfig/spice-vdagentd is missing.

I think that in the case of Gnome spice-vdagent is invoked by gdm, see
/etc/xdg/autostart/spice-vdagent.desktop

Best regards,
Ulrich
Comment 13 Giuseppe Ghibò 2023-08-28 22:22:09 CEST
Trying without any virt manager works here.
Comment 14 bascule teller 2023-09-28 02:24:42 CEST
In my guest install of mga9 I have to start "spice-vdagent -x" by hand, then the resize works.
I don't know how the /usr/lib/systemd/user/spice-vdagent.service which has this command is meant to be started on bootup.

bascule

CC: (none) => asura

Comment 15 Ulrich Beckmann 2023-09-28 17:30:32 CEST
(In reply to bascule teller from comment #14)
> In my guest install of mga9 I have to start "spice-vdagent -x" by hand, then
> the resize works.
> I don't know how the /usr/lib/systemd/user/spice-vdagent.service which has
> this command is meant to be started on bootup.
> 
> bascule

Just add
/usr/bin/spice-vdagent

under system settings -> startup and shutdown -> task scheduler
 -> run at system bootup
Comment 16 Ulrich Beckmann 2023-09-29 19:18:45 CEST
Changed version from to Mageia 9
Comment 17 bascule teller 2023-10-02 01:35:38 CEST
(In reply to Ulrich Beckmann from comment #15)

> 
> Just add
> /usr/bin/spice-vdagent
> 
> under system settings -> startup and shutdown -> task scheduler
>  -> run at system bootup

unfortunately I get the error in the journal:
could not connect to X-server

this also happens using:
/usr/bin/spice-vdagent -x
Comment 18 bascule teller 2023-10-02 02:10:25 CEST
(In reply to bascule teller from comment #17)

> 
> unfortunately I get the error in the journal:
> could not connect to X-server
> 
> this also happens using:
> /usr/bin/spice-vdagent -x

however reading this:
https://bugzilla.redhat.com/show_bug.cgi?id=1951580

and editing spice-vdagent.service to:

[Unit]
Description=Spice guest session agent

After=graphical-session.target

[Service]
ExecStart=/usr/bin/spice-vdagent -x

[Install]
WantedBy=graphical-session.target

and then running (as root):
#systemctl --global enable spice-vdagent

resulted in the following:
[bascule@skunkworks ~]$ ps wax |grep -i vda
    388 ?        S      0:00 [jbd2/vda2-8]
    589 ?        S      0:00 [jbd2/vda4-8]
   4147 ?        Ssl    0:00 /usr/bin/spice-vdagent -x
   4170 ?        Ssl    0:00 /usr/sbin/spice-vdagentd
   5192 pts/2    R+     0:00 grep --color -i vda


resize and clipboard (both ways) now work
Ulrich Beckmann 2023-10-12 16:07:29 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=32332

Comment 19 Andrew Piubellini 2023-10-28 14:24:06 CEST
I can confirm that this bug still affects Mageia 9 guests running in QEMU/KVM. The "Steps to Reproduce:" from my original description remain the same.

As such, I've added "MGA9TOO". I haven't retested Cauldron, but I'll assume that the bug still affects Cauldron, until someone reports otherwise.

I can confirm that, as per bascule teller's suggestions in Comment 18, the following steps provide a workaround for the bug:

1. Edit the file "/usr/lib/systemd/user/spice-vdagent.service", to match the text suggested by bascule teller in Comment 18 (I also added the line "ConditionVirtualization=vm" after the ExecStart line, as suggested by Ed Greshko in https://bugzilla.redhat.com/show_bug.cgi?id=1951580 Comment 33)
2. Run the following as root: "systemctl --global enable spice-vdagent.service"

Automatic guest resizing still doesn't work, but I can now select the appropriate resolution manually using Plasma's System Settings application. Unfortunately, the setting is lost on shutdown, so I need to reset the resolution every time I log in. As for the shared clipboard, it works perfectly now, in both directions.

If we were to ship the updated "spice-vdagent.service" file to all Mageia users via an update, then we should probably also add something like "ConditionVirtualization=vm" after the ExecStart line, as suggested by Ed Greshko in https://bugzilla.redhat.com/show_bug.cgi?id=1951580 Comment 33, to ensure that the service doesn't run outside of virtualised guests. Ideally, we should find an even more restrictive condition than "ConditionVirtualization=vm", to ensure that spice-vdagent.service doesn't run in other hypervisors, where it isn't supposed to (e.g. VirtualBox). "man systemd.unit" lists the possible conditions, but I'm not sure whether to use "ConditionVirtualization=qemu" or "ConditionVirtualization=kvm".

(In reply to Ulrich Beckmann from comment #12)
> Automatic resizing does not work under Virt-Manager. I think it did not work under Mga 8 on the same hardware either.

Automatic guest resizing works perfectly in my Mageia 8 Plasma guests, to this day. Have you followed Steps 2-5 from my "Steps to Reproduce:" in the bug description? (For some reason, virt-manager doesn't enable automatic guest resizing by default out of the box)

Also note that automatic guest resizing has never worked for me in my Mageia 8 Xfce guests (but I could manually set the correct resolution every time I logged in, and the shared clipboard worked in both directions). I'm not sure why this behaviour differs between desktop environments.

Whiteboard: (none) => MGA9TOO

Comment 20 Giuseppe Ghibò 2024-04-12 01:39:02 CEST
IMHO the problems are two, probably overlapping.

1) automatic screen resizing in plasma. In qemu guest I get desktop automatically resizing in plasma+qemu even if spice-vdagentd.service is not working at all.

2) spice-vdagentd.service. Apparently the package is installed (even on the LIVE) but this is not started automatically in guest machine. But this happens on plasma only, but doesn't happen in GNOME, where you have two processes running:

a) /usr/bin/spice-vdagent (note the lack of the 'd' at end, which runs as the same user as desktop and is started from /etc/xdg/autostart/spice-vdagent.desktop)

b) /usr/sbin/spice-vdagentd (which runs as root and is started first).

Instead in plasma such processes aren't running. Hoewver the systemd presets seems OK (same as FC where instead it works).

systemctl status spice-vdagentd.service will show it as "inactive (dead)".

and

journalctl -xu spice-vdagentd.service

will show that the service is started and then immediately terminated later. I wonder if is a problem of our plasma only, or maybe some missed plasma subpackage required. Furthermoe on a system where it works the two services are started in the same way as Gnome even for Plasma.
Comment 21 Giuseppe Ghibò 2024-04-12 21:35:45 CEST
There was also a discussion here https://gitlab.freedesktop.org/spice/linux/vd_agent/-/issues/35

Note You need to log in before you can comment on or make changes to this bug.