Public bug reported:

The first time that dnsmasq is started, DNS resolution is broken for a
few seconds. You can see this on initial installation:

root@phil-test-1:~# apt-get install dnsmasq ; dig github.com
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  dnsmasq
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/15.1 kB of archives.
After this operation, 111 kB of additional disk space will be used.
Selecting previously unselected package dnsmasq.
(Reading database ... 92556 files and directories currently installed.)
Unpacking dnsmasq (from .../dnsmasq_2.59-4ubuntu0.1_all.deb) ...
Processing triggers for ureadahead ...
Setting up dnsmasq (2.59-4ubuntu0.1) ...
 * Starting DNS forwarder and DHCP server dnsmasq                               
                                                                                
                                     [ OK ]

; <<>> DiG 9.8.1-P1 <<>> github.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 56221
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;github.com.                    IN      A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov  4 11:29:16 2013
;; MSG SIZE  rcvd: 28


Or you can recreate the problem on an existing installation by removing 
/var/run/dnsmasq/resolv.conf:

root@phil-test-1:~# service dnsmasq stop
 * Stopping DNS forwarder and DHCP server dnsmasq                               
                                                                                
                                     [ OK ]
root@phil-test-1:~# rm /var/run/dnsmasq/resolv.conf
root@phil-test-1:~# service dnsmasq start; dig github.com
 * Starting DNS forwarder and DHCP server dnsmasq                               
                                                                                
                                     [ OK ]

; <<>> DiG 9.8.1-P1 <<>> github.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 10196
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;github.com.                    IN      A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Nov  4 11:31:21 2013
;; MSG SIZE  rcvd: 28


The REFUSED status line shows that dns resolution has failed in both
cases. I expect that if `apt-get install dnsmasq` or `service dnsmasq
start` has returned successfully, and resolvconf has had dnsmasq
registered as the sole resolver for lo.dnsmasq, then dnsmasq is ready to
respond to DNS requests. Therefore, the REFUSED response from dig is the
opposite of what I expect to happen.

In both cases, resolution works again after a few seconds, once
resolvconf generates the /var/run/dnsmasq/resolv.conf file and dnsmasq
polls for and finds it.

Even though the window is short (syslog reports ~ 4 seconds of
unavailability), this causes me pain because I am doing a lot of
automated installations using puppet; immediately after installing
dnsmasq, any other package installations or apt-get update runs fail.


I believe the problem is that the init.d script assumes that 
/var/run/dnsmasq/resolv.conf is already in place, but it may not be because 
nothing has caused resolvconf to refresh itself since 
/etc/resolvconf/update.d/dnsmasq was put in place. One solution would be to get 
the init.d script to run resolvconf -u if it decided to use 
/var/run/dnsmasq/resolv.conf. I am happy to submit a patch based on this.

This was on Ubuntu 12.04.3 LTS, using dnsmasq 2.59-4ubuntu0.1

** Affects: dnsmasq (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/1247803

Title:
  dnsmasq temporarily breaks DNS resolution when starting for the first
  time

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

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to