24

For Ubuntu 16.04 LTS (GNU/Linux 3.10.96-113 armv7l)

When I have the following, my static configuration is ignored:

/etc/network/interfaces

source-directory /etc/network/interfaces.d

/etc/network/interfaces.d/eth0

auto eth0
iface eth0 inet static
        address 192.168.40.112
        netmask 255.255.255.0
        gateway 192.168.40.1
        dns-nameservers 8.8.8.8

However, with the following:

/etc/network/interfaces

auto eth0
iface eth0 inet static
        address 192.168.40.112
        netmask 255.255.255.0
        gateway 192.168.40.1
        dns-nameservers 8.8.8.8

source-directory /etc/network/interfaces.d

the static configuration is set at boot (independently of what I have in interfaces.d/).

In case it is relevant, I am using a udev rule to rename the eth0 interface (it used to be "enx001e063110c0"...)

heynnema
  • 70,711

3 Answers3

40

I think I found it. From the manual, the problem seems to be with the source-directory keyword. It looks that, since 16.04, it is not supported anymore.

So replacing

source-directory /etc/network/interfaces.d

with

source /etc/network/interfaces.d/*

seems to fix the problem.

6

I had approximately the same problem. It turns out source-directory is supported on my system, but only includes files whose filenames consist of letters, numbers, dashes and underscores.

That is why my eth0.conf didn't get read, because it contained a dot.

Sjoerd
  • 171
  • For all it's worth - I've verified with several machines on 14.04 and 16.04 that files w/o extensions in /etc/network/interfaces.d get sourced just fine from /etc/network/interfaces with source-directory /etc/network/interfaces.d ... ;) Also worth noting that in our environment network-manager gets removed from servers; too unpredictable :D – tink Nov 01 '17 at 00:20
2

Your Kernel 3.10 is too old for systemd IFF using systemd-v230 or newer.

According to systemd kernel requirements in github at (github.com - systemd README) you need version >= 3.12 if you are using systemd-v230 or newer:

REQUIREMENTS:
        Linux kernel >= 3.12
        Linux kernel >= 4.2 for unified cgroup hierarchy support

Lines 37, 38 and 39 are printed above.

You are running under ARM architecture which I frankly know little about. Google search tells me your armvl7 is used by Raspberry Pi and is a 32 bit kernel.

Updating your Kernel to modern times

If you want the latest (October 21, 2016) "Dirty COW" security protection (What is the "Dirty COW" bug, and how can I secure my system against it?) plus a host of other security patches, bug fixes and system improvements (after your 2013 version) you should be on kernel 4.4.0-47.

Unfortunately I don't know how to do that for a RaspberryPi. I have linked this question to people who use RaspberryPi and have asked them to critique this answer.

  • Just to confirm: The ARM CPU in the Pi is indeed 32-bit. – Nathan Osman Nov 26 '16 at 02:03
  • @NathanOsman Thank you for confirming this new subject area for me :) – WinEunuuchs2Unix Nov 26 '16 at 02:11
  • +1 for pointing this out. However, please see this. Systemd generally supports 2y old kernels, so even you may be right, I would be surprised this is the root cause. I'll check the systemd version I am running. But even if it is a newish version, doesn't it sound more like a userspace issue? How could the kernel allow you read one file but stop you from reading another one? And the network configuration is clearly applied without issues in the second case. [More on next comment] – Luis de Arquer Nov 27 '16 at 11:54
  • Normally I would just upgrade the kernel and test, but it may be difficult in this case. This system runs on an ODROID XU4, where security is not a concern, but changing kernels can take some time, and probably is not a long term solution due to stability. If no other solution comes up, I may try it though just for curiosity : ) – Luis de Arquer Nov 27 '16 at 12:00
  • @NathanOsman Actually, the CPU itself is 64 bit on the Raspberry 3 (but normally it is used with 32 bit kernels) – Luis de Arquer Nov 27 '16 at 12:02
  • @LuisdeArquer yes systemd runs in user-space but still needs to talk to kernel and that is accomplished through ABI (Application Binary Interface) which changes every year or so with new symbols and old symbols removed. See: https://abi-laboratory.pro/tracker/timeline/linux/ – WinEunuuchs2Unix Nov 27 '16 at 14:33
  • @WinEunuuchs2Unix I know, not saying that is not definitely the issue, only saying that this is probably unrelated. The decision whether to read a file and the process to open it, read it and process it is very much kernel agnostic, and uses regular system calls. – Luis de Arquer Nov 27 '16 at 14:58
  • @LuisdeArquer You could file a systemd bug report pointing out your kernel is 3.10 and asking if >=3.12 is needed at: https://github.com/systemd/systemd/issues The webpage gets heavy traffic and I would hope you get a detailed explanation very quickly. – WinEunuuchs2Unix Nov 27 '16 at 15:10
  • @WinEunuuchs2Unix Luckily I just managed to fix : ) (I've just posted an answer for it). No idea how a source-directory keyword ended up on the ODROID 16.04 image. Which doesn't mean you are not right, generally, on the compatibility thing: Just checked it, and I am running systemd 229, released in 2016, when the kernel 3.12 was already a requirement. – Luis de Arquer Nov 27 '16 at 15:16
  • @LuisdeArquer A little late to the party, but the file /etc/network/interfaces is read by the service network (usually /etc/init.d/network, which is where you'll want to look, instead of a discussion about systemd and kernel versions. – Samveen Oct 05 '17 at 07:14