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:
- Copy and Paste only working on second attempt
- https://www.virtualbox.org/ticket/14964
- https://social.technet.microsoft.com/Forums/en-US/f4eba5af-ca1f-4296-8cca-a70140e4f66b/copy-paste-doesnt-work-first-time-but-works-on-2nd-try
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.