Page 1 of 1

Virtualisation with Virt-Manager, Qemu/KVM and Spice

PostPosted: Aug 14th, '21, 17:07
by Bequimao
Continuation from viewtopic.php?f=41&t=12043&p=70403&hilit=virt+manager#p70403

Virt-Manager is a graphical UI for virtual machines run by Qemu/KVM, libvirt (and others).
Spice is a protocol for sharing devices and data between host and guests.

How to start

Packages needed on the host are qemu-kvm, virt-manager, and virt-viewer.

Create a system group libvirt as root
Code: Select all
# groupadd --system libvirt

Assign your user to it
Code: Select all
# usermod -aG libvirt <user-name>


This also could be implemented in MCC. System groups have group IDs lower than 1000.

The Virtual Machines are owned by root. The isos and paths should be readable by group qemu.
If you want to run a virtual machine as a regular user, uncomment these lines in /etc/libvirt/libvirtd.conf

Code: Select all
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"


References
https://fedoramagazine.org/full-virtual ... tation-30/
https://www.spice-space.org/spice-user-manual.html

Best regards,
Bequimão

Host Configuration

PostPosted: Aug 14th, '21, 17:21
by Bequimao
The host has IOMMU enabled (input–output memory management unit), that is
kernel parameter intel_iommu=on in the case of a Intel cpu.

Virt-Manager needs under -> View -> Details
Network: default - NAT
Display Spice
Video QXL
3 Channels: qemu-ga, spice, spice-webdav

Virt-Manager does not provide any configuration for shared folders. So you need remote-viewer to grab the video connection. Remote-viewer is provided by virt-viewer, the connection is spice://localhost:5900, if you have the guest running on the same machine as the host.You find the configuration in Remote Viewer under Preferences.

Systemd units on the host
Code: Select all
[root@mga8-tst2 ~]# systemctl list-units |  grep libvirt
  libvirtd.service                                                                                loaded active running   Virtualization daemon                           
  libvirtd-admin.socket                                                                           loaded active running   Libvirt admin socket                           
  libvirtd-ro.socket                                                                              loaded active running   Libvirt local read-only socket                 
  libvirtd.socket                                                                                 loaded active running   Libvirt local socket                           
[root@mga8-tst2 ~]#

Guest configuration

PostPosted: Aug 14th, '21, 17:31
by Bequimao
The guest VM needs spice-vdagent and spice-webdavd installed.

The guest needs further avahi to provide avahi-daemon, zeroconf, and mdmsd to communicate with the host.
If successful, you find the shared folder for instance in Dolphin under Network -> Network Services -> zeroconf -> WebDav remote directory -> Spice client folder.

Systemd units on the guest
Code: Select all
[root@mga8-vm ~]# systemctl list-units | egrep 'avahi|spice'
  avahi-daemon.service                                                        loaded active running   Avahi mDNS/DNS-SD Stack             
  spice-vdagentd.service                                                      loaded active running   Agent daemon for Spice guests       
  spice-webdavd.service                                                       loaded active running   webdav daemon for Spice guests       
  avahi-daemon.socket                                                         loaded active running   Avahi mDNS/DNS-SD Stack Activation Socket
  spice-vdagentd.socket                                                       loaded active running   Activation socket for spice guest agent daemon
[root@mga8-vm ~]#

I do have now a Qemu/KVM virtual machine with shared folder, usb redirection, and clipboard sharing to fully replace Oracle VirtualBox.
I tested with Mageia 8 KDE Plasma both as host and guest.

Much work to get there! Enjoy!

Greetings,
Bequimão