TransWikia.com

systemd networkd is restarted after systemctl stop

Server Fault Asked by barisdad on September 14, 2020

I have some python code that needs to change the configuration of a linux bond using systemd-networkd. I tried editing the .network and .netdev config files and restarting networkd but it doesn’t change the bond configuration.

What I want to do next is stop networkd, delete the bond and then start networkd again. The problem is that networkd is started as soon as I delete the bond. This is also reproducible via systemctl – /lib/systemd/systemd-networkd is started after the interface is deleted.

root@63cece1df328:/# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.1  0.0  76864  2376 ?        Ss   05:54   0:00 /lib/systemd/systemd
root        21  0.0  0.0  70120  6452 ?        S<s  05:54   0:00 /lib/systemd/systemd-journald
root        22  0.0  0.0  24824   368 ?        Ss   05:54   0:00 /usr/bin/socat TCP-LISTEN:7272,reuseadd
message+    29  0.0  0.0  49928   508 ?        Ss   05:54   0:00 /usr/bin/dbus-daemon --system --address
systemd+    30  0.0  0.0  71968  1296 ?        Ss   05:54   0:00 /lib/systemd/systemd-networkd
root        33  0.3  0.0  18508  3424 pts/0    Ss   05:55   0:00 bash
root        43  0.0  0.0  34400  2848 pts/0    R+   05:55   0:00 ps aux
root@63cece1df328:/# systemctl stop systemd-networkd
Warning: Stopping systemd-networkd.service, but it can still be activated by:
  systemd-networkd.socket
root@63cece1df328:/# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  76864  4408 ?        Ss   05:54   0:00 /lib/systemd/systemd
root        21  0.0  0.0  70120  6452 ?        S<s  05:54   0:00 /lib/systemd/systemd-journald
root        22  0.0  0.0  24824   368 ?        Ss   05:54   0:00 /usr/bin/socat TCP-LISTEN:7272,reuseadd
message+    29  0.0  0.0  49928   508 ?        Ss   05:54   0:00 /usr/bin/dbus-daemon --system --address
root        33  0.0  0.0  18508  3424 pts/0    Ss   05:55   0:00 bash
root        47  0.0  0.0  34400  2868 pts/0    R+   05:56   0:00 ps aux
root@63cece1df328:/# ip link show mgmt
5: mgmt: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether fe:df:a1:cf:82:39 brd ff:ff:ff:ff:ff:ff
root@63cece1df328:/# ip link del mgmt
root@63cece1df328:/# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  76864  4912 ?        Ss   05:54   0:00 /lib/systemd/systemd
root        21  0.0  0.0  70120  6452 ?        S<s  05:54   0:00 /lib/systemd/systemd-journald
root        22  0.0  0.0  24824   368 ?        Ss   05:54   0:00 /usr/bin/socat TCP-LISTEN:7272,reuseadd
message+    29  0.0  0.0  49928   508 ?        Ss   05:54   0:00 /usr/bin/dbus-daemon --system --address
root        33  0.0  0.0  18508  3424 pts/0    Ss   05:55   0:00 bash
systemd+    50  1.0  0.0  71968  5964 ?        Ss   05:57   0:00 /lib/systemd/systemd-networkd
root        51  0.0  0.0  34400  2924 pts/0    R+   05:57   0:00 ps aux
root@63cece1df328:/# ip link show mgmt
13: mgmt: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1514 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether fe:df:a1:cf:82:39 brd ff:ff:ff:ff:ff:ff```

One Answer

The warning displayed when stopping systemd-networkd.service explains the issue. "Warning: Stopping systemd-networkd.service, but it can still be activated by: systemd-networkd.socket"

If you want to prevent restarting, you need to stop the socket service as well.

systemctl stop systemd-networkd.socket

Answered by creztoe on September 14, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP