This page will walk you through the configuration of libvirtd and QEMU. These are necessary changes to config files to properly use Virt-Manager via Root, as User.
1. Modifying Configuration Files
There are two files we must edit. Please make the changes accordingly. Not too much to say, follow this step-by-step and you'll be fine along with getting logs printed and saved in case issues occur.
libvirtd.conf
Use your favorite text editor to make the following changes to:
/etc/libvirt/libvirtd.conf
If your distribution uses AppArmor, or SELinux do not forget to change the following line to disable them for Libvirt. Mostly an issue on Debian based systems. Skip if you don’t know. Come back later if some permission issues relating to security pop up, and apply the following change.
Disable Security Driver -> As a last resort, set driver to none
# security_driver = [ "selinux", "apparmor" ] security_driver = "none"
Read/Write permissions and Group -> Uncomment the following lines
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
Enable libvirt Logging -> Add to the very bottom of libvirtd.conf
log_filters="3:qemu 1:libvirt"
log_outputs="2:file:/var/log/libvirt/libvirtd.log"
qemu.conf
Use your favorite text editor to make the following changes to:
/etc/libvirt/qemu.conf
Read/Write permissions and Group -> Uncomment and Edit the following lines to your username
user = "root"
group = "root"
Example of properly updated section:
user = "royalgraphx"
group = "royalgraphx"
2. Enable libvirtd Services
Adding yourself to the libvirt group allows for password-less root both from the host and guest. If you are uncomfortable with that and want to avoid this, consider using Polkit instead which will prompt you for your password. While this configuration is completely safe for our use case, be aware of what you’re doing when following guides online, and modifying system files.
You now need to add your user to the kvm and libvirt groups, to allow libvirt to write files properly.
sudo usermod -a -G kvm,libvirt $(whoami)
Now enable and restart the libvirtd Service to fully apply changes:
sudo systemctl enable libvirtd
sudo systemctl restart libvirtd