Containers: private networking broken with linux 4.14 and systemd 238
Issue description
systemd-nspawn containers started with --private-network (or related options) only see a loopback interface, the desired interface to the host is missing. Same applies to containers created by nixos-container. Problem exists with linux 4.14 and systemd 238.
With linux 4.9 and systemd 238, container networking looks ok.
See also discussion in https://github.com/NixOS/nixpkgs/commit/6b9771e4a
/cc @fpletz @vcunat
Steps to reproduce
Any of these:
nix-build nixos/tests/containers-imperative.nixfails, container complains about missinghost0interface- Try to start a container created by
nixos-container create foo. - manual tests with
systemd-nspawn -nshow only loopback interface in container.
Technical details
18.03pre131587.b6ddb9913f2.
For reference, the current 18.03 branch downgraded systemd to 237 (mainly due to this), but the big 18.03 channel is still with systemd-238 ATM.
One thing I observed is that we compile systemd (and glibc etc. ) with the latest linux-headers (currently 4.15), no matter what kernel version actually runs on the system. This may not work according to kernel doc :
Kernel headers are backwards compatible, but not forwards compatible. This means that a program built against a C library using older kernel headers should run on a newer kernel (although it may not have access to new features), but a program built against newer kernel headers may not work on an older kernel.
Don't know if that is relevant for this issue but will do a little experiment.
Oh, from discussion here I understood otherwise, which is why it was deemed safe to bump the headers. /cc @shlevy IIRC.
After rebuilding with kernel headers downgraded to 4.14, the issue is still there - so that's not the cause.
We pass --enable-kernel=3.2.0 to glibc... I wouldn't be completely surprised if things still break with that, but it's not expected at least :grinning:
I can confirm it on Arch Linux - this bug is same with kernel 4.14 and systemd 238. With kernel 4.15 all works normaly.
Thank you @jiri-one. I will open an upstream systemd issue for this.
Opened https://github.com/systemd/systemd/issues/8646
There's a proposed fix in systemd/systemd#8633 (not yet merged). I just tested it on NixOS - seems to fix this issue. Will make a PR for nixos/systemd when the fix is merged upstream.
fixed in #38475