Thursday, 15 February 2018

Re: autopkgtest-build-lxd failing with bionic

On Thu, Feb 15, 2018 at 2:00 PM, Steve Langasek <> wrote:
On Thu, Feb 15, 2018 at 06:48:31PM +0000, Iain Lane wrote:
> [ autopkgtest-devel, this is
>   and thread FYI - Reply-To / Mail-Followup-To set to exclude
>   ubuntu-devel from this subthread so reviews go to the right place ]

> On Thu, Feb 15, 2018 at 10:28:05AM -0500, St├ęphane Graber wrote:
> > […]
> > And confirmed that networking inside both of them works fine here.

> > I wonder if it's a netplan vs ifupdown thing hitting autopkgtest in this case?

> I can build images: images(!) quite fine here, but when actually using
> them I see these temporary resolution failures most of the time during
> the initial apt-get update.

> I tracked this down to a race condition - basically we try to do the
> `apt-get update' before networking is fully up. (OK, I just saw Julian's
> post which came in while I was writing this and says the same thing...)

> There's a patch attached here which fixes the problem for me. I'm not
> sure if there's a better way to do this - basically it starts
> and waits for it to become active, with a timeout.
> Review appreciated.

It's a bit odd to be "start"ing a target in this manner.  Is it even
necessary to start the target, or would it be sufficient to just check
is-active in a loop?

In that case, I would suggest:

            while ! lxc exec "$CONTAINER" -- systemctl is-active \
                  && [ $timeout -ge 0 ]
                timeout=$((timeout - 1))
                sleep 1
            [ $timeout -ge 0 ] || {
                echo "Timed out waiting for network to come up" >&2
                exit 1

Or, invoke wait-online directly:


lxc launch ubuntu-daily:bionic b3 && 
  sleep 0.2 && 
  lxc exec b3 -- /bin/bash -c 'sleep 2; echo "waiting on network"; /lib/systemd/systemd-networkd-wait-online &&  apt update'

systemd-networkd-wait-online isn't happy to start really early; it doesn't attempt to reconnect to dbus if you run it before it's up
so that's the sleep 2 in there.

networkd is enabled only on artful and newer, so this won't help w.r.t xenial and older.

Also, networkd comes up just as fast as networking in xenial  *if* you don't have IPV6 and accept-ra enabled.
networkd spends approx 10 seconds waiting for a RA solicitation on my Xenial machine;

If I disable dhcpv6 and accept-ra is false, then we do a v4 dhcp in less than 2 seconds.

# cat /etc/netplan/50-cloud-init.yaml 
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
    version: 2
            dhcp4: true
            dhcp6: false
            accept-ra: off

root@b1:~# systemd-analyze blame
           725ms systemd-networkd-wait-online.service

With RA enabled (the default in networkd)

root@b1:~# systemd-analyze blame
         13.141s systemd-networkd-wait-online.service

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                                     

ubuntu-devel mailing list
Modify settings or unsubscribe at: