Is there something like "VirtualBox Guest Additions" for QEMU/KVM?

30,675

Solution 1

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.

Solution 2

Yes, the SPICE guest additions

https://www.spice-space.org/download.html#guest

Share:
30,675
cl-netbox
Author by

cl-netbox

Updated on September 18, 2022

Comments

  • cl-netbox
    cl-netbox over 1 year

    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.

  • Admin
    Admin over 7 years
    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.
  • cl-netbox
    cl-netbox over 7 years
    @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. :)
  • feedc0de
    feedc0de over 6 years
    This helped A LOT with my windows guest!