7

I have a Debian 9 KVM host runs on a dedicated server. I use virt-manager on my laptop (Ubuntu 16.04) to connect it remotely. Everything works quite well except copy/paste actions between VM's SPICE display(the one embedded in virt-manager) and my laptop's Ubuntu.

All packages are from official repositories. No PPA or 3rd party repository involved.

Also tried VNC instead of Spice but that didn't work too.

I just got an idea that I may connect through RDP to a VM machine, but it's painfully process because of all firewalls and routes between my laptop and the machine. Also not all of my machines has WAN access.

Looking for easier solution on virt-manager.

1
  • Do not delete the "Channel Spice" or "Controller VirtIO Serial" devices in virt-manager or else the host/guest clipboard will not work.
    – Trix
    Commented May 5, 2019 at 13:30

5 Answers 5

7

You'll need to be sure that you have the libvirt guest utilities installed to your guest operating system, to begin.

Also, in order for copy/paste to work, you'll need a SPICE guest agent socket device in addition to a VirtIO Serial device assigned to the VM, which will allow virt-viewer and most other SPICE clients to pipe copy/paste over a virtual serial connection, which the guest agent will hande. Defining these devices may have already been done for you, especially if you use virt-manager to make these VMs (virt-manager assumes a GUI install of most guests).

In order to install the guest agent on a Debian based GNU/Linux guest machine, you'll need to run: sudo apt install spice-vdagent

In order to install the guest agent on a Windows machine, you must install the package which can be found here: https://www.spice-space.org/download/binaries/spice-guest-tools/

And finally, you will need to install VirtIO drivers in Windows in order to get most advanced functionality. This can be accomplished by adding drivers from the Win-virtio ISO (which you'll have to attach to the guest). A link to those: https://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers

As you've pointed out in the comment below, you must ensure that the spice agent is running in the guest before this will function fully. A reboot is a sure way to get that agent running.

6
  • 2
    I had to reboot after installation of spice-vdagent but worked like a charm. Thanks.
    – thiras
    Commented Sep 19, 2017 at 10:51
  • An important detail. I'll update with your contribution.
    – Spooler
    Commented Sep 19, 2017 at 13:37
  • 1
    "You'll need to be sure that you have the libvirt guest utilities installed to your guest operating system, to begin." Can you be more specific? I have searched for what this might refer to, and I can't find information anywhere. Commented Mar 12, 2019 at 16:17
  • 1
    What is the libvirt guest utils? such a thing does not exist.
    – john doe
    Commented Jul 29, 2020 at 20:55
  • 1
    sorry, but it's not clear, what are libvirt guest utils and what about that in linux?
    – Rodrigo
    Commented Sep 27, 2020 at 2:17
2

For those looking for an answer you need to add to the XML file this

<devices>
    <controller type='virtio-serial' index='0'/>
    <channel type='spicevmc'>
        <target type='virtio' name='com.redhat.spice.0'/>
    </channel>
</devices>

and install the guest, the debian package is called spice-vdagent and reboot the vm

Docs: https://www.spice-space.org/spice-user-manual.html#agent

1

Make sure these things if your guest operating system is linux based:-

  1. display input should be spice-vdagent

  2. spice-vdagent is installed in guest operating system

  3. Don't forget to Start spice-vdagent by just typing spice-vdagent in the terminal and add this to the .bashrc or .zshrc file whatever shell you are using

  4. Will work in boxes or in QEMU/KVM virtmanager

1

I don't have enough reputation in order to comment so I'll just leave this as an answer.

Since Debian 12, I've had to manually run spice-vdagent as the user even though the service/socket are running with systemd. So in my process list I have one running as root (kicked off my systemd), and another kicked off manually by my user.

KDE Plasma's autostart can help kick this off as the user on login.

1
0

Install package qemu-guest-Magent and switch Guest KDE plasma to X11 session solve the clipboard sharing issue for me.

My config:

  • Host, Guest OS: archlinux
  • Host, Guest display server protocol: X11
  • Host, Guest DE: KDE Plasma

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .