Anyone know how to get Virtual Manager to install copy-paste functionality to the Virtual Machine?
-
1Please describe more about "copy functionality". Which functionality do you need? Don't you access to ssh on the host? – shgnInc May 12 '14 at 09:17
-
adding to @shgnlnc: or you want bidirectional copy and paste for host and guest? – TPS May 12 '14 at 10:39
-
related: https://askubuntu.com/questions/858649/how-can-i-copypaste-from-the-host-to-a-kvm-guest – Ciro Santilli OurBigBook.com Jun 17 '18 at 00:09
4 Answers
You have to use "Spice" instead of "VNC" :
- No more need to install
spice-gtk:virt-managerhas now aspice-gtkclient built-in. But you need to installpython-spice-client-gtk(spice-client-gtkon debian) on the VM host- If you use
virt-manageron another machine to connect to the VM host remotely through ssh, you must also installpython-spice-client-gtkon that machine
- If you use
- Start
virt-manager - Select you virtual machine
- Power on the virtual machine
- Connect to your guest with
ssh; in the guest, installspice-vdagentand verify thatspice-vdagentdis launched (ps -lef|grep spice-vdagentdwill return you the process if its running) - Show virtual hardware details
- Select
Display VNC, changeVNCtoSpiceand accept to add the Channel - Change the
Video model from Cirrus(the default) toQXL - Restart
virt-managerand power on the virtual machine
You are using Spice.
Another solution, without X, but assuming that you are able to ssh to your host from your machine, and to your VM from your host :
mymachine:~$ssh user@hosthost:~$ssh user@guest
- 482
- 4
- 8
-
Should install these packages on a machine which virt-manager was installed on it? Or exactly on Host? – shgnInc May 12 '14 at 09:19
-
There is no more need to install spice-gtk. I have changed the answer. – Guillaume Vauvert May 12 '14 at 10:29
-
2Actually it seems that once you install `spice-vdagent` in guest, there's no need to restart `virt-manager` nor the guest to use clipboard sharing. It's enough to logout and then login back **in the guest.** – gerlos Nov 08 '17 at 20:39
-
2For me (on debian) only the daemon `spice-vdagentd` started after the reboot, without sharing the clipboard. I had to autostart `spice-vdagent` via _.xsessionrc_ to get it working. – S1J0 Nov 09 '20 at 18:39
You need to install Spice guest agent into the guest:
- spice-guest-tools for Windows guest
- spice-vdagent for linux guest
Check "Guest" part of Spice downloads section: https://www.spice-space.org/download.html
- 372
- 3
- 5
-
10For Windows guest, in addition to installing spice-guest-tools, I needed to do the following in virt-manager: Add Hardware -> Channel, set name to "com.redhat.spice.0" (or similar), set device type as "Spice agent (spicevmc)". I found this info from this reddit post after searching for a long time: https://www.reddit.com/r/linux/comments/asw4wk/to_all_you_virtmanager_and_spice_display_users/ – jackkamm Jun 11 '19 at 15:38
-
1Update: The above channel name setting was not required for me. Just installing the spice-guest-tools for Windows 10 worked. Thanks – Haris Jan 20 '22 at 13:22
-
What about with a legacy guest os where tools are not available? I'm trying to install ubuntu 10.04 as a guest. I want to hijack the keyboard IO with my paste data. – Julian Feb 26 '22 at 21:55
With a Linux (Debian 11/bullseye) host and a Windows 10 guest, I did the following to enable copy-and-paste between the guest and the host:
- Install
spice-guest-toolson Windows guest; the binaries can be downloaded from https://www.spice-space.org/download.html. - Install
spice-vdagenton Linux host. - Using
virt-manager(on host) change the Windows VM configuration:- Set the 'Display' to 'Spice'.
- Add a 'spicevmc' Channel (via 'Add Hardware');
The XML data will be:
channel type="spicevmc"
target type="virtio"
name="com.redhat.spice.0"
alias name="channel0"
address type="virtio-serial" controller="0" bus="0" port="2"
- In Linux host, enable
spice-vdagentd.service; eg.# systemctl enable spice-vdagentd.service` - Restart Linux.
The copy-and-paste functionality is ready to use.
- 151
- 1
- 3
-
-
I did it via `virt-manager`; the XML content is copied from the GUI. But if you want to change the VM configuration via editing the XML, then you could use the command `virsh edit
`. – AlQuemist Oct 01 '21 at 07:04 -
1For Ubuntu 20.04.5 LTS and "virt-manager/focal,focal,now 1:2.2.1", just "spice-guest-tools" is enough. Virt Manager switched to Spice server automatically. – clarkttfu Oct 24 '22 at 10:59
Another option is to use Barrier (software-based KVM) https://github.com/debauchee/barrier.
Install it on your host as the server. Install it on your VM as a client.
Here is what my client setup looks like.
Next, tell Barrier where (spatially) your client is. This is personal preference, but I set mine to be above my host. It is kind of awkward since the VM obviously is nested inside your host, but it still works very well.
Click Configure Server on Barrier running on your host machine. Here is my setup:
What you label the screen matters here. Notice, in my first image, the Screen name is "jareds-iMac". This has to match.
With this setup, when you move your mouse past the top of your screen, it switches into the VM. Copy-paste will work from host to machine and vice-versa. An added benefit is that you don't have to press any hotkeys to release the "grab" from the VM.
- 101
- 2

