To enable copy-paste between a QEMU host and guest, install spice-vdagent (or guest tools) in the guest OS, ensure it’s running, and use the SPICE display protocol for seamless clipboard sharing, often requiring the virtio-serial device and correct QEMU arguments in your setup. For Windows guests, you may also need to install VirtIO drivers, and for Linux guests, ensure the service starts correctly after X starts.
For Linux Guests (e.g., Ubuntu, Fedora)
- Install Agent: In the guest VM, run
sudo apt install spice-vdagent(Debian/Ubuntu) orsudo dnf install spice-vdagent(Fedora). - Ensure Service is Running: The agent usually starts automatically, but you might need to run
sudo systemctl start spice-vdagentor add it to startup. - Use SPICE: Ensure your QEMU setup uses the SPICE display protocol (e.g.,
-display spice) and includesvirtio-serialdevices for communication.
For Windows Guests (e.g., Windows 10/11)
- Install VirtIO Drivers: Download and install the VirtIO guest tools (virtio-win-pkg) from Fedora’s website for the necessary Spice Guest Driver and VirtIO Serial driver.
- Install Agent: Install
spice-vdagentwithin the guest after the drivers are in place. - Check Service: Verify the
spice-vdagentservice is running in Windows Services. - Use SPICE: Use SPICE for display and ensure the correct QEMU arguments for
virtio-serialare set.
For Both & General Troubleshooting
Restart: Restart the guest VM and potentially the host’s
virt-manager(if used) after installation.QEMU Arguments: When launching QEMU, ensure you have lines like these for the host to pass to the guest:
-device virtio-serial-pci \ -chardev spicevmc,id=charchannel1,name=vdagent \ -device virtserialport,chardev=charchannel1,id=channel1,name=com.redhat.spice.0Alternative (Manual): If all else fails, you can use standard copy-paste, but you might need to click the VM’s title bar first, then click inside the guest before pasting (less reliable).
Drag & Drop: For file transfers, drag-and-drop often works with the same setup (spice-vdagent + virtio drivers).#