Package: autopkgtest
Version: 5.42
X-Debbugs-Cc: Stefano Rivera <stefa...@debian.org>

Hi,

Once upgrading autopkgtest, I had my incus container image creation fail
in setup-testbed. Ultimately, the setup-testbed script would fail at

    printf 'auto %s\niface %s inet dhcp\n' "$iface" "$iface" >> 
"$root/etc/network/interfaces.d/$iface"

As the interfaces.d directory would not exist. (Don't ask me why, it
existed in the image.) That lead me into a deep rabbit hole of setting
up container networking and I think what autopkgtest does here is not
quite up to the task (but my base image was neither).

My base image happened to be a default variant and thus included the
important package ifupdown. Thus netconf_exists would go into the
ifupdown branch and conclude that I have no networking configured. I
question whether this approach is useful. ifupdown can easily end up
being installed without causing harm otherwise. In this case, networking
was set up using networkd, but netconf_exists would not recognize that
as it was assuming that ifupdown was in use. I ended up removing
ifupdown to get past this step.

The next item is the real problem in my view. netconf_exists then checks
for /etc/systemd/network/*.network to see whether networkd is properly
configured. In many recent container and virtual machine deployments,
the network is configured in
/usr/lib/systemd/network/80-container-host0.network. That happened to be
the case for me, but this file does not match
/etc/systemd/networkd/*.network of course, so then netconf_exists
concludes that this is not configured using systemd-networkd even though
it actually is. I argue that the check is not doing the right thing for
the most common way to set up container networking. The file will exist
for any systemd installation so in principle, we should replace the
check with "if networkd is enabled", but that happens to also be the
case for netplan.io and then we'd always skip configuring netplan.io.
That seems bad as well, so the question arises: How do we properly tell
setup-testbed that host0 networking with networkd should be used?

For my use case, I found sensible workarounds, so I see little urgency
here, but this seemed worth reporting as I expect it to become more
relevant given the rising adoption of container runtimes such as podman
that default their network to host0 expecting systemd to automatically
configure it.

Helmut

Reply via email to