[Bug 838968] Re: static-network-up event does not wait for interfaces to have an address
Steve Langasek
steve.langasek at canonical.com
Thu Sep 1 20:17:51 UTC 2011
Discussed on IRC, the problem here is that ifupdown invokes dhclient in
a way that it still exits with success when it has *failed* to acquire
an IP address, causing ifupdown to emit the interface-up event.
Passing -1 to dhclient3 gives the correct behavior: daemonize when an
address is acquired, and if the timeout is reached without acquiring an
address, exit non-zero instead of daemonizing.
There's a question of whether we should also raise the timeout in
dhclient to accomodate systems like the one where this was first
encountered, where 60 seconds isn't long enough to get the interface up
and get an address via dhcp; but at least the ifupdown change is a per-
se-correct one-line fix.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/838968
Title:
static-network-up event does not wait for interfaces to have an
address
Status in “ifupdown” package in Ubuntu:
New
Bug description:
cloud-init's /etc/init/cloud-init-nonet.conf is configured to block
running of cloud-init.conf until "static-network-up" is emitted.
The point of that event was to wait until interfaces were all
configured, and thus the network available.
In practice, what I'm seeing is that for dhcp interfaces configured like:
# The primary network interface
auto eth0
iface eth0 inet dhcp
ifupdown runs /etc/network/if-up.d/upstart immediately upon forking
off dhclient.
$ ls -ld --full-time /var/run/network/static-network-up-emitted
drwxr-xr-x 2 root root 40 2011-09-01 12:21:26.778833999 -0400 /var/run/network/static-network-up-emitted
Then, in /var/log/syslog, the first non-kernel messages for this boot start at 12:21:28. relevant dhcp messages are:
Sep 1 12:21:29 mabolo dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
Sep 1 12:21:30 mabolo kernel: [ 10.885045] bnx2 0000:02:00.0: eth0: NIC Copper Link is Up, 1000 Mbps full duplex
Sep 1 12:21:30 mabolo kernel: [ 10.886232] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sep 1 12:21:36 mabolo dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
...
Sep 1 12:22:13 mabolo dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
Sep 1 12:22:13 mabolo dhclient: DHCPOFFER of 10.55.55.5 from 10.55.55.7
Sep 1 12:22:13 mabolo dhclient: DHCPREQUEST of 10.55.55.5 on eth0 to 255.255.255.255 port 67
Sep 1 12:22:14 mabolo dhclient: DHCPACK of 10.55.55.5 from 10.55.55.7
Sep 1 12:22:14 mabolo dhclient: can't create /var/lib/dhcp3/dhclient.eth0.leases: No such file or directory
Sep 1 12:22:14 mabolo dhclient: bound to 10.55.55.5 -- renewal in 1399 seconds.
So it would surely appear that the event is happening immediately.
However, to test this theory, I put the following into /etc/network/if-up.d/myfootest, and set up 'eth1' in /etc/network/interfaces.. (I knew that there would be no response on eth1's interface.)
#!/bin/sh
(
echo "===== $(date -R) ====="
echo "IFACE=$IFACE LOGICAL=$LOGICAL ADDRFAM=$ADDRFAM METHOD=$METHOD MODE=$MODE PHASE=$PHASE"
ifconfig $IFACE
) | tee -a /var/log/myfoo.log
exit 0
Then, i ran 'sudo ifup eth1' and that took almost exactly 1 minute before writing the log and to the screen. One difference between the two is that eth1 is not attached to a device per ethtool.
ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: ifupdown 0.7~alpha5.1ubuntu3
ProcVersionSignature: User Name 3.0.0-9.15-virtual 3.0.3
Uname: Linux 3.0.0-9-virtual i686
Architecture: i386
Date: Thu Sep 1 17:02:21 2011
Ec2AMI: ami-00000070
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.small
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
ProcEnviron:
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: ifupdown
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/838968/+subscriptions
More information about the foundations-bugs
mailing list