2

I am running a fleet of KVM machines on Ubuntu 19.10 host. The fleet includes both Linux and Windows guests, and all of them share this issue:

Copy with Ctrl+C only works every second time. That is, inside a KVM guest I select some text on a webpage, hit Ctrl+C, place cursor in a textarea, hit Ctrl+V. One time it works, the other does not. Perfectly consistent alternation. Both Linux and Windows guests.

Now, the most interesting part is that the issue only happens when the guests are configured to use Spice as display protocol. If I change it to VNC, copy-paste (within the guests) works perfectly. (Note that I do not care much of copy-paste between guest and host at this point, so I could just switch to VNC and be happy, but I am digging this anyway.)

Search has found people do experience this issue, though there is no clear indication that it is related to Spice there:

So, in my case the relation of this issue to Spice is clear. Is there any way I could debug/tweak Spice to find the bottom of it?

UPDATE

I just tested this issue on 18.04 and 19.04 hosts. Clipboard copy glitches (similar to those described above) do occur in guests too but only when there are at least 2 guests running — as if Spice runs into some sort of race condition trying to manage clipboards between all running guests. Pausing all guests but one is enough to get clipboard work fine in it. In contrast, with 19.10 the issue occurs even with just one running guest.

Greendrake
  • 151
  • 1
  • 7
  • Did you ever find a fix? newer versions of virt-viewer have option to disable clipboard share, but not possible to build on Ubuntu – Ahmed Sep 10 '21 at 23:05
  • @Ahmed Nah, still suffering from it. My workaround is to just pause the virtual machine when not in immediate use. – Greendrake Sep 11 '21 at 02:06
  • I have been having this problem as well, in my case with a Windows guest. It is very frustrating, though I am sure initially (a few months back) it was working flawlessly. What changed? Who knows. I have not been able to find any information on this issue. I take it you have not found a solution yet, either? – mydoghasworms Nov 15 '21 at 11:04

1 Answers1

0

virt-viewer version 9.0 have an option to enabled/disable clipboard share, it can be turned on/off any time from settings, this solve the problem, but latest Ubuntu release have version 7.0, Ubuntu 18.04 have version 6.0

One way to fix this is to backport this commit and rebuild virt-viewer package from start

Here are the steps:

sudo apt build-dep virt-viewer
apt source  virt-viewer
cd virt-viewer-7.0 # or virt-viewer-7.0

Download and apply this patch, but it have some conflicts with current ubuntu version, this is the same patch with conflicts resolved:

wget https://pastebin.com/raw/yNNp40D9 -O cliboard-patch.diff
patch -p1< cliboard-patch.diff

You may need to resolve some conflicts depnding on your ubuntu/distor version After that:

./configure --prefix=/usr
make

Test the new compiled file at ./src/remote-viewer, you have to disable clipboard share from File menu > Preference

If it work, install in on your filesystem

sudo make install
Ahmed
  • 368
  • 1
  • 14
  • But this will disable the ability to copy from host to guest and vice versa, right? I need that to work. – Greendrake Sep 11 '21 at 02:08
  • @Greendrake True, but at least you can disable/enable it when you need it, i don't see any other solution. For my use case i need it to work just few times, most of the time it will be disabled. You can try to compile a new version of virt-manger and see if they have some fix. – Ahmed Sep 11 '21 at 19:33
  • Just to clarify, you can disable/enable clipboard sharing any time you want from Preference menu – Ahmed Sep 11 '21 at 19:35
  • Re "_i don't see any other solution_"⁠ — I did not look into the source code, but, on the face of it, this issue must be caused by some stupid bug which tampers with the host's clipboard in a reckless way like it assumes that a copy operation done on the host is necessarily purported to be pasted in the guests. Sometimes when I simply try to copy/paste on the **host** while a guest is running in background it just doesn't work! I wish I had time to get my hands on it. – Greendrake Sep 12 '21 at 04:15