Comment 0 for bug 838968

Revision history for this message
Scott Moser (smoser) wrote :

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)