madwimax stops dhclient non-gracefully, leaving behind invalid nameserver addresses

Bug #994227 reported by Egor
6
Affects Status Importance Assigned to Milestone
madwimax (Ubuntu)
Fix Released
High
Stéphane Graber
Precise
Won't Fix
High
Stéphane Graber
Quantal
Fix Released
High
Stéphane Graber
resolvconf (Ubuntu)
Invalid
Undecided
Unassigned
Precise
Invalid
Undecided
Unassigned
Quantal
Invalid
Undecided
Unassigned

Bug Description

[rationale]
Using madwimax on >= 12.04 causes entries in /etc/resolv.conf to stay around even after disconnecting as dhclient isn't properly killed.

[test case]
1) connect to a wimax network
2) disconnect
3) check that the DNS server isn't in /etc/resolv.conf

[regression potential]
None that I can think of, the fix is a copy/paste from the dhclient3 line which worked.

While resolvconf daemon is running, I cannot use the network, because my resolv.conf file is filled with invalid nameservers soon after connection:

========================== bash session: ==========================
# service resolvconf status
resolvconf start/running
# file /etc/resolv.conf
/etc/resolv.conf: symbolic link to `../run/resolvconf/resolv.conf'
# export LC_ALL=C;\
  date;\
  dhclient wlan0;\
  cat /etc/resolv.conf;\
  date;\
  inotifywait /etc/resolv.conf;\
  date;\
  cat /etc/resolv.conf
Fri May 4 00:50:48 MSK 2012
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd
RTNETLINK answers: File exists
# 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 192.168.129.129
nameserver 8.8.8.8
nameserver 94.25.128.74
Fri May 4 00:50:50 MSK 2012
Setting up watches.
Watches established.
/etc/resolv.conf OPEN
Fri May 4 00:52:44 MSK 2012
# 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 94.25.128.74
nameserver 94.25.208.74

=============================================================================

To clarify servers:
192.168.129.129 is my ISP DNS
8.8.8.8 backup server configured in my router
94.25.128.74… first wimax0 DNS, invalid in my current wlan0 network

# cat /run/resolvconf/interface/wimax0.dhclient
nameserver 94.25.128.74
nameserver 94.25.208.74
# ifconfig wimax0
wimax0: error fetching interface information: Device not found
# ifdown wimax0
ifdown: interface wimax0 not configured

The delay until resolv.conf gets corrupted is not constant at all, sometimes it's as small as 3 seconds. one time is was 13 seconds.
If I reconnect and shut down resolvconf, I get a working network without any problems. This behavior seems to be a regression after apt-get upgrade from ubuntu 11.10 and seems to be a blocker to an ordinary user, since the network is effectively unusable.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: resolvconf 1.63ubuntu12
ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
Uname: Linux 3.2.0-23-generic x86_64
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Thu May 3 23:57:11 2012
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=
 TERM=xterm
 PATH=(custom, user)
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
SourcePackage: resolvconf
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Egor (gluk47) wrote :
description: updated
description: updated
Revision history for this message
Steve Langasek (vorlon) wrote :

Please show the contents of /run/resolvconf/interface/ on the affected system.

Changed in resolvconf (Ubuntu):
status: New → Incomplete
Revision history for this message
Egor (gluk47) wrote :

$ cd /run/resolvconf/interface/
$ ls *
wimax0.dhclient wlan0.dhclient
$ for f in *; do echo "=== $f ==="; cat "$f"; echo; done
=== wimax0.dhclient ===
nameserver 94.25.128.74
nameserver 94.25.208.74

=== wlan0.dhclient ===
nameserver 192.168.129.129
nameserver 8.8.8.8

Actually these servers left from my last wimax connection, I missed that file :(
Mmm… anyway, why are they added to resolv.conf?
I have wimax device plugged out:

$ ifconfig wimax0
wimax0: error fetching interface information: Device not found

Revision history for this message
Egor (gluk47) wrote :

When correct servers disappear from /etc/resolv.conf, the file /run/resolvconf/interface/wlan0.dhclient vanishes too.

Revision history for this message
Steve Langasek (vorlon) wrote :

> Actually these servers left from my last wimax connection, I missed that
> file :(
> Mmm… anyway, why are they added to resolv.conf?

Well, because that's how resolvconf works; when a network interface comes up, and that interface provides nameserver information, it gets added to /etc/resolv.conf. But the question then is, why is it still there if your interface is disconnected? Was the interface brought up using ifupdown, or by some other method? Was there a dhclient process left running for the wimax interface after the interface itself went away?

Revision history for this message
Egor (gluk47) wrote :

I use madwimax to connect that modem, I do not use ifup/ifdown at all. Both ifup and ifdown respond smth like «ignoring unknown device wimax0». When I'm done with my wimax network, I just unplug the modem from the usb port without manual invocation of any command.

There is no dhclient for wimax in the process list.
However there are lots of dhclients for wlan0, I'm surprised:

# ps aux|grep dhcl
root 461 0.0 0.0 7256 672 ? Ss May03 0:00 /sbin/dhclient -v wlan0
root 1037 0.0 0.0 7256 1076 ? Ss 00:25 0:00 dhclient wlan0
root 1917 0.0 0.0 7256 1080 ? Ss 00:26 0:00 dhclient wlan0
root 2896 0.0 0.0 7256 1080 ? Ss 00:28 0:00 dhclient wlan0
root 3125 0.0 0.0 7256 612 ? Ss 09:14 0:00 /sbin/dhclient -v wlan0
root 5662 0.0 0.0 7256 1076 ? Ss 00:31 0:00 /sbin/dhclient -v wlan0
root 5844 0.0 0.0 7256 1076 ? Ss 00:31 0:00 dhclient wlan0
root 6000 0.0 0.0 7256 1076 ? Ss 00:31 0:00 dhclient wlan0
root 8735 0.0 0.0 7256 672 ? Ss Apr29 0:02 /sbin/dhclient -v wlan0
root 9921 0.0 0.0 7256 672 ? Ss Apr29 0:02 /sbin/dhclient -v wlan0
root 10393 0.0 0.0 7256 660 ? Ss Apr29 0:02 /sbin/dhclient -v wlan0
root 12605 0.0 0.0 9344 928 pts/8 S+ 11:02 0:00 grep --color=auto dhcl
root 13280 0.0 0.0 7256 616 ? Ss 09:26 0:00 dhclient wlan0
root 14263 0.0 0.0 7256 1076 ? Ss 00:43 0:00 dhclient wlan0
root 17101 0.0 0.0 7256 1076 ? Ss May03 0:00 /sbin/dhclient -v wlan0
root 17651 0.0 0.0 7256 1080 ? Ss May03 0:00 dhclient wlan0
root 23960 0.0 0.0 7256 1080 ? Ss 00:13 0:00 /sbin/dhclient -v wlan0
root 24726 0.0 0.0 7256 1072 ? Ss 00:58 0:00 /sbin/dhclient -v wlan0
root 25175 0.0 0.0 7256 1080 ? Ss 00:58 0:00 dhclient wlan0
root 26028 0.0 0.0 7256 1080 ? Ss 00:15 0:00 dhclient wlan0
root 27123 0.0 0.0 7256 276 ? Ss Apr30 0:02 /sbin/dhclient -v wlan0
root 30309 0.0 0.0 7256 1072 ? Ss 07:37 0:00 /sbin/dhclient -v wlan0
root 32204 0.0 0.0 7256 1080 ? Ss 00:24 0:00 dhclient wlan0

And again now wlan0.dhclient has disappeared, while wimax0.dhclient is present…

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

> When I'm done with my wimax network, I just unplug the modem from the usb port without manual invocation of any command.

The dhclient process for your wimax interface adds nameserver addresses to the system (via resolvconf) that are accessible over the wimax interface. When the wimax interface is disabled, those nameserver addresses should be removed. If dhclient doesn't do this automatically you may have to help it by stopping the process gracefully. See dhclient(8), especially the part about the -r and -x options.

What's mysterious about the behavior your originally reported is (IIUC) that the dhclient process for wlan0 adds nameserver addresses and then removes them a few seconds later. Have you figured out why this happens?

Revision history for this message
Steve Langasek (vorlon) wrote : Re: resolvconf breaks name resolution when using madwimax

Sounds like this is probably an issue with madwimax not integrating with resolvconf or not handling dhclient correctly on disconnect.

Changed in madwimax (Ubuntu):
importance: Undecided → High
summary: - resolvconf breaks name resolution
+ resolvconf breaks name resolution when using madwimax
Revision history for this message
Egor (gluk47) wrote :

Okay… now I rebooted, and resolvconf with wlan0 works fine. When I'm at the area with wimax, I'll test madwimax again.

I didn't find out, why did wlan0.dhclient disappear, after reboot this error has gone. May be it was some conflict of these many dhclients somehow launched at the same time…

Thomas Hood (jdthood)
summary: - resolvconf breaks name resolution when using madwimax
+ Nameserver list incorrect when using madwimax and resolvconf
Revision history for this message
Egor (gluk47) wrote : Re: Nameserver list incorrect when using madwimax and resolvconf

The file wlan0.dhclient now does not disappear.Seems, that annoying bug does not affect me anymore.

Anyway, I have the file wimax0.dhclient still existing, even though my wimax modem is plugged off with no dhclient left for wimax0, and no madwimax process running:

$ ps aux | egrep '(dhcl|wimax)'
root 5236 0.0 0.0 7256 608 ? Ss 20:02 0:00 /sbin/dhclient -v wlan0
gluk47 12679 0.0 0.0 9336 924 pts/3 S+ 20:14 0:00 egrep --color=auto (dhcl|wimax)
$ cd /run/resolvconf/interface
$ ls *.dhclient
wimax0.dhclient wlan0.dhclient

Seems, it's really madwimax problem, it should tell dhclient to remove this file when it's no longer needed.

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

Egor: Thanks for the additional information.

The culprit is /etc/madwimax/event.sh which doesn't stop dhclient gracefully. Here's a snippet showing the handling of dhclient3 and dhclient (version 4).

[...]
if-up)
        if [ -x /sbin/dhclient3 ]; then
                /sbin/dhclient3 -nw -pf /var/run/dhclient."$2".pid -lf /var/lib/dhcp3/dhclient."$2".leases "$2" >/dev/null 2>&1
        elif [ -x /sbin/dhclient ]; then
                /sbin/dhclient -pf /var/run/dhclient."$2".pid -lf /var/lib/dhcp/dhclient."$2".leases "$2"
[...]
if-down)
        if [ -x /sbin/dhclient3 ]; then
                /sbin/dhclient3 -r -pf /var/run/dhclient."$2".pid -lf /var/lib/dhcp3/dhclient."$2".leases "$2" >/dev/null 2>&1
        elif [ -x /sbin/dhclient ]; then
                kill -TERM $(cat /var/run/dhclient."$2".pid)

On the last line, not "kill", but "dhclient -r" should be used, as in the /sbin/dhclient3 case.

affects: resolvconf (Ubuntu) → ubuntu
affects: ubuntu → resolvconf (Ubuntu)
summary: - Nameserver list incorrect when using madwimax and resolvconf
+ madwimax stops dhclient non-gracefully, leaving behind invalid
+ nameserver addresses
Steve Langasek (vorlon)
Changed in madwimax (Ubuntu):
status: New → Triaged
Changed in resolvconf (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Steve Langasek (vorlon) wrote :

Stéphane, do you mind following through on this?

Changed in madwimax (Ubuntu):
assignee: nobody → Stéphane Graber (stgraber)
Changed in madwimax (Ubuntu Precise):
assignee: nobody → Stéphane Graber (stgraber)
importance: Undecided → High
status: New → Triaged
tags: added: rls-q-incoming
Steve Langasek (vorlon)
tags: added: rls-q-notfixing
removed: rls-q-incoming
Revision history for this message
Stéphane Graber (stgraber) wrote :

Uploaded a (untested) fix to precise and quantal replacing the kill call by a dhclient -r call similar to dhclient3.

Changed in madwimax (Ubuntu Precise):
status: Triaged → In Progress
Changed in madwimax (Ubuntu Quantal):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package madwimax - 0.1.1-1ubuntu2

---------------
madwimax (0.1.1-1ubuntu2) quantal; urgency=low

  * Properly stop dhclient instead of killing it, this should fix inconsistency
    issues with resolvconf. (LP: #994227)
 -- Stephane Graber <email address hidden> Mon, 01 Oct 2012 15:40:21 -0400

Changed in madwimax (Ubuntu Quantal):
status: In Progress → Fix Released
Revision history for this message
Scott Kitterman (kitterman) wrote :

Needs test case, etc for SRU.

Changed in madwimax (Ubuntu Precise):
status: In Progress → Incomplete
Revision history for this message
Stéphane Graber (stgraber) wrote :

Oops, for some reason I had marked that bug as ready to upload on my side even though I forgot to update the description...
fixed.

description: updated
Changed in resolvconf (Ubuntu Precise):
status: New → Invalid
Changed in madwimax (Ubuntu Precise):
status: Incomplete → In Progress
Revision history for this message
Scott Kitterman (kitterman) wrote : Please test proposed package

Hello Egor, or anyone else affected,

Accepted madwimax into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/madwimax/0.1.1-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in madwimax (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote : Verification still needed

The fix for this bug has been awaiting testing feedback in the -proposed repository for precise for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Revision history for this message
Egor (gluk47) wrote :

It's a pity: wimax has been shut down in my city, now I have neither device, nor environment to test the fix. Home, someone else could test the fix.

Revision history for this message
Brian Murray (brian-murray) wrote :

The version of madwimax in precise-proposed has been removed as the bugs it was fixing (including this one) were not verified in a timely fashion.

tags: removed: verification-needed
tags: removed: removal-candidate
Changed in madwimax (Ubuntu Precise):
status: Fix Committed → Triaged
Revision history for this message
Stéphane Graber (stgraber) wrote :

Moving to won't fix as apparently nobody cares.

Changed in madwimax (Ubuntu Precise):
status: Triaged → Won't Fix
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.