Systemd does not send dhcp release on shutdown

Hi all,

according to https://github.com/systemd/systemd/blob/master/NEWS, systemd 243 includes a new SendRelease= option for configuring whether to send a DHCP RELEASE message when terminating. However, it does not work with Clear Linux.

/etc/systemd/network/ens192.network:10: Unknown key name ‘SendRelease’ in section ‘DHCP’, ignoring

Thanks in advance for help with troubleshooting.

root@clr-1694bf38eaad4808923e50674710dabe~ # systemctl --version
systemd 243 (243)
+PAM +AUDIT -SELINUX +IMA -APPARMOR -SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=legacy

root@clr-1694bf38eaad4808923e50674710dabe~ # cat /etc/systemd/network/ens192.network
[Match]
Name=en*

[Network]
DHCP=yes

[DHCP]
UseDomains=yes
UseMTU=yes
SendRelease=yes

root@clr-1694bf38eaad4808923e50674710dabe~ # systemctl status systemd-networkd
● systemd-networkd.service - Network Service
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2019-09-21 12:23:05 UTC; 1min 12s ago
Docs: man:systemd-networkd.service(8)
Main PID: 263 (systemd-network)
Status: “Processing requests…”
Tasks: 1
Memory: 1016.0K
CGroup: /system.slice/systemd-networkd.service
└─263 /usr/lib/systemd/systemd-networkd

Sep 21 12:23:04 clr-1694bf38eaad4808923e50674710dabe systemd[1]: Starting Network Service…
Sep 21 12:23:05 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: /etc/systemd/network/ens192.network:10: Unknown key name ‘SendRelease’ in section ‘DHCP’, ignoring.
Sep 21 12:23:05 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: Enumeration completed
Sep 21 12:23:05 clr-1694bf38eaad4808923e50674710dabe systemd[1]: Started Network Service.
Sep 21 12:23:06 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: eth0: Interface name change detected, eth0 has been renamed to ens192.
Sep 21 12:23:06 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: ens192: IPv6 successfully enabled
Sep 21 12:23:06 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: ens192: Gained carrier
Sep 21 12:23:06 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: ens192: DHCPv4 address 192.168.2.184/24 via 192.168.2.1
Sep 21 12:23:08 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: ens192: Gained IPv6LL
Sep 21 12:23:20 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[263]: ens192: Configured

I think SendRelease= has to be under the [DHCPv4] section explicitly. Try that

Moved the config under [DHCPv4], the error is no longer there. However, DHCP Release packet is still not observed in tcpdump capture…

root@clr-1694bf38eaad4808923e50674710dabe~ # cat /etc/systemd/network/ens192.network
[Match]
Name=en*

[Network]
DHCP=yes

[DHCPv4]
UseDomains=yes
UseMTU=yes
SendRelease=yes

That would mean an upstream bugreport is in order. How are you shutting down? Is systemd-networkd properly shutting down or are there issues shutting down?

I run “shutdown now” to power off. I’ve enabled systemd-networkd debug and there are no errors during shutdown as far as I can see.

Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[261]: Bus bus-api-network: changing state RUNNING → CLOSING
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[261]: Bus bus-api-network: changing state CLOSING → CLOSED
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[261]: NDISC: Stopping IPv6 Router Solicitation client
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd-networkd[261]: DHCP CLIENT (0xb009e516): FREE
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd[1]: Stopping Network Service…
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd[1]: systemd-networkd.service: Succeeded.
Sep 21 18:03:43 clr-1694bf38eaad4808923e50674710dabe systemd[1]: Stopped Network Service.

Yeah, so that suggests an upstream bug report is needed.

Turns out that “KeepConfiguration=no” should also be set in order for DHCP Release packet to be sent. The config below works as expected.

[Match]
Name=en*

[Network]
KeepConfiguration=no
DHCP=yes

[DHCPv4]
UseDomains=yes
UseMTU=yes
SendRelease=yes

Thanks everyone!

2 Likes