Page 1 of 1

[Solved] QEMU/KVM network not starting

Posted: 2025-01-12 00:47
by Fontenele
Hello there,

I think, due to the updates today, QEMU/KVM network is not starting

Result of sudo systemctl status libvirtd:

Code: Select all

erro:Falha ao iniciar a rede default
erro:erro interno: Processo filho (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) inesperado status de saída 2: 
dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
Result of sudo systemctl status libvirtd

Code: Select all

jan 11 21:36:57 revolutions systemd[1]: Starting libvirtd.service - Virtualization daemon...
jan 11 21:36:57 revolutions systemd[1]: Started libvirtd.service - Virtualization daemon.
jan 11 21:37:26 revolutions dnsmasq[6241]: failed to create listening socket for 192.168.122.1: Address already in use
jan 11 21:37:26 revolutions dnsmasq[6241]: FAILED to start up
jan 11 21:37:26 revolutions libvirtd[2706]: libvirt version: 9.0.0, package: 9.0.0-4+deb12u2 (Debian)
jan 11 21:37:26 revolutions libvirtd[2706]: hostname: revolutions
jan 11 21:37:26 revolutions libvirtd[2706]: erro interno: Processo filho (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/l>
                                            dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
Topic created today here at the forum entitled "Updated Debian 12: 12.9 released", mention updates at QEMU e DNSMASQ

Code: Select all

 qemu [54] | New upstream bugfix release [CVE-2024- |
| | 7409]; mark internal codegen helper |
| | symbols as hidden, fixing build failure |


| dnsmasq [13] | Fix denial of service issues [CVE-2023- |
| | 50387 CVE-2023-50868]; set default |
| | maximum EDNS.0 UDP packet size to 1232 |
| | [CVE-2023-28450] |
| | |
Anyone is facing the same issues post today's update?

EDIT: Indeed was today's update, using Timeshift, i restored yesterday's image and everything went fine starting QEMU/KVM network. Anyone knows how to fix it?

Re: QEMU/KVM network not starting

Posted: 2025-01-12 03:18
by CwF
Fontenele wrote: 2025-01-12 00:47 dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
Who's that?
maybe something like

Code: Select all

ss -p -o | grep 192.168
or

Code: Select all

journalctl -b 0 -g 192.168 --no-pager
Rebooted?

Re: QEMU/KVM network not starting

Posted: 2025-01-12 09:11
by gooksin
Hi,
Same issue here after yesterday's upgrade.
This is the output from journalctl -b 0 -g 192.168 --no-pager :

Code: Select all

de gen. 12 09:45:44 XXX systemd-networkd[512]: wlp3s0: DHCPv4 address 192.168.1.67/24, gateway 192.168.1.1 acquired from 192.168.1.1
de gen. 12 09:45:46 XXX named[1011]: listening on IPv4 interface wlp3s0, 192.168.1.67#53
de gen. 12 09:45:52 XXX named[1011]: listening on IPv4 interface virbr0, 192.168.122.1#53
de gen. 12 09:45:53 XXX dnsmasq[1243]: failed to create listening socket for 192.168.122.1: Address already in use
de gen. 12 09:45:53 XXX libvirtd[1009]: 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
de gen. 12 09:45:53 XXX named[1011]: no longer listening on 192.168.122.1#53
The named deamon is loaded before, as you can see. There were no issues with that before yesterday's upgrade to 12.9

I haven't tried to reboot yet, but I suspect there will not be any difference.

Any clues?
Thank you!

Re: QEMU/KVM network not starting

Posted: 2025-01-12 10:10
by Fontenele
CwF wrote: 2025-01-12 03:18
Fontenele wrote: 2025-01-12 00:47 dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
Who's that?
maybe something like

Code: Select all

ss -p -o | grep 192.168
udp ESTAB 0 0 192.168.100.6%enp4s0:bootpc 192.168.100.1:bootps
tcp ESTAB 0 0 192.168.100.6:35000 34.206.101.32:https users:(("firefox-esr",pid=6385,fd=113)) timer:(keepalive,1min31sec,0)
tcp ESTAB 0 0 192.168.100.6:53790 185.70.42.37:https users:(("firefox-esr",pid=6385,fd=116))

or

Code: Select all

journalctl -b 0 -g 192.168 --no-pager
This one gave a bunch of info, especifi for 192.168.122 gave this:

sudo journalctl -b 0 -g 192.168.122 --no-pager
jan 11 22:36:20 revolutions avahi-daemon[874]: Joining mDNS multicast group on interface virbr0.IPv4 with address 192.168.122.1.
jan 11 22:36:20 revolutions avahi-daemon[874]: Registering new address record for 192.168.122.1 on virbr0.IPv4.
jan 11 22:36:20 revolutions dnsmasq[6137]: failed to create listening socket for 192.168.122.1: Address already in use
jan 11 22:36:20 revolutions libvirtd[2691]: erro interno: Processo filho (VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) inesperado status de saída 2:
dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
jan 11 22:36:20 revolutions avahi-daemon[874]: Leaving mDNS multicast group on interface virbr0.IPv4 with address 192.168.122.1.
jan 11 22:36:20 revolutions avahi-daemon[874]: Withdrawing address record for 192.168.122.1 on virbr0.
jan 12 07:08:44 revolutions sudo[1638429]: marcelo : TTY=pts/0 ; PWD=/home/marcelo ; USER=root ; COMMAND=/usr/bin/journalctl -b 0 -g 192.168.122 --no-pager


Rebooted?

Yes

Re: QEMU/KVM network not starting

Posted: 2025-01-12 16:01
by Aki
Hello,
gooksin wrote: 2025-01-12 09:11

Code: Select all

de gen. 12 09:45:44 XXX systemd-networkd[512]: wlp3s0: DHCPv4 address 192.168.1.67/24, gateway 192.168.1.1 acquired from 192.168.1.1
de gen. 12 09:45:46 XXX named[1011]: listening on IPv4 interface wlp3s0, 192.168.1.67#53
de gen. 12 09:45:52 XXX named[1011]: listening on IPv4 interface virbr0, 192.168.122.1#53
de gen. 12 09:45:53 XXX dnsmasq[1243]: failed to create listening socket for 192.168.122.1: Address already in use
de gen. 12 09:45:53 XXX libvirtd[1009]: 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
de gen. 12 09:45:53 XXX named[1011]: no longer listening on 192.168.122.1#53
The named deamon is loaded before, as you can see. There were no issues with that before yesterday's upgrade to 12.9
Normally named and dnsmasq daemons listen on the same port (53), unless they are configured differently, so they will conflict if they are running at the same time.

@gooksin: Do you need the named daemon (from bind9 package) running on your computer ?

@Fontenele: Is the named daemon (from bind9 package) installed in your computer ? Is its error message reported in systemd journal as for gooksin user ?

Hope this helps.

Re: QEMU/KVM network not starting

Posted: 2025-01-12 17:19
by Fontenele
Aki wrote: 2025-01-12 16:01 Hello,
gooksin wrote: 2025-01-12 09:11

Code: Select all

de gen. 12 09:45:44 XXX systemd-networkd[512]: wlp3s0: DHCPv4 address 192.168.1.67/24, gateway 192.168.1.1 acquired from 192.168.1.1
de gen. 12 09:45:46 XXX named[1011]: listening on IPv4 interface wlp3s0, 192.168.1.67#53
de gen. 12 09:45:52 XXX named[1011]: listening on IPv4 interface virbr0, 192.168.122.1#53
de gen. 12 09:45:53 XXX dnsmasq[1243]: failed to create listening socket for 192.168.122.1: Address already in use
de gen. 12 09:45:53 XXX libvirtd[1009]: 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
de gen. 12 09:45:53 XXX named[1011]: no longer listening on 192.168.122.1#53
The named deamon is loaded before, as you can see. There were no issues with that before yesterday's upgrade to 12.9
Normally named and dnsmasq daemons listen on the same port (53), unless they are configured differently, so they will conflict if they are running at the same time.

@gooksin: Do you need the named daemon (from bind9 package) running on your computer ?

@Fontenele: Is the named daemon (from bind9 package) installed in your computer ? Is its error message reported in systemd journal as for gooksin user ?

Hope this helps.
Bind9 package wasn't installed, installed, reboot, same problem. Did nothing about port 53, i know that, after yesterday update, i've got the problem with QEMU/KVM

Re: QEMU/KVM network not starting

Posted: 2025-01-12 17:38
by Fontenele
Hello there,

Searching around, in other forums, with those two commands below, i was able to start QEMU/KVM network:

Code: Select all

sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq
My question now is: With dnsmasq disabled, what other problems i could have with my network and Debian 12 in general?

Thanks in advance for your support.

Fontenele

Re: QEMU/KVM network not starting

Posted: 2025-01-12 17:59
by CwF
Fontenele wrote: 2025-01-12 17:38 With dnsmasq disabled, what other problems i could have with my network and Debian 12 in general?
Unless you'd like to serve up the vms over the network and also have ncat installed, I don't think dnsmasq is required.
Fontenele wrote: 2025-01-12 17:19 Bind9 package wasn't installed, installed, reboot, same problem.
If Bind9 is not needed remove it.

Re: [Solved] QEMU/KVM network not starting

Posted: 2025-01-12 21:05
by Fontenele
Cool for me, thanks you all for your help!

Cheers from Brazil.

Fontenele

Re: QEMU/KVM network not starting

Posted: 2025-01-13 08:19
by gooksin
Hello,

@Aki: Yes, bind9 is needed to serve local zones.

I can confirm now that rebooting has no effect.

Also, using these commands:
Fontenele wrote: 2025-01-12 17:38 Hello there,

Searching around, in other forums, with those two commands below, i was able to start QEMU/KVM network:

Code: Select all

sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq
[...]

Fontenele
doesn't work in my case. Indeed, the dnsmasq service is neither started (since there is a failure at boot) nor enabled:

Code: Select all

(A)> sudo systemctl stop dnsmasq
Failed to stop dnsmasq.service: Unit dnsmasq.service not loaded.
(A)> sudo systemctl disable dnsmasq
Failed to disable unit: Unit file dnsmasq.service does not exist.
This is in fact expected, since the boot error reports that dnsmasq is (unsuccessfully) launched as a child process of libvirtd, not as a service.

When I try to launch one of the virtual machines I, also expectedly, get this error:

Code: Select all

Error starting domain: Requested operation is not valid: network 'default' is not active

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/asyncjob.py", line 108, 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/domain.py", line 1402, in startup
    self._backend.create()
  File "/usr/lib/python3/dist-packages/libvirt.py", line 1373, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Requested operation is not valid: network 'default' is not active
I respectfully suggest that the thread is not flagged as SOLVED.

I will try to find out what changed in libvirtd service, but I would appreciate your help, since I'm not really a developer.

Cheers

Re: QEMU/KVM network not starting

Posted: 2025-01-13 09:34
by Fontenele
I respectfully suggest that the thread is not flagged as SOLVED.

I will try to find out what changed in libvirtd service, but I would appreciate your help, since I'm not really a developer.

Cheers
Sorry, marked as not solved, good luck!

Re: QEMU/KVM network not starting

Posted: 2025-01-13 17:21
by CwF
@gooksin
I don't have any guess at the moment, but it does look like it is a generic network error underneath libvirt -which can be specific to method. I use all hardware networking so never have a ‘default’ network active, no bind9, no ‘br0’, etc.

You could look at the status with 'virsh net-list'.

As I remember, that should list states and modes of all libvirt managed networking, mine is empty since all is hardware managed. Maybe simplify, disassemble, reassemble, in order to find the failure.

I do see reports of dnsmasq issues in version 2.9x, you may try to downgrade the package to confirm if that is the problem. Download the older version, remove current, install older, try again...

Re: QEMU/KVM network not starting

Posted: 2025-01-13 18:49
by gooksin
CwF wrote: 2025-01-13 17:21 @gooksin
I don't have any guess at the moment, but it does look like it is a generic network error underneath libvirt -which can be specific to method. I use all hardware networking so never have a ‘default’ network active, no bind9, no ‘br0’, etc.

You could look at the status with 'virsh net-list'.

As I remember, that should list states and modes of all libvirt managed networking, mine is empty since all is hardware managed. Maybe simplify, disassemble, reassemble, in order to find the failure.
It shows just 'default' (the name could be changed, that's not an issue), which I use for all the VMs

Code: Select all

Name       State   Autostart   Persistent
-------------------------------------------
 default   active   yes          yes
I do see reports of dnsmasq issues in version 2.9x, you may try to downgrade the package to confirm if that is the problem. Download the older version, remove current, install older, try again...
Thank you! I had seen these reports but was reluctant to downgrade dnsmasq-base. After your suggestion, I did downgraded it and that „solves“ the issue and this topic can be labelled SOLVED again.
However, it is a rather unsatisfactory solution, since it will not persists to further upgrades, unless something is corrected in the dnsmasq-base package. I will try to get feedback from the maintainers.

Cheers

Re: QEMU/KVM network not starting

Posted: 2025-01-13 19:09
by CwF
gooksin wrote: 2025-01-13 18:49 I will try to get feedback from the maintainers.
Very good. Please post updates. It is only a work around and not solved. Let's hope the next update works.

I'll be paying attention, but as stated I don't expect to see the issue with my config.

[Solved] Re: QEMU/KVM network not starting

Posted: 2025-01-17 09:11
by gooksin
CwF wrote: 2025-01-13 19:09
gooksin wrote: 2025-01-13 18:49 I will try to get feedback from the maintainers.
Very good. Please post updates. It is only a work around and not solved. Let's hope the next update works.

I'll be paying attention, but as stated I don't expect to see the issue with my config.
Hi,

So I contacted the libvirt and dnsmasq-base developers and got useful answers from Sven Geuer (dnsmasq maintainer) and Lee Garrett (Debian developer).

First, the explanation:
The conflict between bind9 and dnsmasq-base for the use of the virbr0 (or whatever other name) interface had always been there. What changed between dnsmasq-base 2.8.x and 2.9.x was the fact that in the latter, this conflict resulted in a failure. This is, I agreed with the developers, a good thing to do to avoid further problems. Perhaps because my VMs don't access intensively to the internet, I don't recall having had any problem, though.

Now, for the possible solutions, I got these suggestions:
1. Drop bind9 and use dnsmasq globally. According to Sven, dnsmasq can also handle local zones
2. Don't use NAT for the VMs but instead give them access to the internet through a bridge interface
3. Tell bind9 not to listen to the interface (virbr0 in my case) that libvirt creates for dnsmasq-base

Since I wanted to act minimally on my, perhaps not very standard, configuration, I went for 3. It took me a while to figure out how to do that, mainly because my knowledge in these subjects is very limited. But in the end, it was as simple as adding in the named.conf.options file these two lines (they will of course be different in other configurations):

Code: Select all

    listen-on { 127.0.0.1; };
    listen-on { mynet; };
where „mynet“ is a list of subnets I want to allow queries from, defined in a previous acl clause:

Code: Select all

acl mynet {
  192.168.134.0/24;
};
I have marked again the question as solved, since I think we have a general solution.

Cheers

Re: [Solved] Re: QEMU/KVM network not starting

Posted: 2025-01-17 19:45
by Aki
Hello,
gooksin wrote: 2025-01-17 09:11
CwF wrote: 2025-01-13 19:09
gooksin wrote: 2025-01-13 18:49 I will try to get feedback from the maintainers.
Very good. Please post updates. It is only a work around and not solved. Let's hope the next update works.
I'll be paying attention, but as stated I don't expect to see the issue with my config.
[..] I contacted the libvirt and dnsmasq-base developers and got useful answers from Sven Geuer (dnsmasq maintainer) and Lee Garrett (Debian developer).

First, the explanation:
The conflict between bind9 and dnsmasq-base for the use of the virbr0 (or whatever other name) interface had always been there. What changed between dnsmasq-base 2.8.x and 2.9.x was the fact that in the latter, this conflict resulted in a failure. This is, I agreed with the developers, a good thing to do to avoid further problems. Perhaps because my VMs don't access intensively to the internet, I don't recall having had any problem, though.

Now, for the possible solutions, I got these suggestions:
1. Drop bind9 and use dnsmasq globally. According to Sven, dnsmasq can also handle local zones
2. Don't use NAT for the VMs but instead give them access to the internet through a bridge interface
3. Tell bind9 not to listen to the interface (virbr0 in my case) that libvirt creates for dnsmasq-base

Since I wanted to act minimally on my, perhaps not very standard, configuration, I went for 3. It took me a while to figure out how to do that, mainly because my knowledge in these subjects is very limited. But in the end, it was as simple as adding in the named.conf.options file these two lines (they will of course be different in other configurations):

Code: Select all

    listen-on { 127.0.0.1; };
    listen-on { mynet; };
where „mynet“ is a list of subnets I want to allow queries from, defined in a previous acl clause:

Code: Select all

acl mynet {
  192.168.134.0/24;
};
I have marked again the question as solved, since I think we have a general solution.
Cheers
Thanks for reporting back on your further research.

Getting information and confirmation from upstream programmers is always very interesting.

Happy Debian :)

Re: [Solved] QEMU/KVM network not starting

Posted: 2025-01-18 03:06
by ruehlchris
Hi Everyone.

I very much disagree with what happen after update from 12.8 -> 12.9 with a change of how dnsmasq-base works.
My complete VM environment was down for over 4 hours. I cannot and don't like to drop my bind9 central configuration for
the VPN like setup of the Virtual machines!

My network config using forward mode=route with a bridge interface setup by libvirt. Each VM-network has its dedicated DNS on the default gateway
and configured with bind in the Host machine.

To get back online I download the dnsmasq-base-2.8.85 and install it over the 12.9 update.
them use apt-mask hold dnsmasq-base to pin-point it until this drama is solved.

Inline-update:
Just read over the manual from dnsmasq and find there is an option
-p, --port=<port>
Listen on <port> instead of the standard DNS port (53). Setting this to zero completely disables DNS function, leaving only DHCP and/or TFTP.
So in my case it would restore the behavior of 12.8 if the libvirt generated default.conf : "/usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf"
would add a port=0.


Let me know what you think.
-Chris