missing documentation for creating virtual networks in user session mode
Software environment
- Operating system: ArchLinux
- Architecture: x64_86
- kernel version: 6.4.1-arch1-1
- libvirt version: libvirtd (libvirt) 9.4.0
- Hypervisor and version: QEMU emulator version 8.0.2
Description of problem
"Operation not permitted" error and no documentation on how to either grant permissions or bootstrap network as root for usage by non-root users in qemu/kvm user session mode.
Error creating virtual network: error creating bridge interface virbr1: Operation not permitted
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/createnet.py", line 428, in _async_net_create
netobj.create()
File "/usr/lib/python3.11/site-packages/libvirt.py", line 3547, in create
raise libvirtError('virNetworkCreate() failed')
libvirt.libvirtError: error creating bridge interface virbr1: Operation not permitted
Steps to reproduce
- Trying to create a virtual network in user session (qemu:///session)
Additional information
Only things that I could find that work are:
- Using QEMUs "User mode networking" that is not very flexible and has bugs when working with existing scripts that expect to find an associated network to fetch the VMs IP from. But it works for basic IPv4 connectivity (IPv6 didn't work)
- (not documented but looks like it works) Create a virtual bridge network as root and add it to user mode via XML (example for default bridge (fully defined in qemu:///system context) below), still not fully working, but more flexible than the QEMU one and works in cases where the user can switch into root context but is using user mode for other reasons.
<network>
<name>default</name>
<uuid>5e61849d-6955-4d0f-915b-c1d992b0e7af</uuid>
<forward mode="bridge"/>
<bridge name="virbr0"/>
</network>