Files in /etc/network/interfaces.d ignored, but not /etc/network/interfaces itself

69,157

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
69,157

Related videos on Youtube

Luis de Arquer
Author by

Luis de Arquer

Updated on September 18, 2022

Comments

  • Luis de Arquer
    Luis de Arquer over 1 year

    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"...)

    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      My hunch is something to do with Kernel version 3.10 that might not even be supported anymore.
    • Luis de Arquer
      Luis de Arquer over 7 years
      It doesn't really sound like a kernel issue to me. But I am clueless yet at to how networking initialization works after the move to systemd -not saying it is a systemd issue
    • wjandrea
      wjandrea over 7 years
      Just curious, why are you running Linux 3.10 instead of the most recent version?
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      The point about the kernel is I thought stystemd didn't come out until a later version but I'm on my phone still and can't confirm.
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      @LuisdeArquer I've answered the kernel issue below.
    • Luis de Arquer
      Luis de Arquer over 7 years
      @wjandrea It is the recommended stable kernel for the ODROID XU4, which I am using here. There are newer kernels available, but normally they'd suffer from all sort of issues
  • Nathan Osman
    Nathan Osman over 7 years
    Just to confirm: The ARM CPU in the Pi is indeed 32-bit.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    @NathanOsman Thank you for confirming this new subject area for me :)
  • Luis de Arquer
    Luis de Arquer over 7 years
    +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
    Luis de Arquer over 7 years
    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
    Luis de Arquer over 7 years
    @NathanOsman Actually, the CPU itself is 64 bit on the Raspberry 3 (but normally it is used with 32 bit kernels)
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    @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: abi-laboratory.pro/tracker/timeline/linux
  • Luis de Arquer
    Luis de Arquer over 7 years
    @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.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    @LuisdeArquer You could file a systemd bug report pointing out your kernel is 3.10 and asking if >=3.12 is needed at: github.com/systemd/systemd/issues The webpage gets heavy traffic and I would hope you get a detailed explanation very quickly.
  • Luis de Arquer
    Luis de Arquer over 7 years
    @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.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    Ha good for you. +1 for tenacity :) Don't forget to come back in two days and mark your answer as solving the question (click the check mark next to your answer and make it green)
  • Luis de Arquer
    Luis de Arquer over 7 years
    @WinEunuuchs2Unix Thanks for your help! :)
  • Samveen
    Samveen over 6 years
    @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.
  • tink
    tink over 6 years
    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
  • jacobq
    jacobq about 6 years
    This seems to fix the identical problem with the current (March 2018) version of raspbian as well.
  • Marcus
    Marcus about 6 years
    Very interesting. The Odroid Ubuntu 16.04 is affected by this problem as well.