8

I run some Ubuntu VMs in QEMU/KVM with virt-manager as the GUI. The one thing I really miss from VirtualBox though is the ability to install "Guest Additions" which would allow a shared clipboard and the ability to drag and drop files from host to guest and visa versa (though one would be able to select if it would just work one way or both).

Is there something like this for QEMU/KVM? I am running Ubuntu GNOME 16.04.1 with GNOME 3.20 as the host and similar VMs.

4

Yes, there is something like guest additions in virt-manager - it just has to be done a little bit differently. To make it easy for you to see how it works, I'll provide you with some screenshots.

First change the ACL attributes of the libvirt-qemu user to give write permissions on the shared folder : sudo setfacl -R -m u:libvirt-qemu:rwx /<path-of-the-shared folder>
and the Vdisk : sudo setfacl -R -m u:libvirt-qemu:rwx /<path-of-the-virtual-disk>

In the example below I gave permissions for all separate mounted partitions to be flexible :
sudo setfacl -R -m u:libvirt-qemu:rwx /media/cl (as I said - an example of my setup)

Open the virtual machine in virt-manager - select the disk - mark Shareable - click on Apply.

enter image description here

Click on Add Hardware - select Filesystem - change the Mode to Mapped - click on Browse.

enter image description here

Click on Browse Local.

enter image description here

Select the folder you want to share with the guest operating system - click on Open.

enter image description here

Type /host into the field Target path - click on Finish.

enter image description here

Now boot the guest system, create a folder with the same name as the one you selected to be shared in the host system (in my example : share) in the /home directory of the guest system. Open a terminal and execute the following command to mount the shared folder in the guest :

sudo mount -t 9p -o trans=virtio,version=9p2000.L /host /home/<your-user-name>/<your-shared-folder-name>  

Et voilà - now you are having equivalent functionality as with the guest additions in VirtualBox.

  • It would be good if you explained about USB redirection as well. And is there any way to get a shared clipboard? Because that would be really quick and useful for me. – user364819 Nov 20 '16 at 17:42
  • @ParanoidPanda : In my case the shared clipboard works, so when I copy a command in the host, I can paste it within the guest. This was achieved by marking 'Shareable' as shown in the first screenshot. I haven't used USB redirection yet ... maybe you see if it works, when you "play around" a bit with it. :) – cl-netbox Nov 20 '16 at 18:02
2

Yes, the SPICE guest additions

http://www.spice-space.org/download.html

  • This helped A LOT with my windows guest! – feedc0de Nov 6 '17 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy