Comment 2 for bug 733914

Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [Bug 733914] [NEW] autofs races network interfaces, ends up not working

I've been thinking a lot about how to handle bugs like these, which seem
very common.

The issue seems to be that there is no event one can point to as "all
configured networking has finished coming up".

Or, is there. "started networking" means ifup -a has returned. From
that, we can imply that all interfaces in /etc/network/interfaces with
an 'auto' stanza have been configured in some way. For dhcp, it means
dhclient has been spawned. For static, it means the configuration is
done.

So this would imply most cases of

net-device-up IFACE!=lo

Can be replaced with

started networking

However, this ignores that dhcp and network-manager owned interfaces
will be missed in this case. Also, there's conceivably situations where
a pre or post script in the ifup configuration blocks and waits for
other things to start. I think this is better handled in the ifup script
hooks though... this seems rather backwards and maybe should be well
documented as a Bad Idea.

There's also a suggestion to use IP_FREEBIND. This is a linux specific
sockopt that makes binding on a socket not care if the IP isn'g actually
available on that socket. Once the IP is available, great, it will be
responded on, but otherwise this is just a dead listening daemon. We
would have to patch a lot of daemons to rely on this.

I think whats needed first is the network-services abstraction I
proposed in bug #701576 . This will allow us to solve this problem in
one place, rather than in the 10 or 15+ (and growing) packages that
define their own start on criteria.

Once thats done, I'd suggest that we make it clear what sorts of
configurations are supported as default, and make sure that works no
matter what. In the case of autofs, changing it to 'started networking'
will at least provide guarantees that it won't start until all static
interfaces have been configured. However it also means if something
in /etc/network/if-*.d depends on files located on autofs managed
mounts, the boot may stall in a circular dependency loop where autofs
cannot start because networking has not started, and networking is
waiting on autofs to start to finish. Other than a timeout, I cannot see
a good way to guard against that danger.

On Sat, 2011-03-12 at 17:03 +0000, Launchpad Bug Tracker wrote:
> Kees Cook (kees) has assigned this bug to you for autofs5 in Ubuntu Natty:
>
> Binary package hint: autofs5
>
> When autofs starts, the network may not be up yet. "started net-device-
> up IFACE!=lo" does not handle multi-homed machines, bridging, etc.
> autofs needs to wait until all configured networking has finished coming
> up before starting.
>
> ProblemType: Bug
> DistroRelease: Ubuntu 11.04
> Package: autofs5 5.0.5-0ubuntu4
> ProcVersionSignature: Ubuntu 2.6.38-6.34-generic 2.6.38-rc7
> Uname: Linux 2.6.38-6-generic x86_64
> Architecture: amd64
> Date: Sat Mar 12 08:58:22 2011
> ProcEnviron:
> LANGUAGE=en_US:en
> PATH=(custom, user)
> LANG=en_US.UTF-8
> SHELL=/bin/bash
> SourcePackage: autofs5
> UpgradeStatus: Upgraded to natty on 2006-11-27 (1565 days ago)
>
> ** Affects: autofs5 (Ubuntu)
> Importance: Undecided
> Assignee: Canonical Server Team (canonical-server)
> Status: New
>
> ** Affects: autofs5 (Ubuntu Natty)
> Importance: Undecided
> Assignee: Canonical Server Team (canonical-server)
> Status: New
>
>
> ** Tags: amd64 apport-bug natty regression-release