I know I’ve done this but I forgot how and I haven’t used it in many years now.
But there is a way to use libvirt and virt-manager to create VMs and networks without requiring root.
I have of course added myself to the libvirt group, and rebooted to verify that with id my-user.
I have also edited /etc/libvirt/libvirtd.conf.
$ sudo grep -v '^#' /etc/libvirt/libvirtd.conf | grep -v '^$'
unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"
auth_unix_ro = "polkit"
auth_unix_rw = "polkit"
And I can define a network but the problem is that I can’t start it, make it active. If I connect to qemu:///session in virt-manager and try to start it I get asked for my password, and get a permission denied exception.
Error starting network 'default': error creating bridge interface virbr0: Operation not permitted
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 107, in tmpcb
callback(*args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
ret = fn(self, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/network.py", line 69, in start
self._backend.create()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/site-packages/libvirt.py", line 3569, in create
raise libvirtError('virNetworkCreate() failed')
libvirt.libvirtError: error creating bridge interface virbr0: Operation not permitted
On my old system many years ago I used to just have this virbr0 on at boot and could freely create VMs without root after that. But if I define it in qemu:///system then my session VMs won’t find it when I specify the network name. Should I perhaps specify the bridge name instead?
Just trying to remember all the tricks I went through to get this working in the past. I’m pretty sure setting up the initial bridge did require root, but then it was just there and ready to be used.