Bug#1011060: autopkgtest-build-lxc: searches for bridge at lxc.network.link not current lxc.net.0.link

2022-05-17 Thread Julian Gilbey
On Mon, May 16, 2022 at 04:28:41PM +0100, Julian Gilbey wrote:
> [...]
> Yes, it does, but having a look at /usr/bin/lxc-update-config, I see
> that the "0" in this is not necessarily always correct; it could be
> any number.  So perhaps something more like:
> 
> local bridge_interface=$(awk '/lxc\.net(work|\.[0-9]+)\.link/ {print($3)}' 
> /etc/lxc/default.conf)
> 
> would be better?

And it dawns on my that this will have problems if there's more than
one lxc.net.\d+.link present.  So maybe the following is better:

local bridge_interface=$(awk '/lxc\.net(work|\.[0-9]+)\.link/ {print($3)}' 
/etc/lxc/default.conf | head -n 1)

Best wishes,

   Julian



Bug#1011060: autopkgtest-build-lxc: searches for bridge at lxc.network.link not current lxc.net.0.link

2022-05-16 Thread Julian Gilbey
Hi Simon,

On Mon, May 16, 2022 at 01:20:44PM +0100, Simon McVittie wrote:
> On Mon, 16 May 2022 at 11:58:16 +0100, Julian Gilbey wrote:
> > The autopkgtest-build-lxc script searches for a bridge interface as
> > follows:
> > 
> > local bridge_interface=$(awk '{ if ($1 == "lxc.network.link") 
> > print($3)}' /etc/lxc/default.conf)
> 
> You haven't said what user-visible problem is caused by not finding this.
> Am I correct in thinking that the answer is: if the host system's apt
> proxy is localhost or 127.0.0.x, then it will not be converted into
> the bridge address for propagation into the container, and the container
> will end up not using a proxy?

Oh yes, I should have said this: that is indeed the problem.  (Well
deduced!)

> > Perhaps the code could be modified to something like:
> > 
> > local bridge_interface=$(awk '{ if ($1 == "lxc.network.link" || 
> > $1 == "lxc.net.0.link") print($3)}' /etc/lxc/default.conf)
> 
> If you do that, does it solve the user-visible problem?

Yes, it does, but having a look at /usr/bin/lxc-update-config, I see
that the "0" in this is not necessarily always correct; it could be
any number.  So perhaps something more like:

local bridge_interface=$(awk '/lxc\.net(work|\.[0-9]+)\.link/ {print($3)}' 
/etc/lxc/default.conf)

would be better?

Best wishes,

   Julian



Bug#1011060: autopkgtest-build-lxc: searches for bridge at lxc.network.link not current lxc.net.0.link

2022-05-16 Thread Simon McVittie
On Mon, 16 May 2022 at 11:58:16 +0100, Julian Gilbey wrote:
> The autopkgtest-build-lxc script searches for a bridge interface as
> follows:
> 
> local bridge_interface=$(awk '{ if ($1 == "lxc.network.link") 
> print($3)}' /etc/lxc/default.conf)

You haven't said what user-visible problem is caused by not finding this.
Am I correct in thinking that the answer is: if the host system's apt
proxy is localhost or 127.0.0.x, then it will not be converted into
the bridge address for propagation into the container, and the container
will end up not using a proxy?

> Perhaps the code could be modified to something like:
> 
> local bridge_interface=$(awk '{ if ($1 == "lxc.network.link" || 
> $1 == "lxc.net.0.link") print($3)}' /etc/lxc/default.conf)

If you do that, does it solve the user-visible problem?

smcv



Bug#1011060: autopkgtest-build-lxc: searches for bridge at lxc.network.link not current lxc.net.0.link

2022-05-16 Thread Julian Gilbey
Package: autopkgtest
Version: 5.21
Severity: normal

The autopkgtest-build-lxc script searches for a bridge interface as
follows:

local bridge_interface=$(awk '{ if ($1 == "lxc.network.link") 
print($3)}' /etc/lxc/default.conf)

But the current version of the lxc package has the following in
/etc/lxc/default.conf:

-
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up

lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
-

So the bridge will not be detected.

Perhaps the code could be modified to something like:

local bridge_interface=$(awk '{ if ($1 == "lxc.network.link" || $1 
== "lxc.net.0.link") print($3)}' /etc/lxc/default.conf)

Best wishes,

   Julian