2

I have a QEMU VM, both the host and guest OS being ubuntu 20.04. I wanna enable copy & paste function between the host and guest. I have read the answers of following two thread:

  1. How can I copy&paste from the host to a KVM guest?

  2. https://unix.stackexchange.com/questions/109117/virt-manager-copy-paste-functionality-to-the-vm

But none of them work. I have installed spice-vdagent and checked that it's loaded. So does Spice work only for GUI mode of Ubuntu guest OS? Does it work for pure text mode guest and graphics host?

PS: I know I can ssh, I just wanna know if Spice works for text mode settings.

zzzhhh
  • 247
  • 3
  • 10

1 Answers1

5

Had the same issue with the same setup (host and guest both running Ubuntu 20.04), and I also struggled to solve it by following the answers from the multiple threads that I saw online.

This was because no SPICE agent channel was defined in my VM's XML configuration file.

The complete solution for me was therefore the following :

  1. Install spice-vdagent package on the guest system ;
  2. In the virtual machine's settings, set the "Display" option to "Spice server" instead of "VNC server" (graphics type="spice" in XML), and set "Video" to "QXL". With virt-manager, this is done by selecting (opening) the virtual machine and going to the "Show virtual hardware details" tab (white "i" on a blue dot icon).
  3. Create a channel for the SPICE agent. With virt-manager, select the virtual machine and go to the "Show virtual hardware details" tab again, then click "Add Hardware" at the bottom and select "Channel" with "Spice agent (spicevmc)" and finally hit "Finish".

In the XML configuration, the channel should look like this (adapt the numbers to your setup) :

<channel type="spicevmc">
  <target type="virtio" name="com.redhat.spice.0"/>
  <address type="virtio-serial" controller="0" bus="0" port="2"/>
</channel>
  1. Apply the changes by rebooting the VM or just logging out and back in. Restarting virt-manager may also be necessary.

After doing all of that, copy and paste works just fine between my two systems.

ThePierrasse
  • 51
  • 1
  • 4