Thursday, 15 February 2018

Re: autopkgtest-build-lxd failing with bionic

On Thu, Feb 15, 2018 at 06:48:31PM +0000, Iain Lane wrote:
> [ autopkgtest-devel, this is
> https://lists.ubuntu.com/archives/ubuntu-devel/2018-February/040138.html
> 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
> network-online.target 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:

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


--
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 http://www.debian.org/
[email protected] [email protected]