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 1874926 - [RFE] copy/paste support in qemu VNC console
Summary: [RFE] copy/paste support in qemu VNC console
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: qemu-kvm
Version: 9.0
Hardware: x86_64
OS: All
high
medium
Target Milestone: rc
: ---
Assignee: Gerd Hoffmann
QA Contact: Guo, Zhiyi
URL:
Whiteboard:
Depends On: 2042820
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-02 15:11 UTC by Jean-Francois Beaudoin
Modified: 2024-06-13 23:01 UTC (History)
24 users (show)

Fixed In Version: qemu-kvm-6.2.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 12:23:22 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5577851 0 None None None 2020-11-16 17:43:43 UTC
Red Hat Product Errata RHBA-2022:2307 0 None None None 2022-05-17 12:24:06 UTC

Description Jean-Francois Beaudoin 2020-09-02 15:11:00 UTC
Description of problem:
Would like to use spice instead of novnc for compute console.

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

How reproducible:


Steps to Reproduce:
1. deploy
2. openstack console url show --spice testserver
3.

Actual results:
$ openstack console url show --spice testserver
Unavailable console type spice-html5. (HTTP 400) (Request-ID: req-b84de7ac-1f1f-4c3b-9763-99cf5dbf80b1)


Expected results:
To have the option to deploy and be able to use spice instead of novnc for compute console.

Additional info:

Comment 1 Jean-Francois Beaudoin 2020-09-02 15:13:39 UTC
Customer main objective is to be able to use copy/paste and keyboard language input.

Comment 3 Artom Lifshitz 2020-09-25 13:58:49 UTC
Hi Jean-François,

Engineering would like to better understand the customer's use case here. Our expectation is that QEMU's consoles are only to be used in case of emergencies (for example, the VM is not accessible over the network), and that if the VM is running normally and is accessible, users would connect to it using the OS's native remote access solution (like SSH or X forwarding for Linux and RDP for Windows), which provide a much better user experience than QEMU's consoles.

In addition, SPICE is de facto deprecated by virt engineering, and no other products should depend on it.

So as written, this RFE would get closed as WONTFIX, but we'd like to understand *why* it was written.

Cheers!

Comment 4 Jean-Francois Beaudoin 2020-09-25 16:32:51 UTC
Hi Artom,

Customer explanation of their use case.
~~~
we say the same to the users / commercial teams (in regards to previous comment about console being for emergencies cases)

most of our users also use really complex passwords so what we hope to have one day is the ability to copy / paste, that's our main problem / request.
We don't see any other way to get it without the SPICE console.

Any other ideas on how to implement this will be appreciated.
~~~

Thanks for looking into this RFE.
JF

Comment 5 Artom Lifshitz 2020-09-25 19:53:56 UTC
So it looks like the request is to facilitate copy/paste of complicated passwords. It won't get done in SPICE (as I said in comment #3, it's de facto deprecated), but it could be implemented in qemu's VNC support.

The VNC client would need support as well, and it looks like noVNC does support it [1]. I would like to mention that this copy/paste support does NOT appear to work in a Linux console situation, presumably because there's no clipboard on the VM side of things, and I'm assuming that's how noVNC implements copy/paste (in other words, it doesn't trigger keypress events when you paste something). So, if that's where you would like copy/paste to work, this would be a CANTFIX RFE. Still, I'll send this to the qemu devs for review, see what they think.

@customer/GSS: please confirm the exact situation where you need copy/paste. If it's at the stage where the VM is booted in text mode, I'd be inclined to say this cannot work at all, because the VM side doesn't have a clipboard in that situation.

@virt folks: Customer is asking for copy/paste support in the VNC console. I've asked to clarify where exactly they expect this functionality to work.

[1] https://github.com/novnc/noVNC/blob/90ead240c7afde328870a4e6767aab70e71c00a2/README.md#features

Comment 22 Gerd Hoffmann 2021-01-26 15:28:27 UTC
So, the vnc protocol has support for cut+paste:

https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#clientcuttext
(supports iso-8851-1 text/plain only).

https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#extended-clipboard-pseudo-encoding
(supports utf-8 text/plain and other formats).

That covers vnc client => qemu.  Should not be that difficult to implement,
but it is only the first half of the story.  The tricky part is qemu => guest.

Option one is sending the text as keystrokes to the guest.  Sounds straight
forward at first glance, but the devil is in the details:

 * First you need to know the guest keyboard layout, so you send the correct
   key events.  Also it will stop working for chars where you typically use
   ibus to enter them because there is no keyboard key for them (emoji, kanji,
   ...).  For the password use case the latter probably isn't that much of a
   problem though.
 * Second qemu needs some "paste now" hotkey.  The vnc protocol only notifies
   about cut buffer changes, the vnc client can't ask the server (i.e. qemu)
   to paste the text now.

Option two is an guest agent, simliar to spice, which will sync guest and host
clipboard.  Would need to run in user session context so it has access to the
display server (xorg/wayland) which manages the guest clipboard.  Obvious
disadvantage is the guest agent needed.  But it hasn't keyboard map problems
and it can work both ways (i.e. guest => vnc client cut+paste works too).

Option three would be a combination of both, i.e. in case a guest agent is
running talk to that and try send keystrokes otherwise.

Option one could also be implemented in vnc clients.

I tend to think that Option two is the best way forward.  Option one with
the keyboard map problem can cause alot of issues and support requests
because there is no easy way to automate this.  It essentially requires
manual configuration.

Comment 23 Gerd Hoffmann 2021-01-27 12:55:57 UTC
> https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#clientcuttext
> (supports iso-8851-1 text/plain only).

Oh, this works both ways too, we have a server -> client message as well.
https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#servercuttext

Data point: tigervnc happily sends utf8-encoded text that way.  Probably
because x11 cutbuffers are traditionally just a sequence of bytes without
any metadata attached, and tigervnc stuffs that as-is into the vnc message.
Which means we can't assume the charset actually is iso-8851-1.

Comment 26 Gerd Hoffmann 2021-06-01 06:02:57 UTC
merged upstream (will be part of the qemu 6.1 release).
https://www.kraxel.org/blog/2021/05/wemu-cut-paste/

Comment 27 John Ferlan 2021-09-08 21:57:19 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 28 Klaus Heinrich Kiwi 2021-11-29 14:04:06 UTC
Should already be fixed in Qemu 6.1 onwards, available internally with RHEL9.0 GA.

QE, can you validate and update accordingly?

Comment 37 Yanan Fu 2021-12-17 09:50:34 UTC
Gating test with qemu-6.1 all pass, and qemu 6.2 has come out, set 'Verified:Tested, Sanityonly', thanks!

Comment 46 Guo, Zhiyi 2022-02-07 09:27:35 UTC
The issues found will be tracked by https://bugzilla.redhat.com/show_bug.cgi?id=2042820, close this one as verified.

Comment 48 Jaroslav Škarvada 2022-04-19 14:03:19 UTC
Hi Gerd,

could you please tell me how this feature is supposed to work?

I have:

host:
qemu-kvm-6.2.0-8.module+el8.6.0+14324+050a5215.x86_64

guest:
RHEL-9 beta installed from the official ISO media

Command run on the host for the guest provision:
# virt-install --virt-type kvm --name rhel-9 --ram 1024 --disk /var/tmp/rhel-9.qcow2,format=qcow2 --network network=default --graphics vnc,listen=0.0.0.0 --noautoconsole --os-type=linux --location=/var/tmp/rhel-baseos-9.0-beta-0-x86_64-dvd.iso

I tried both vncviewer (Clipboard send/receive enabled in the menu) and vinagre, but the copy and paste doesn't work. Are there some special configuration steps needed?

Comment 49 Jaroslav Škarvada 2022-04-19 16:41:36 UTC
(In reply to Jaroslav Škarvada from comment #48)
> Hi Gerd,
> 
> could you please tell me how this feature is supposed to work?
> 
> I have:
> 
> host:
> qemu-kvm-6.2.0-8.module+el8.6.0+14324+050a5215.x86_64
> 
> guest:
> RHEL-9 beta installed from the official ISO media
> 
> Command run on the host for the guest provision:
> # virt-install --virt-type kvm --name rhel-9 --ram 1024 --disk
> /var/tmp/rhel-9.qcow2,format=qcow2 --network network=default --graphics
> vnc,listen=0.0.0.0 --noautoconsole --os-type=linux
> --location=/var/tmp/rhel-baseos-9.0-beta-0-x86_64-dvd.iso
> 
> I tried both vncviewer (Clipboard send/receive enabled in the menu) and
> vinagre, but the copy and paste doesn't work. Are there some special
> configuration steps needed?

I can confirm both my VNC viewers work correctly. I tried them both against tigervnc-server running on different machine and the remote<->local clipboard worked correctly, thus the problem is very probably on the qemu-kvm side.

Comment 50 Gerd Hoffmann 2022-04-20 11:25:32 UTC
(In reply to Jaroslav Škarvada from comment #48)
> Hi Gerd,
> 
> could you please tell me how this feature is supposed to work?

libvirt domain config (any libvirt version):

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
[ ... ]
    <controller type='virtio-serial' index='0'>
    </controller>
[ ... ]
  <qemu:commandline>
    <qemu:arg value='-chardev'/>
    <qemu:arg value='qemu-vdagent,id=vdagent,mouse=on,clipboard=on'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='virtserialport,chardev=vdagent,name=com.redhat.spice.0'/>
  </qemu:commandline>
</domain>

IIRC libvirt got support for that too, so with new enough libvirt this
should be configurable without <qemu:commandline>.  Can't find it in
https://libvirt.org/formatdomain.html though, Daniel?

Also: spice-vdagent must be installed and enabled in the guest.

Comment 51 Daniel Berrangé 2022-04-20 11:31:11 UTC
Libvirt support isn't merged yet - IIRC the latest proposal is https://listman.redhat.com/archives/libvir-list/2022-March/229558.html

Comment 52 Jaroslav Škarvada 2022-04-21 15:16:35 UTC
(In reply to Gerd Hoffmann from comment #50)

Thanks Gerd,

it was really helpful and I got it running.

> <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

The xmlns is really important here, otherwise the qemu:commandline elements are ignored.

I think the steps how to get it working should be documented somewhere in the RHEL guides or better this should work out-of-the box for better user experience, becasue for ordinary user it is not straight-forward how to get i working, just my two cents.

Maybe without the spice-vdagent it could also paste the raw characters, i.e. for the pure console to work. I understand that there will be problems with the keyboard layout but if it is choice about no paste or paste with the default EN layout, I think the b) is much better. It could ease work with the console. IMHO some other third party solutions support such raw paste.

Another thing I noticed:
- paste from the host to guest works OK
- paste from the guest to host works only with the vncviewer, but it doesn't work for me with the vinagre VNC client

On the other hand with the tigervnc-server the paste works correctly in both ways with the vinagre, thus it seems there is some protocol incompatibility. I used vinagre-3.22.0-23.fc34.x86_64 for testing.

Comment 53 Daniel Berrangé 2022-04-21 15:23:25 UTC
(In reply to Jaroslav Škarvada from comment #52)
> (In reply to Gerd Hoffmann from comment #50)
> 
> Thanks Gerd,
> 
> it was really helpful and I got it running.
> 
> > <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
> 
> The xmlns is really important here, otherwise the qemu:commandline elements
> are ignored.
> 
> I think the steps how to get it working should be documented somewhere in
> the RHEL guides or better this should work out-of-the box for better user
> experience, becasue for ordinary user it is not straight-forward how to get
> i working, just my two cents.

The XMLNS stuff is considered unsupported by libvirt. It is simply a means to experiment with the technology.

Full support is pending the patches I pointed to earlier, and once that's done we'll want mgmt apps to just "do the right thing" with configuring this, so the user doesn't need to know the details.

> Maybe without the spice-vdagent it could also paste the raw characters, i.e.
> for the pure console to work. I understand that there will be problems with
> the keyboard layout but if it is choice about no paste or paste with the
> default EN layout, I think the b) is much better. It could ease work with
> the console. IMHO some other third party solutions support such raw paste.
> 
> Another thing I noticed:
> - paste from the host to guest works OK
> - paste from the guest to host works only with the vncviewer, but it doesn't
> work for me with the vinagre VNC client

It isn't fully implemented in GTK-VNC yet, so vinagre won't work fully either.

Comment 55 errata-xmlrpc 2022-05-17 12:23:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: qemu-kvm), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2307


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