resolvconf doesn't create the correct /etc/resolv.conf file when static IP addresses are used

Bug #1575644 reported by msp3k
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dnsmasq (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

By default, when installing ubuntu-desktop (and when installing some other packages as well), apt will also install dnsmasq as a dependency. When dnsmasq is installed, and static IP addresses are used, resolv.conf creates a nearly empty /etc/resolv.conf file. The file only contains entries for localhost and the search domain. If static IP addresses are defined in /etc/network/interfaces, then shouldn't those DNS servers should be included in /etc/resolv.conf regardless of the presence of dnsmasq?

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: resolvconf 1.78ubuntu2
ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
Uname: Linux 4.4.0-21-generic x86_64
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
Date: Wed Apr 27 08:34:24 2016
InstallationDate: Installed on 2016-04-26 (0 days ago)
InstallationMedia: Ubuntu-Server 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.3)
PackageArchitecture: all
SourcePackage: resolvconf
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
msp3k (peek-nimbios) wrote :
Revision history for this message
Thomas Hood (jdthood) wrote :

Not dnsmasq but dnsmasq-base is pulled in by ubuntu-desktop.

If you define your interfaces statically using /etc/network/interfaces then you have to add the nameserver information to /etc/network/interfaces on lines like "dns-nameserver 1.2.3.4". See resolvconf(8) for more info.

Changed in resolvconf (Ubuntu):
status: New → Incomplete
Revision history for this message
msp3k (peek-nimbios) wrote : Re: [Bug 1575644] Re: resolvconf doesn't create the correct /etc/resolv.conf file when static IP addresses are used

They are specified in /etc/network/interfaces just as you instructed,
and the dnsmasq-base package is installed. But when dnsmasq is
installed then resolvconf generates an incorrect /etc/resolv.conf. If I
remove the dnsmasq package then resolvconf works properly and generates
the expected contents for /etc/resolv.conf.

This is a new bug with 16.04. It was not present under 14.04, and the
contents of my /etc/network/interfaces file has not changed.

Michael

On 04/27/2016 12:06 PM, Thomas Hood wrote:
> Not dnsmasq but dnsmasq-base is pulled in by ubuntu-desktop.
>
> If you define your interfaces statically using /etc/network/interfaces
> then you have to add the nameserver information
> /etc/network/interfaces on lines like "dns-nameserver 1.2.3.4". See
> resolvconf(8) for more info.
>
> ** Changed in: resolvconf (Ubuntu)
> Status: New => Incomplete
>

Revision history for this message
Thomas Hood (jdthood) wrote :

If you install the dnsmasq package then that package starts a standalone instance of the dnsmasq program and resolv.conf will contain a line `nameserver 127.0.0.1` which tells the resolver to consult that instance of the dnsmasq program, which will by default forward DNS queries to the nameservers which would otherwise have been directly consulted by the resolver.

The answer to the question "shouldn't those DNS servers should be included in /etc/resolv.conf regardless of the presence of dnsmasq?" is "no". Resolvconf doesn't list any nameserver addresses after any loopback address, unless TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS=no in /etc/default/resolvconf.

When dnsmasq is installed does DNS function correctly? If so then there is no problem.

Revision history for this message
msp3k (peek-nimbios) wrote :
Download full text (4.3 KiB)

Maybe I'm just confused about how resolvconf and dnsmasq should work,
but here's how it's working on my new 16.04 system:

root@ecoli:~# dpkg -l | grep dnsmasq
ii dnsmasq 2.75-1 all
Small caching DNS proxy and DHCP/TFTP server
ii dnsmasq-base 2.75-1 amd64
Small caching DNS proxy and DHCP/TFTP server

root@ecoli:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s10
iface enp0s10 inet static
     address 160.36.130.174
     netmask 255.255.255.0
     network 160.36.130.0
     broadcast 160.36.130.255
     gateway 160.36.130.1
     # dns-* options are implemented by the resolvconf package, if installed
     dns-nameservers 160.36.0.66 160.36.128.66 8.8.8.8
     dns-search nimbios.org

root@ecoli:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search nimbios.org

root@ecoli:~# dpkg --purge dnsmasq
(Reading database ... 429253 files and directories currently installed.)
Removing dnsmasq (2.75-1) ...
Purging configuration files for dnsmasq (2.75-1) ...

root@ecoli:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 160.36.0.66
nameserver 160.36.128.66
nameserver 8.8.8.8
search nimbios.org

root@ecoli:~# dpkg -l | grep dnsmasq
ii dnsmasq-base 2.75-1 amd64
Small caching DNS proxy and DHCP/TFTP server

root@ecoli:~# apt-get install dnsmasq
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 0 not upgraded.
Need to get 0 B/16.0 kB of archives.
After this operation, 71.7 kB of additional disk space will be used.
Selecting previously unselected package dnsmasq.
(Reading database ... 429242 files and directories currently installed.)
Preparing to unpack .../dnsmasq_2.75-1_all.deb ...
Unpacking dnsmasq (2.75-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Setting up dnsmasq (2.75-1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...

root@ecoli:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by
resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search nimbios.org

root@ecoli:~# dpkg -l | grep dnsmasq
ii dnsmasq 2.75-1 all
Small caching DNS proxy and DHCP/TFTP server
ii dnsmasq-base 2.75-1 amd64
Small caching DNS proxy and DHCP/TFTP server

root@ec...

Read more...

Thomas Hood (jdthood)
description: updated
Revision history for this message
Thomas Hood (jdthood) wrote :

Everything looks correct. Does name service work both when dnsmasq is installed and when it is not installed? If so then there is no problem.

Revision history for this message
msp3k (peek-nimbios) wrote :

Ah, I understand now. Sorry.

Michael

On 04/27/2016 12:42 PM, Thomas Hood wrote:
> The answer to the question "shouldn't those DNS servers should be
> included in /etc/resolv.conf regardless of the presence of dnsmasq?" is
> "no". Resolvconf doesn't list any nameserver addresses after any
> loopback address, unless
> TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS=no in
> /etc/default/resolvconf.
>

Revision history for this message
msp3k (peek-nimbios) wrote :

No, it does not work when dnsmasq is installed. At least, not
reliably. I discovered this when apache2 started ignoring the
configuration for my virtual hosts because it couldn't resolve the
virtual host names. I could reach some hosts, like archive.ubuntu.com
for instance whenever I did an apt-get update, or I would have noticed
it right away.

Michael

On 04/27/2016 01:59 PM, Thomas Hood wrote:
> Everything looks correct. Does name service work both when dnsmasq is
> installed and when it is not installed? If so then there is no problem.
>

Revision history for this message
Thomas Hood (jdthood) wrote :

That name service does not work properly when dnsmasq is installed is most probably due to bug #1003842. If that is the case then if you remove 8.8.8.8 from the list of nameserver addresses then name service will work reliably.

Revision history for this message
msp3k (peek-nimbios) wrote :

I'll give it a go and see if any problems occur. Thanks for your help!

Michael

On 04/27/2016 03:21 PM, Thomas Hood wrote:
> That name service does not work properly when dnsmasq is installed is
> most probably due to bug #1003842. If that is the case then if you
> remove 8.8.8.8 from the list of nameserver addresses then name service
> will work reliably.
>

Thomas Hood (jdthood)
affects: resolvconf (Ubuntu) → dnsmasq (Ubuntu)
Revision history for this message
Thomas Hood (jdthood) wrote :

What remains unexplained is why the dnsmasq package was installed on your machine at all. Is it the case that dnsmasq was not installed before the upgrade and it was installed after the upgrade? In that case, please file a new bug report describing that particular misbehavior.

Revision history for this message
msp3k (peek-nimbios) wrote :

I reformatted over 14.04 and installed 16.04 as a fresh start. I use a
slightly customized server install ISO image that includes my own
preseed file for automation. My approach is to start with a bare-bones
server install on all machines and then install extra packages based on
the machine's function (ubuntu-desktop on workstations, for instance).
According to my installation logs, dnsmasq was installed during an
"apt-get install ubuntu-desktop unity-tweak-tool" on a workstation
(which of those two packages actually resulted in a dependency on
dnsmasq I don't know), and on a server it was installed during an
"apt-get install polipo".

Michael

On 04/28/2016 06:01 AM, Thomas Hood wrote:
> *** This bug is a duplicate of bug 1003842 ***
> https://bugs.launchpad.net/bugs/1003842
>
> What remains unexplained is why the dnsmasq package was installed on
> your machine at all. Is it the case that dnsmasq was not installed
> before the upgrade and it was installed after the upgrade? In that case,
> please file a new bug report describing that particular misbehavior.
>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.