I have a QEMU/KVM virtual machine created with Virtual Machine Manager.
I would like to be able to copy text on the host and paste it into the guest, and the other way around too.
How can I share the clipboard between the host and the guest?
I have a QEMU/KVM virtual machine created with Virtual Machine Manager.
I would like to be able to copy text on the host and paste it into the guest, and the other way around too.
How can I share the clipboard between the host and the guest?
The solution is simple. Just install the package spice-vdagent in the guest virtual machine:
sudo apt install spice-vdagent
The clipboard is automatically shared - we can copy and paste between the host and the guest.
ssh
and on the host's terminal you have clipboard available.
– imdzeeshan
Nov 01 '17 at 13:31
systemctl start spice-vdagentd
systemctl enable spice-vdagentd
– Bill McGonigle
Jun 15 '22 at 01:16
spice-vdagent
supposed to work with the client's CLI (without GUI) or not? I guess no, because the MAN page claims it's an " X11 session agent".
– user643011
Jun 09 '23 at 10:14
For my Linux Mint 18.2 Sonya machine timelf123 provided the answer:
In case the question pops up - what if it's Ubuntu server or similar?
Don't run around in circles - install openssh-server on the vm, and when you ssh in you cut and paste into your favourite terminal.
In year 2021, qemu uses qemu-vdagent
chardev for copy&paste, which turns off clipboard by default, so simply installing spice-vdagent
package in guest OS does not work.
The solution of 2021 is:
Install spice-vdagent
package as the current answer said,
Have qemu support spice (--enable-spice --enable-spice-protocol in ./configure
option),
Launch qemu using:
qemu-system-x86_64 [ ... ] \
-chardev qemu-vdagent,id=ch1,name=vdagent,clipboard=on \
-device virtio-serial-pci \
-device virtserialport,chardev=ch1,id=ch1,name=com.redhat.spice.0
P.S. A side effect on my qemu is that the mouse moves more smoothly thanks to vdagent.
Reference: https://www.kraxel.org/blog/2021/05/qemu-cut-paste/
clipboard
param. Is that because the spice isn't enabled?
– fsevenm
Jan 20 '22 at 02:14