Bug 472622 - Spice clipboard sharing under kwin-x11 doesn't work
Summary: Spice clipboard sharing under kwin-x11 doesn't work
Status: REOPENED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-x11-standalone (show other bugs)
Version: 5.27.6
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 16:20 UTC by zarisase
Modified: 2024-05-11 03:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zarisase 2023-07-25 16:20:42 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Start QEMU and copy something in a Plasma guest.
2. Try to paste in the host

OBSERVED RESULT
Nothing gets pasted (or more likely, the last thing in the host's clipboard gets pasted).

EXPECTED RESULT
The thing copied in the guest gets pasted in the host

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
* This is similar to 462093, but this is about X11, not Wayland.
* I remember reporting a similar bug before on an earlier version (455992), and one workaround was to use systemdboot. This workaround no longer works; however, I was able to get an error log by disabling systemdboot (no log is shown when systemdboot is enabled). The error reports something about a "UID Mismatch", similar to the error in the previous report.
Comment 1 zarisase 2023-07-25 16:38:18 UTC
Upon further reflection, the difference between 455992 and this bug is that this time, spice-vdagentd does start, it's just that now there's an error.

As before, other DEs work as expected.

The exact error: `UID mismatch: UID=1001 PID=653 suid=4294967295`
Comment 2 Zamundaaa 2023-07-25 18:50:24 UTC
KWin is not involved with the clipboard on X11. If spice-vdagentd doesn't work, that's a bug that should be filed for spice-vdagentd.
Comment 3 zarisase 2023-07-25 20:22:04 UTC
But that doesn't make sense, as it works for every other DE I tried basically, every DE packaged for Arch).
Comment 4 zarisase 2023-07-25 20:27:06 UTC
I noticed that spice-vdagent (the one that runs as your user dies whenever you try to run it, with 
```
spice-vdagent[428319]: vdagent started
spice-vdagent[428319]: 0xaaaad276cbd0 connected to /run/spice-vdagentd/spice-vdagent-sock
spice-vdagent[428319]: vdagent_display_create: net_wm_name="KWin", has icons=0
spice-vdagent[428319]: display: failed to call GetCurrentState from mutter over DBUS
spice-vdagent[428319]:    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[428319]: No guest output map, using output index as display id
spice-vdagent[428319]: Sending guest screen resolutions to vdagentd:
spice-vdagent[428319]:    display_id=0 - 1280x800+0+0
spice-vdagent[428319]: 0xaaaad276cbd0 sent guest xorg resolution, arg1: 1280, arg2: 800, size 20
spice-vdagent[428319]: 0xaaaad276cbd0 disconnected
```
Comment 5 zarisase 2023-07-25 20:34:29 UTC
I fixed the problem by installing xdg-desktop-portal-gtk. I have no idea why this fixed the problem.
Comment 6 Zamundaaa 2023-07-25 20:39:34 UTC
the portal probably implements some interface that spice-vdagentd prefers over whatever failed before. So please still report this upstream.
Comment 7 zarisase 2023-07-25 21:15:11 UTC
I'm still not sure it's a problem on SPICE's side --- if I downgrade to 5.24, it worked without installing anything.
Comment 8 zarisase 2023-07-26 22:13:43 UTC
I also seem to require vte-common.
Comment 9 zarisase 2023-08-10 15:07:39 UTC
Acutally, I noticed this doesn't actually solve the problem --- if I install them, and restart the VM, it work, but after 2 more restarts, the problem comes back again.
Comment 10 Zamundaaa 2023-08-10 15:19:13 UTC
Again, this is a bug that you should report upstream
Comment 11 zarisase 2023-08-12 16:02:47 UTC
Oh, I learned something --- If you manually run xclip on the guest, the guest->host starts working. If you run pbpaste on the host, host->guest starts working. I'm not sure why it doesn't activate by itself though.
Comment 12 zarisase 2024-05-10 16:33:41 UTC
Update: I worked around this problem temporarily by switching to Xfce, which does not have this issue. However, I really like using KDE, and this issue has been in the back of my mind for a while, so I recently started into this again. 

After some debugging, this is due to a SIGSEGV crash in spice-vdagent at `vdagent_x11_do_read`/`XPending`. This is a known issue (just look up `spice- "vdagent" sigsegv`), but it only seems to effect KDE/KUbuntu.
Comment 13 zarisase 2024-05-11 02:22:47 UTC
I just found out that this is due to KDE not automatically setting XDG_SESSION_TYPE=x11 in systemd-logind upon executing startplasma-x11 (I'm using startx instead of a display manager).
Comment 14 zarisase 2024-05-11 03:05:08 UTC
Nope, that wasn't why (XFCE also doesn't set XDG_SESSION_TYPE). However, what is different between the two DEs is the cgroup hierarchy --- in XFCE, almost all user-level processes are uner the `session-1.slice` group (presumably owned by systemd). However, on KDE, each process is under a slice that is owned by the process that spawned them (for example, if I run `python` in the Kitty terminal, that `python` process would show up under the `app-kitty.slice`.

Each of these app-level slices are under the general `session.slice`, so to systemd, almost none of the processes spawned are under any systemd cgroup/session!