Hi.
I’ve switched up my NixOS setups and now am using:
{
networking = {
# ...
useNetworkd = true;
interfaces."eth0".useDHCP = true;
interfaces."enp56s0u2u3".useDHCP = true;
interfaces."enp56s0u1u3".useDHCP = true;
interfaces."wlan0".useDHCP = true;
};
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
qemuRunAsRoot = false;
};
virtualisation.spiceUSBRedirection.enable = true;
}
But I can’t seem to figure out how to create a useful virbr0
now for use with libvirtd.
If I naively go into virt-manager and try to start the default network (virbr0), I get this confusing error message about “Cannot allocate memory”:
Error starting network 'default': internal error: Child process (VIR_BRIDGE_NAME=virbr0 /nix/store/a9j00qbafqhai9nl8fvrwmivkcavcli5-dnsmasq-2.83/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/nix/store/fnxa395lcwdyb9cpxl1n43c870hgn2q7-libvirt-7.0.0/libexec/libvirt_leaseshelper) unexpected exit status 3:
dnsmasq: cannot run lease-init script /nix/store/fnxa395lcwdyb9cpxl1n43c870hgn2q7-libvirt-7.0.0/libexec/libvirt_leaseshelper: Cannot allocate memory
Traceback (most recent call last):
File "/nix/store/y6pv4phsnnqgzjbwwyb89dxqgla5fsi9-virt-manager-3.1.0/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
callback(asyncjob, *args, **kwargs)
File "/nix/store/y6pv4phsnnqgzjbwwyb89dxqgla5fsi9-virt-manager-3.1.0/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb
callback(*args, **kwargs)
File "/nix/store/y6pv4phsnnqgzjbwwyb89dxqgla5fsi9-virt-manager-3.1.0/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
ret = fn(self, *args, **kwargs)
File "/nix/store/y6pv4phsnnqgzjbwwyb89dxqgla5fsi9-virt-manager-3.1.0/share/virt-manager/virtManager/object/network.py", line 69, in start
self._backend.create()
File "/nix/store/bwd2fwf2iylp9rcdcs3iz0myyhs85009-python3.8-libvirt-7.0.0/lib/python3.8/site-packages/libvirt.py", line 3436, in create
raise libvirtError('virNetworkCreate() failed')
libvirt.libvirtError: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /nix/store/a9j00qbafqhai9nl8fvrwmivkcavcli5-dnsmasq-2.83/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/nix/store/fnxa395lcwdyb9cpxl1n43c870hgn2q7-libvirt-7.0.0/libexec/libvirt_leaseshelper) unexpected exit status 3:
dnsmasq: cannot run lease-init script /nix/store/fnxa395lcwdyb9cpxl1n43c870hgn2q7-libvirt-7.0.0/libexec/libvirt_leaseshelper: Cannot allocate memory
Any suggestions? Should I be explicitly creating the virbr0
in my nixos configuration, and if so, what does that look like? I preferred it when libvirtd was able to do this itself.