RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1600798 - spice-vdagent clipboard ownership copy-and-paste problems
Summary: spice-vdagent clipboard ownership copy-and-paste problems
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: spice-vdagent-win
Version: ---
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Default Assignee for SPICE Bugs
QA Contact: meital avital
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-13 04:43 UTC by Charlton Harrison
Modified: 2019-10-10 14:22 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-07-13 08:23:43 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
spice.log (253.95 KB, text/plain)
2018-07-19 10:28 UTC, Ladar Levison
no flags Details

Description Charlton Harrison 2018-07-13 04:43:53 UTC
Description of problem:

I have a gentoo guest running inside KVM/qemu/virt-manager under a gentoo host. Everything works beautifully except copy-and-paste which only occasionally works. Even within the VM (not cross host<->guest) the copy-and-paste doesn't work. It seems to work the first time, but afterwards when I try to paste it doesn't work and also freezes xorg/terminals for 10 seconds. 

I am constantly seeing these in my messages log:

Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:06 triton spice-vdagent[2378]: primary: received clipboard req while not owning guest clipboard
Jul 12 12:37:21 triton spice-vdagent[2378]: primary: selection requests pending on clipboard ownership change, clearing

While these seem to be very clear error messages I could google, it comes back with nothing helpful. Maybe I've configured something incorrectly because otherwise I can't see how this isn't a common issue. spice-vdagent and qemu-guest-agent are both running on the guest. Their /etc/conf.d files have not been changed from their defaults (ie all comments). virtio uinput has been compiled in the kernel as a module and is loaded when I check lsmod.

I can confirm that this also messes with copy-and-paste on the host system as well. 
I'm having problems selecting words/sections on the host. If I shut down the VM the problem goes away.

Bug is also documented on Gentoo forums at:
https://forums.gentoo.org/viewtopic-p-8221522.html

--

Version-Release number of selected component (if applicable):

spice 0.14.0-r1
spice-vdagent 0.17.0_p20180319-r1


How reproducible:

Carefully double-checked all setup instructions under Gentoo linux.
Guest is also latest Gentoo linux.
Double-checked permissions, group, and user setup.


Steps to Reproduce:
1. Using libvirt and virt-manager, under Gentoo linux, set up a Gentoo linux guest
2. Run spice-vdagent on guest.
3. Run qemu-guest-agent on guest


Actual results:
Copy and paste works the first time, but very sporadically afterwards.


Expected results:
Copy and paste to work as expected inside guest, host, and between the two.


Additional info:
Unable to find any information on Google regarding these error messages.

I personally suspect the problem might be permissions related, as looking at the code would seem to indicate that the Xorg clipboard owner is somehow incompatible with the user doing the copy-and-pasting.

Comment 1 Victor Toso 2018-07-13 08:23:43 UTC
Hi Charlton, thanks for taking time to report this bug here.

I've opened an upstream bug, we can discuss it further there [0]

[0] https://gitlab.freedesktop.org/spice/linux/vd_agent/issues/9

Comment 2 Ladar Levison 2018-07-19 10:26:31 UTC
I have also run into this issue. Cutting/copying/pasting inside my RHEL 6.10 guest is generating a large number of log entries. The operation itself seems to work once every 5 or so attempts. To make matters worse, this problem is causing certain apps (Eclipse and the clipit widget in particular), to freeze for 10 to 20 seconds at a time. 

As you can imagine, having your IDE freeze every few minutes is rather annoying. After trying many different things to fix the problem, I gave up. Since this caused me so much pain, I'm posting a workaround here, so that others may be spared some of my grief. 

Disabling spice clipboard supports, avoids the issue (albeit at the cost of guest/host clipboard sharing). To apply this workaround, libvirt users will need to edit the XML file with the guest configuration directly. With system hosted libvirt guests, the file will likely be /etc/libvirt/qemu/GuestName.xml ... note these files require elevated privileges to access directly ... once open, add a "<clipboard copypaste='no'/>" child node to the "<graphics>" node. This should result in the "<graphics>" section looking something like:

<graphics type='spice' autoport='yes' listen='127.0.0.1'>
  <listen type='address' address='127.0.0.1'/>
  <image compression='off'/>
  <clipboard copypaste='no'/>
</graphics>

For users running QEMU directly, you'll need to add "disable-copy-paste" to the "-spice" configuration. This will yield a command like option that looks something like:

 -spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,disable-copy-paste,seamless-migration=on

Should anyone try and fix this issue, my host is RHEL 7.5. The following are just some of the errors found inside my guest system logs. I will post a larger sample set as an attachment.

Jul 17 10:59:40 dark spice-vdagent[2711]: clipboard: received selection request event for target STRING, while not owning client clipboard
Jul 17 10:59:40 dark spice-vdagent[2711]: clipboard: received selection request event for target TARGETS, while not owning client clipboard
Jul 17 10:59:40 dark spice-vdagent[2711]: clipboard: received clipboard req while not owning guest clipboard
Jul 17 11:00:44 dark spice-vdagent[2711]: clipboard: selection requests pending on clipboard ownership change, clearing
Jul 17 11:00:44 dark spice-vdagent[2711]: clipboard: received clipboard req while not owning guest clipboard
Jul 17 11:01:47 dark spice-vdagent[2711]: clipboard: selection requests pending on clipboard ownership change, clearing
Jul 17 11:01:57 dark spice-vdagent[2711]: clipboard: received clipboard req while not owning guest clipboard
Jul 17 11:01:58 dark spice-vdagent[2711]: clipboard: selection requests pending on clipboard ownership change, clearing
Jul 17 11:02:00 dark spice-vdagent[2711]: clipboard: unexpected selection type text/uri-list

Comment 3 Ladar Levison 2018-07-19 10:28:07 UTC
Created attachment 1459973 [details]
spice.log


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