Failed to start network "default", libvirt errors, why, how to fix?

I get the following errors, trying to start a vm, or running “virsh net-start default”

-maybe related, 2 days ago I’ve noticed the system doing an update to dnsmasq-base.
-netstat -tuln | grep 192.168.122.1 … returns nothing
-virbr0 is not existant in the network manager gui interface
-“virsh net-edit default” and changing “virbr0” to something else = problem still there

running “virsh net-start default”

error: Failed to start network default
error: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) unexpected exit status 2: 
dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use

And in journalctl

libvirtd[1119]: libvirt version: 8.0.0, package: 1ubuntu7.8 (Lena Voytek <[email protected]> Wed, 29 Nov 2023 14:52:52 -0700)
libvirtd[1119]: internal error: Child process (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script>
                                     dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
avahi-daemon[1003]: Interface virbr0.IPv4 no longer relevant for mDNS.
avahi-daemon[1003]: Leaving mDNS multicast group on interface virbr0.IPv4 with address 192.168.122.1.
avahi-daemon[1003]: Withdrawing address record for 192.168.122.1 on virbr0.
NetworkManager[1006]: <info>  [1709096597.7383] device (virbr0): state change: activated -> unmanaged (reason 'connection-assumed', sys-iface-state: 'external')
NetworkManager[1006]: <info>  [1709096597.7385] manager: NetworkManager state is now DISCONNECTED

Help, please. thank you.

1 Like

From what I understand libvirt tries to create a virtual network (default usually is a NAT network) with an 192.168.122.1/24 CIDR. This CIDR seems to be already to exist on your computer, either with on of the other network interfaces or maybe with a VPN. Point it is fails to create it since such a socket already exists.

You can either remove the other network using this CIDR or you should be able to solve the DHCP on the default network to say 192.168.123.1/24 and it should probably work.

My first step would be to check with ip addr if there is already an IP address present assigned to 192.168.122.X. This gives you more of an idea to identify where the conflict comes from and how to resolve it.

I’ve tried “ip addr” and there’s only the “lo”, enp14s0, and wlp15s0 (it’s down). None of them have an ipaddress of 192.128.122.xxx.
Tried also nmap 192.168.122.1/24, and returns 0 hosts up

That is weird. What is the output of sudo virsh net-list?

Does it list any interfaces?

Another idea would be to destroy and recreate the interface!

did try changing the ip adress of it to 192.168.122… to 123, same problem but this time on the …123 address.

the result of the net-list is

 Name      State      Autostart   Persistent
----------------------------------------------
 default   inactive   yes         yes
1 Like

I would delete and recreate the default network, maybe something is wrong there. This is just a guess though!

Went into virt-manager, selected “default” and delete.
Press “+” to create another one, and whatever address i specify it gives the same errors but with the new address, it doesn’t even let me create it. Tried 192.168.122 … 123 …100.

In virt-manager have you made sure you changed to IPv4 and DHCP options? You would need to change the IP range three times when you change it in virt-manager! It gives me the same error message if I do not do that, but creates the interface otherwise. There seems to be something wrong with your libvirt/kvm setup! Is it a fresh install or have you made modifications to it yet?

hello. I also had the same problem in Ubuntu.
dnsmasq-base was recently upgraded, and I’m not sure why, but compatibility seems to have been broken.
This could be resolved by downgrading dnsmasq-base to version 2.86-1.1 and then reactivating the network.

If you are Ubuntu, downgrade using the command below.
sudo apt install dnsmasq-base=2.86-1.1

Thanks @steamb23 - this seems to have fixed my issue and on upgrade/update, it updates the package again …

I wonder if there is a permanent fix I need to lookout for here?

Thank you

There’s your problem. Ok, not really, but I don’t like NM, such a headache to deal with (it’s good when you need to constantly switch networks though, but otherwise, for static configurations, ip never let me down).

I’d say to create a bridge to your main interface, take off the IP from that (if you use DHCP, disable DHCP on the main one) and set up your IP on the bridge.

ip link add virbr0 type bridge
ip link set eth0 master virbr0
ip link set virbr0 up
ip link set eth0 up

ip addr add 192.168.1.2/24 brd + dev virbr0
ip r add default via 192.168.1.1 dev virbr0
# Or use DHCP on virbr0 and disable it on eth0

Then just set your VMs to use virbr0 as a bridge interface. Note that idk how to make this work on wifi, there you’d need NAT most likely (that’d because frames get authenticated and last I tried, I couldn’t bridge a wlan interface - I’d appreciate help on that for on-the-go virtualization).

1st- thank you all. Maybe we’ll find a real solution since it seems that i’m not the only one affected by it ( steamb23 seems to be affected to)

meanwhile,
I have Bind9 installed as a simple recursive dns.
So after the livbirt/vm network was deleted (as said above), I:
-stop the bind9/named.service.
-successfully (and without a complaint from libvirt/virt-manager/…) recreated the network in virt-manager.
-Virt-manager says network is active. Good.
-tested with virsh net-stop default/virsh net-stat default. It worked.
-Restart bind9/named.service.

It works.

Sadly uppon reboot, the problem is back.

So at this point I don’t know if:
1-install the previous dnsmasq-base and lock it from updating with “sudo apt-mark hold dnsmasq-base”
2-create a bug report for dnsmasq-base or libvirt(where/how?)
3-find where i could configure bind9 to still do the recursive dns resolutions (for my host AND the guest o.s.), how and where?
4-hacky and headache way: when wanting to run a v.m. and only needed once per host login session: temporary stop bind9, start virt network, restart bind9, start virtual machines. Until the incompatibilities magically clear themselves.

Since I’m not the only one who seems affected (steamb23 also seems affected), I’m leaning toward idea 1 and 2. Any thoughts?

I recently had this issue as well.
OS: Ubuntu 22.04.4 LTS
Tried to downgrade dnsmasq-base to 2.86-1.1 and it really worked. Thanks!!!