[systemd-devel] Masking .network files

Tom Gundersen teg at jklm.no
Sat Apr 5 16:12:45 PDT 2014


On Sat, Apr 5, 2014 at 5:06 PM, Leonid Isaev <lisaev at umail.iu.edu> wrote:
> Hi,
>
> On Sat, 5 Apr 2014 11:26:17 +0200
> Tom Gundersen <teg at jklm.no> wrote:
>
>> On Sat, Apr 5, 2014 at 12:43 AM, Leonid Isaev <lisaev at umail.iu.edu> wrote:
>> >         I seem to have a strange issue with the way networkd processes its
>> > configuration files. The machine is actually a systemd-nspawn container
>> > with a static IP address, so I had to mask the default
>> > 80-container-host0.network and create a custom config. Both real and
>> > virtual machines are up-to-date archlinux [testing] installations.
>>
>> So the best way to do this is to name your custom config file either
>> the same as what you are overriding (if the overridden file should
>> anyway never be used, which is the case for what you describe), or
>> simply name it starting with a lower number. That way the first
>> matching file will be applied.
>
> Thanks for the explanation.
>
> I figured that much, just wanted to know whether it was a 'feature'.
>
>>
>> The 'masking' logic that you know from unit files does not really make
>> much sense for .network files (but maybe this is something we should
>> change...). Symlinks to /dev/null are just treated as empty .network
>> files, so their meaning is "no [Match] section", which matches
>> everything and "no [Network] section", which does nothing.
>
> I don't know the grand goal of networkd, so it's just an opinion, but it seems
> odd that the daemon will touch interfaces it shouldn't just because there is a
> masked .network file (what if I want a given iface to stay down after boot).
>
>> I suppose
>> this may be used to express "ignore any subsequent .network files",
>> but I doubt that is a particularly useful thing to do.
>
> Wouldn't this be a bad thing? Because a distribution/upstream can break lots
> of boxes by providing e.g. /usr/lib/systemd/network/30-stupid-default.network
> which most people will automatically (and naively) mask...

So in general "masking" .network files (in the sense applied to unit
files) does not make much sense, and will probably not behave as you
would expect from knowing unit files. We may very well want to change
this in networkd, but need to think a bit about precisely how (the
whole logic is quite different from unit files, so copying the same
behavior doesn't quite work I think).

>> > /etc/systemd/network/80-container-host0.network: symbolic link to
>> > `/dev/null' /usr/lib/systemd/network/80-container-host0.network: ASCII text
>> > $ cat /etc/systemd/network/eth.network
>> > [Match]
>> > Name=host0
>> >
>> > [Network]
>> > Address=10.137.0.2/24
>> > Gateway=10.137.0.1
>> >
>> > [DHCPv4]
>> > UseDNS=false
>> > -----
>> >
>> > However, this new .network file is never picked up by systemd-networkd (it
>> > does provide a working network setup if the host0 interface is renamed).
>> > Here is the debug output:
>> >
>> > -----
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: timestamp of
>> > '/etc/systemd/network' changed
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: timestamp of
>> > '/run/systemd/network' changed
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: Skipping overridden
>> > file: /usr/lib/systemd/network/80-container-host0.network.
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: Configuration
>> > file /etc/systemd/network/80-container-host0.network is marked
>> > world-writable. Please remove world writability permission bits.
>> > Proceeding anyway. Apr 04 21:29:00 lxc_archtest systemd-networkd[128]:
>> > host0: found matching network
>> > '/etc/systemd/network/80-container-host0.network' Apr 04 21:29:00
>> > lxc_archtest systemd-networkd[128]: host0: requesting link status
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: bringing link up
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: link configured
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: link (with
>> > ifindex 22) added
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: found matching
>> > network '/etc/systemd/network/80-container-host0.network'
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: requesting link
>> > status Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: bringing
>> > link up Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: link
>> > configured Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: link
>> > (with ifindex 1) added
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: MAC address:
>> > 36:9a:b1:98:ab:e1
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: link status
>> > updated: 00000000 -> 0x00011043
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: link is up
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: host0: carrier on
>> > Apr 04 21:29:00 lxc_archtest systemd-networkd[128]: Sent message
>> > type=method_call sender=n/a destination=org.freedesktop.DBus
>> > object=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello
>> > cookie=1 reply_cookie=0 error=n/a Apr 04 21:29:00 lxc_archtest
>> > systemd-networkd[128]: Got message type=method_return
>> > sender=org.freedesktop.DBus destination=:1.8 object=n/a interface=n/a
>> > member=n/a cookie=1 reply_cookie=1 error=n/a Apr 04 21:29:00 lxc_archtest
>> > systemd-networkd[128]: lo: link status updated: 00000000 -> 0x00010049 Apr
>> > 04 21:29:00 lxc_archtest systemd-networkd[128]: lo: link is up Apr 04
>> > 21:29:00 lxc_archtest systemd-networkd[128]: lo: carrier on Apr 04
>> > 21:29:00 lxc_archtest systemd-networkd[128]: Got message type=signal
>> > sender=org.freedesktop.DBus destination=:1.8 object=/org/freedesktop/DBus
>> > interface=org.freedesktop.DBus member=NameAcquired cookie=2 reply_cookie=0
>> > error=n/a Apr 04 21:29:02 lxc_archtest systemd-networkd[128]: Received
>> > SIGINT. Apr 04 21:29:02 lxc_archtest systemd-networkd[128]: Assertion
>> > 's->event->state != SD_EVENT_FINISHED' failed at
>> > src/libsystemd/sd-event/sd-event.c:1308, function
>> > sd_event_source_set_enabled(). Ignoring. Apr 04 21:29:02 lxc_archtest
>> > systemd-networkd[128]: Assertion 's->event->state != SD_EVENT_FINISHED'
>> > failed at src/libsystemd/sd-event/sd-event.c:1308, function
>> > sd_event_source_set_enabled(). Ignoring. Apr 04 21:29:02 lxc_archtest
>> > systemd-networkd[128]: Assertion 's->event->state != SD_EVENT_FINISHED'
>> > failed at src/libsystemd/sd-event/sd-event.c:1308, function
>> > sd_event_source_set_enabled(). Ignoring. -----
>> >
>> > I understand that the 1st matching configuration is applied but why does it
>> > concern overriden files? Also, why does a symlink to /dev/null match all
>> > interfaces (even loopback)?
>> >
>> > Thanks,
>> > --
>> > Leonid Isaev
>> > GnuPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE  775A A7AE F6CB 164B 5A6D
>> >
>> > _______________________________________________
>> > systemd-devel mailing list
>> > systemd-devel at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>> >
>
>
>
> --
> Leonid Isaev
> GnuPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE  775A A7AE F6CB 164B 5A6D
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


More information about the systemd-devel mailing list