> Out of curiosity, what is the contents of your /etc/dnsmasq.d
directory? Is there a symlink in there to
/etc/dnsmasq.d-available/libvirt-daemon? What is the contents of that
file?

$ ls -l  /etc/dnsmasq.d 
total 0
lrwxrwxrwx 1 root root 39 Aug 29  2020 libvirt-daemon -> 
/etc/dnsmasq.d-available/libvirt-daemon
$ cat /etc/dnsmasq.d-available/libvirt-daemon
bind-interfaces
except-interface=virbr0
$ 


> Do you know what else could be listening on that interface? What's the output 
> of "sudo netstat --tcp --udp --listening --programs --numeric"?

$ sudo netstat --tcp --udp --listening --programs --numeric 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
PID/Program name    
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 192.168.0.2:53          0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      
979/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      
1308/sshd: /usr/sbi 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      
995/cupsd           
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      
1078/named          
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      
2530/sshd: miyakz@p 
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      
2758/sshd: miyakz@p 
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:53                  :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 240f:3c:649e:1:b62e::53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 fe80::b62e:99ff:fe91:53 :::*                    LISTEN      
1078/named          
tcp6       0      0 :::22                   :::*                    LISTEN      
1308/sshd: /usr/sbi 
tcp6       0      0 ::1:631                 :::*                    LISTEN      
995/cupsd           
tcp6       0      0 ::1:953                 :::*                    LISTEN      
1078/named          
tcp6       0      0 ::1:6010                :::*                    LISTEN      
2530/sshd: miyakz@p 
tcp6       0      0 ::1:6011                :::*                    LISTEN      
2758/sshd: miyakz@p 
udp        0      0 0.0.0.0:48454           0.0.0.0:*                           
994/avahi-daemon: r 
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 192.168.0.2:53          0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.1:53            0.0.0.0:*                           
1078/named          
udp        0      0 127.0.0.53:53           0.0.0.0:*                           
979/systemd-resolve 
udp        0      0 0.0.0.0:631             0.0.0.0:*                           
1074/cups-browsed   
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           
994/avahi-daemon: r 
udp6       0      0 :::60066                :::*                                
994/avahi-daemon: r 
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 ::1:53                  :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 240f:3c:649e:1:b62e::53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe91:53 :::*                                
1078/named          
udp6       0      0 fe80::b62e:99ff:fe9:546 :::*                                
976/systemd-network 
udp6       0      0 :::5353                 :::*                                
994/avahi-daemon: r 
$ 

In this situation, I got

$ 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,

$ sudo netstat --tcp --udp --listening --programs --numeric  | grep 192.168.122
$

grep was not hit any string.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/2055776

Title:
  After updating ubuntu, the network to which the subnet address is
  assigned does not become active in KVM.

Status in dnsmasq package in Ubuntu:
  New

Bug description:
  phenomenon:
    After updating ubuntu, the network to which the subnet address is assigned 
does not become active in KVM.

  Cause:
    This is because the following dnsmasq update operation performed by apt's 
automatic update causes an error. It worked properly with dnsmasq 2.80, but 
does not work properly with 2.90.

  $ cat /var/log/apt/history.log
  (snip)
  Start-Date: 2024-02-27  06:17:31
  Commandline: /usr/bin/unattended-upgrade
  Upgrade: dnsmasq-base:amd64 (2.80-1.1ubuntu1.7, 2.90-0ubuntu0.20.04.1)
  End-Date: 2024-02-27  06:17:44
  (snip)
  $

  Cause details:
    As a premise, bind-dynamic is set in the dnsmasq config file for KVM. Below 
is an example.

  $ cat default.conf 
  ##WARNING:  THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
  ##OVERWRITTEN AND LOST.  Changes to this configuration should be made using:
  ##    virsh net-edit default
  ## or other application using the libvirt API.
  ##
  ## dnsmasq conf file created by libvirt
  strict-order
  user=libvirt-dnsmasq
  pid-file=/run/libvirt/network/default.pid
  except-interface=lo
  bind-dynamic
  interface=virbr0
  dhcp-range=192.168.122.2,192.168.122.254,255.255.255.0
  dhcp-no-override
  dhcp-authoritative
  dhcp-lease-max=253
  dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
  addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
  $ 

  
  When starting the network with KVM (virsh net-start), dnsmasq started from 
KVM executes the make_sock function twice as shown below.

     $ cat network.c
     (snip)
     1087 static struct listener *create_listeners(union mysockaddr *addr, int 
do_
     1087 tftp, int dienow)
     1088 {
     1089   struct listener *l = NULL;
     1090   int fd = -1, tcpfd = -1, tftpfd = -1;
     1091 
     1092   (void)do_tftp;
     1093 
     1094   if (daemon->port != 0)
     1095     {
     1096       fd = make_sock(addr, SOCK_DGRAM, dienow);
     1097       tcpfd = make_sock(addr, SOCK_STREAM, dienow);
     1098     }
     (snip)

  The following code causes an issue with the update made in dnsmasq
  2.90.

     $ cat network.c
     (snip)
      895 static int make_sock(union mysockaddr *addr, int type, int dienow)
      896 {
      (snip)
      934       if (!option_bool(OPT_CLEVERBIND) || errno != EADDRNOTAVAIL)
      935         {
      936           if (dienow)
      937             die(s, daemon->addrbuff, EC_BADNET);
      938           else
      939             my_syslog(LOG_WARNING, s, daemon->addrbuff, 
strerror(errno))    939 ;
      940         }
      (snip)

  
  function "make_sock" in network.c:1096 binds the socket to 192.168.122.1/24, 
and then make_sock in network.c:1097 tries to bind to the same address. 
However, in network.c:934, when errno==98 occurs, network.c:937 is executed, so 
dnsmasq does not cause a startup error. As a result, virsh net-start fails.

  As a temporary workaround, it will work if you try not to die.

  $ diff -u  network_c_back  network.c 
  --- network_c_back  2024-02-29 15:36:05.156467935 +0000
  +++ network.c 2024-02-29 15:36:38.733324350 +0000
  @@ -934,7 +934,8 @@
         if (!option_bool(OPT_CLEVERBIND) || errno != EADDRNOTAVAIL)
    {
      if (dienow)
  -     die(s, daemon->addrbuff, EC_BADNET);
  +     my_syslog(LOG_WARNING, s, daemon->addrbuff, strerror(errno));
  +     //die(s, daemon->addrbuff, EC_BADNET);
      else
        my_syslog(LOG_WARNING, s, daemon->addrbuff, strerror(errno));
    }
  $ 

  If bind-dynamic is set, it should be modified so that it works even if
  errno==98.

  For reference, in the case of dnsmasq 2.80, the code is as follows, so
  no error occurs.

      network.c
      699 static int make_sock(union mysockaddr *addr, int type, int dienow)
      700 {
      701   int family = addr->sa.sa_family;
      702   int fd, rc, opt = 1;
      (snip)
          715     err:
      716       errsave = errno;
      717       port = prettyprint_addr(addr, daemon->addrbuff);
      718       if (!option_bool(OPT_NOWILD) && !option_bool(OPT_CLEVERBIND))
      719         sprintf(daemon->addrbuff, "port %d", port);
      720       s = _("failed to create listening socket for %s: %s");
      721       
      722       if (fd != -1)
      723         close (fd);
      724         
      725       errno = errsave;
      726 
      727       if (dienow)
      728         {
      729           /* failure to bind addresses given by --listen-address at 
this
      729  point
      730              is OK if we're doing bind-dynamic */
      731           if (!option_bool(OPT_CLEVERBIND))
      732             die(s, daemon->addrbuff, EC_BADNET);
      733         }
      734       else
      735         my_syslog(LOG_WARNING, s, daemon->addrbuff, strerror(errno));
      736       
      737       return -1;
      738     }  

  If bind-dynamic is set (option_bool(OPT_CLEVERBIND)==true), it will
  not die.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/2055776/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to