Bug#899002: systemd: networking and rdma-load-modules at infiniband service run in parallel despite the declared dependency order

Benjamin Drung benjamin.drung at profitbricks.com
Fri May 18 13:54:19 BST 2018


Package: systemd
Version: 232-25+deb9u3
Severity: normal

Hi,

rdma-load-modules at infiniband.service (from rdma-core) loads the ib_ipoib
(IP over InfiniBand) kernel module. Once this module is loaded, ifup can
bring up network devices on InfiniBand. systemd is configured to runs
networking.service after network-pre.target which comes after
rdma-load-modules at infiniband.service:

```
$ systemctl cat networking.service
# /lib/systemd/system/networking.service
[Unit]
Description=Raise network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Wants=network.target
After=local-fs.target network-pre.target apparmor.service
systemd-sysctl.service systemd-modules-load.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStartPre=-/bin/sh -c '[ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle'
ExecStart=/sbin/ifup -a --read-environment
ExecStop=/sbin/ifdown -a --read-environment --exclude=lo
RemainAfterExit=true
TimeoutStartSec=5min

$ systemctl cat rdma-load-modules at infiniband.service
# /lib/systemd/system/rdma-load-modules at .service
[Unit]
Description=Load RDMA modules from /etc/rdma/modules/%I.conf
Documentation=file:/usr/share/doc/rdma-core/udev.md
# Kernel module loading must take place before sysinit.target, similar
# to
# systemd-modules-load.service
DefaultDependencies=no
Before=sysinit.target
# Do not execute concurrently with an ongoing shutdown
Conflicts=shutdown.target
Before=shutdown.target
# Partially support distro network setup scripts that run after
# systemd-modules-load.service but before sysinit.target, eg a classic
# network
# setup script. Run them after modules have loaded.
Wants=network-pre.target
Before=network-pre.target
# Orders all kernel module startup before rdma-hw.target can become
# ready
Before=rdma-hw.target

ConditionCapability=CAP_SYS_MODULE

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/lib/systemd/systemd-modules-load /etc/rdma/modules/%I.conf
TimeoutSec=90s
```

Example /etc/network/interfaces:
```
auto ib0.dddd
iface ib0.dddd inet6 static
    address fd44:1:5255::
    netmask 64
    pre-up echo connected > /sys/class/net/$IFACE/mode
    dad-attempts 600
```

networking.service fails, because the pre-up command fails because
/sys/class/net/ib0.dddd is not present. I changed the pre-up to print
debugging information and found out that the systemd-modules-load
command and rdma-load-modules at infiniband.service are still runninig when ifup
is running:

```
$ ps auxf
[...]
root      1873  0.0  0.0  40648  2168 ?        Rs   10:16   0:00 /lib/systemd/systemd-modules-load /etc/rdma/modules/infiniband.conf
[...]
$ systemctl status rdma-load-modules at infiniband.servicerdma-load-modules at infiniband.service - Load RDMA modules from /etc/rdma/modules/infiniband.conf
   Loaded: loaded (/lib/systemd/system/rdma-load-modules at .service; static; vendor preset: enabled)
   Active: activating (start) since Fri 2018-05-18 10:16:55 UTC; 94ms ago
     Docs: file:/usr/share/doc/rdma-core/udev.md
 Main PID: 1873 (systemd-modules)
   CGroup: /system.slice/system-rdma\x2dload\x2dmodules.slice/rdma-load-modules at infiniband.service
           └─1873 /lib/systemd/systemd-modules-load /etc/rdma/modules/infiniband.conf
May 18 10:16:55 pserver1303 systemd[1]: Starting Load RDMA modules from /etc/rdma/modules/infiniband.conf...
```

-- 
Benjamin Drung
System Developer
Debian & Ubuntu Developer

ProfitBricks GmbH
Greifswalder Str. 207
10405 Berlin

Email: benjamin.drung at profitbricks.com
URL: https://www.profitbricks.de

Sitz der Gesellschaft: Berlin
Registergericht: Amtsgericht Charlottenburg, HRB 125506 B
Geschäftsführer: Achim Weiss, Matthias Steinberg, Christoph Steffens


More information about the Pkg-systemd-maintainers mailing list