nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

Containers: private networking broken with linux 4.14 and systemd 238

Open xeji opened this issue 8 years ago • 10 comments

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.nix fails, container complains about missing host0 interface
  • Try to start a container created by nixos-container create foo.
  • manual tests with systemd-nspawn -n show only loopback interface in container.

Technical details

18.03pre131587.b6ddb9913f2.

xeji avatar Apr 02 '18 16:04 xeji

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.

vcunat avatar Apr 02 '18 16:04 vcunat

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.

xeji avatar Apr 02 '18 18:04 xeji

Oh, from discussion here I understood otherwise, which is why it was deemed safe to bump the headers. /cc @shlevy IIRC.

vcunat avatar Apr 02 '18 18:04 vcunat

After rebuilding with kernel headers downgraded to 4.14, the issue is still there - so that's not the cause.

xeji avatar Apr 03 '18 09:04 xeji

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:

shlevy avatar Apr 03 '18 11:04 shlevy

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.

jiri-one avatar Apr 03 '18 20:04 jiri-one

Thank you @jiri-one. I will open an upstream systemd issue for this.

xeji avatar Apr 03 '18 20:04 xeji

Opened https://github.com/systemd/systemd/issues/8646

xeji avatar Apr 03 '18 21:04 xeji

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.

xeji avatar Apr 04 '18 09:04 xeji

fixed in #38475

xeji avatar Apr 08 '18 20:04 xeji