does not update /etc/resolv.conf (when changed from NetworkManager)

Bug #32134 reported by claes
22
Affects Status Importance Assigned to Milestone
dhcp3 (Ubuntu)
Fix Released
Medium
Martin Pitt
network-manager (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

NetworkManager does not update /etc/resolv.conf. From the nm-applet, I can see the new retrieved IP address and DNS server addresses. But /etc/resolv.conf remains unchanged.

Claes

Revision history for this message
Jonah Bull (jonahbull) wrote :

AFAIK this is not a bug, but the result of a recent Ubuntu patch to network-manager. From the dapper-changes list:

  * 50-disable-named-and-vpn-managers.patch:
     - Remove the dependency on bind9 and all attempts to tinker with
       /etc/resolv.conf. Ubuntu's libc contains resolver patches to ensure
       changes are noticed by running applications; also our dhclient
       configuration handles writing resolv.conf itself and we're not yet
       allowing NetworkManager to manage static interfaces and VPN
       connections.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Network Manager makes no attempt to update /etc/resolv.conf -- it leaves that up to dhclient3.

Please confirm that you DO NOT have the unsupported "resolvconf" package installed.

Attach your /etc/dhcp3/dhclient-script

Also attach listing of the /etc/dhcp3/dhclient-enter-hooks.d directory.

Revision history for this message
Jie Zhang (jzhang918) wrote : /etc/dhcp3/dhclient-script

This is the /etc/dhcp3/dhclient-script in my notebook.

Revision history for this message
Jie Zhang (jzhang918) wrote :

I don't have resolvconf package installed.

My /etc/dhcp3/dhclient-script has been added as an attachment.

There are two files in /etc/dhcp3/dhclient-enter-hooks.d directory:

/etc/dhcp3/dhclient-enter-hooks.d$ cat debug
# $Id: debug-enter,v 1.2 2003/06/18 18:11:21 peloy Exp $
#
# The purpose of this script is just to show the variables that are
# available to all the scripts in this directory. All these scripts
# are called from /etc/dhcp3/dhclient-script, which exports all the
# variables shown before. If you want to debug a problem with your DHCP
# setup you can enable this script and take a look at
# /tmp/dhclient-script.debug.

# To enable this script set the following variable to "yes"
RUN="no"

if [ "$RUN" = "yes" ]; then
        echo `date`: entering dhclient-enter-hooks.d, dumping variables. \
                >> /tmp/dhclient-script.debug

        for i in reason interface medium alias_ip_address new_ip_address \
                new_subnet_mask new_domain_name new_domain_name_servers \
                new_routers new_static_routes old_ip_address old_subnet_mask \
                old_domain_name old_domain_name_servers old_routers \
                old_static_routes; do

                echo $i=\'${!i}\' >> /tmp/dhclient-script.debug
        done

        echo '--------------------------' >> /tmp/dhclient-script.debug
fi

/etc/dhcp3/dhclient-enter-hooks.d$ cat samba
#!/bin/sh

SAMBA_DHCP_CONF=/etc/samba/dhcp.conf

netbios_setup() {
        # No need to continue if we're called with an unsupported option

        if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
           && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] \
           && [ "$reason" != EXPIRE ] && [ "$reason" != FAIL ]
        then
                return
        fi

        # Nor should we continue if no settings have changed
        if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
           && [ "$new_netbios_scope" = "$old_netbios_scope" ]
        then
                return
        fi

        # reparse our own file
        local other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
                s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
                $SAMBA_DHCP_CONF`

        umask 022

        local serverlist="$other_servers"
        for server in $new_netbios_name_servers
        do
                serverlist="$serverlist $interface:$server"
        done

        echo -n > $SAMBA_DHCP_CONF

        # If we're updating on failure/expire, AND there are no WINS
        # servers for other interfaces, leave the file empty.
        if [ -z "$other_servers" ]
        then
                if [ "$reason" = FAIL ] || [ "$reason" = EXPIRE ]
                then
                        return
                fi
        fi

        if [ -n "$serverlist" ]
        then
                echo " wins server =$serverlist" >> $SAMBA_DHCP_CONF
        fi
        if [ -n "$new_netbios_scope" ]
        then
                echo " netbios scope = $new_netbios_scope" >> $SAMBA_DHCP_CONF fi
}

netbios_setup

Revision history for this message
Jie Zhang (jzhang918) wrote :

Forgot to mention, my network-manager and nm-applet both are 0.5.1-0ubuntu14. dhcp3-client is 3.0.3-6ubuntu4.

Revision history for this message
Jie Zhang (jzhang918) wrote :

Some more information. These are the last several lines from /var/log/daemon.log:

Feb 20 21:08:32 localhost NetworkManager: <information>^IOld device 'eth0' activating, won't change.
Feb 20 21:08:33 localhost NetworkManager: <information>^IActivation (eth0) Beginning DHCP transaction.
Feb 20 21:08:33 localhost NetworkManager: <information>^IActivation (eth0) Stage 3 (IP Configure Start) complete.
Feb 20 21:08:33 localhost NetworkManager: <information>^IDHCP daemon state now 12 for interface eth0
Feb 20 21:08:34 localhost NetworkManager: <information>^IDHCP daemon state now 1 for interface eth0
Feb 20 21:08:36 localhost dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Feb 20 21:08:36 localhost dhclient: DHCPACK from 192.168.0.1
Feb 20 21:08:36 localhost dhclient: bound to 192.168.0.124 -- renewal in 235929 seconds.
Feb 20 21:08:36 localhost NetworkManager: <information>^IDHCP daemon state now 4 for interface eth0
Feb 20 21:08:36 localhost NetworkManager: <information>^IActivation (eth0) Stage 4 (IP Configure Get) scheduled...
Feb 20 21:08:36 localhost NetworkManager: <information>^IActivation (eth0) Stage 4 (IP Configure Get) started...
Feb 20 21:08:36 localhost NetworkManager: <WARNING>^I (): get_ip4_string(): error calling 'domain_name', DHCP daemon returned error 'org.freedesktop.DBus.Error.UnknownMethod', message 'Method "domain_name" with signature "" on interface "com.redhat.dhcp.dbus.get" doesn't exist '.
Feb 20 21:08:36 localhost NetworkManager: <information>^IRetrieved the following IP4 configuration from the DHCP daemon:
Feb 20 21:08:36 localhost NetworkManager: <information>^I address 192.168.0.124
Feb 20 21:08:36 localhost NetworkManager: <information>^I netmask 255.255.255.0
Feb 20 21:08:36 localhost NetworkManager: <information>^I broadcast 192.168.0.255
Feb 20 21:08:36 localhost NetworkManager: <information>^I gateway 192.168.0.1
Feb 20 21:08:36 localhost NetworkManager: <information>^I nameserver 202.96.209.5
Feb 20 21:08:36 localhost NetworkManager: <information>^I nameserver 202.96.209.133
Feb 20 21:08:36 localhost NetworkManager: <information>^IActivation (eth0) Stage 5 (IP Configure Commit) scheduled...
Feb 20 21:08:36 localhost NetworkManager: <information>^IActivation (eth0) Stage 4 (IP Configure Get) complete.
Feb 20 21:08:36 localhost NetworkManager: <information>^IActivation (eth0) Stage 5 (IP Configure Commit) started...
Feb 20 21:08:36 localhost NetworkManager: <information>^IYour IP address = 192.168.0.124
Feb 20 21:08:37 localhost NetworkManager: <information>^IActivation (eth0) Finish handler scheduled.
Feb 20 21:08:37 localhost NetworkManager: <information>^IActivation (eth0) Stage 5 (IP Configure Commit) complete.
Feb 20 21:08:37 localhost NetworkManager: <information>^IActivation (eth0) successful, device activated.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

And what does your /etc/resolv.conf look like at this point?

Revision history for this message
Jie Zhang (jzhang918) wrote :

I have no old /etc/resolv.conf at hand, since I run "/etc/init.d/networking restart" to report it. But I remember it contained two or three old DNS server addresses, which was for another LAN. I removed /etc/resolv.conf and rebooted my notebook, /etc/resolv.conf was not created.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Maritn, any idea why /etc/resolv.conf isn't getting written here?

Revision history for this message
fangorious (fangorious-deactivatedaccount) wrote :

I'm having this same problem, with dhcp3-client 3.0.3-6ubuntu4. I'm attaching the files requested above.

Revision history for this message
fangorious (fangorious-deactivatedaccount) wrote : listing of hooks.d folder

listing of hooks.d folder

Revision history for this message
fangorious (fangorious-deactivatedaccount) wrote : dhclient.conf

my dhclient.conf file.

Revision history for this message
fangorious (fangorious-deactivatedaccount) wrote :

Fortunately I can right-click on nm-applet to get Connection Information and write a working resolv.conf by hand.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

It seems that pitti spent a while making sure dhclient did nothing for dhcdbd-controlled interfaces ... will get him to remove this stuff and it should work.

Revision history for this message
Martin Pitt (pitti) wrote :

Well, this dhcdbd patch is ancient, and dates back to the early days of n-m, when Thom made dhcp3 work with that n-m.

I'll remove the patch.

Changed in dhcp3:
assignee: nobody → pitti
status: Unconfirmed → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

 dhcp3 (3.0.3-6ubuntu5) dapper; urgency=low
 .
   * Remove dhclient-dhcdbd-support.dpatch, remove dhcdbd stuff from
     debian/dhclient-script.linux. Nowadays network-manager relies on dhclient
     to rewrite resolv.conf. (Malone #32134)

Changed in dhcp3:
status: Confirmed → Fix Released
Revision history for this message
bhaagensen (bhaagensen) wrote :
Download full text (3.5 KiB)

Hm, are you sure the dhcdb patch was safe to remove. I'm getting an error now which from the n-m list seems to be related to the patch? I've attached output form /var/log/syslog and /var/log/messages

_____________

syslog

Feb 20 22:39:24 localhost dhcdbd: message_handler: message handler not found under /com/redhat/dhcp/eth0 for sub-path eth0.dbus.get.reason
Feb 20 22:39:24 localhost NetworkManager: <information>^IWill activate wired connection 'eth0' because it now has a link.
Feb 20 22:39:24 localhost NetworkManager: <information>^IDevice eth0 activation scheduled...
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) started...
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 1 (Device Prepare) scheduled...
Feb 20 22:39:24 localhost NetworkManager: <information>^IOld device 'eth0' activating, won't change.
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 1 (Device Prepare) started...
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 2 (Device Configure) scheduled...
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 1 (Device Prepare) complete.
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 2 (Device Configure) starting...
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0/wired) Stage 2 (Device Configure) successful.
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 3 (IP Configure Start) scheduled.
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 2 (Device Configure) complete.
Feb 20 22:39:24 localhost NetworkManager: <information>^IActivation (eth0) Stage 3 (IP Configure Start) started...
Feb 20 22:39:24 localhost kernel: [4296008.727000] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
Feb 20 22:39:24 localhost kernel: [4296008.727000] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Feb 20 22:39:25 localhost NetworkManager: <information>^IActivation (eth0) Beginning DHCP transaction.
Feb 20 22:39:25 localhost NetworkManager: <information>^IActivation (eth0) Stage 3 (IP Configure Start) complete.
Feb 20 22:39:25 localhost dhclient: Internet Systems Consortium DHCP Client V3.0.3
Feb 20 22:39:25 localhost dhclient: Copyright 2004-2005 Internet Systems Consortium.
Feb 20 22:39:25 localhost dhclient: All rights reserved.
Feb 20 22:39:25 localhost dhclient: For info, please visit http://www.isc.org/products/DHCP
Feb 20 22:39:25 localhost dhclient: Usage: dhclient [-1dqr] [-nw] [-p <port>] [-s server]
Feb 20 22:39:25 localhost dhclient: [-cf config-file] [-lf lease-file][-pf pid-file] [-e VAR=val]
Feb 20 22:39:25 localhost dhclient: [-sf script-file] [interface]
Feb 20 22:39:25 localhost dhcdbd: Unrequested down ?:3
Feb 20 22:39:25 localhost NetworkManager: <information>^IDHCP daemon state now 12 for interface eth0
Feb 20 22:39:25 localhost NetworkManager: <information>^IDHCP daemon state now 14 for interface eth0
Feb 20 22:39:34 localhost kernel: [4296019.082000] eth0: no IPv6 routers present

---------------------------

messages

Feb 20 22:39...

Read more...

Revision history for this message
bhaagensen (bhaagensen) wrote :

I should perhaps add that I'm running the latest n-m, i.e. dhcp3 (3.0.3-6ubuntu5) and all other updated packages. I've made no changes to the default configuraiton in /etc/dhcp3

Revision history for this message
Jie Zhang (jzhang918) wrote :

I upgraded to the lastest versions. I have the same issue as bhaagensen and find same things in daemon.log.

Revision history for this message
Martin Pitt (pitti) wrote :

See bug #32223, fixing now.

Revision history for this message
fangorious (fangorious-deactivatedaccount) wrote :

Today's update to dhcdbd and dhcp3 fixed this problem for me

Revision history for this message
Jie Zhang (jzhang918) wrote :

It works for me now, too. Thanks!

Revision history for this message
guidol (monk-e) wrote :

Someone forgot to close the network-manager part of this bug.
Closing.

Changed in network-manager:
status: New → Invalid
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.