Updated the LP bug; attaching debdiff shortly ** Description changed:
+ [ Impact ] + * Since systemd 255.4-1ubuntu8.9 (LP: #2098183), restarting systemd-networkd drops dynamically acquired DHCPv4/DHCPv6/NDisc addresses and routes even when the interface has `KeepConfiguration=yes`, causing a short network interruption. This is a regression. + + * This occurs because LP: #2098183 essentially made dynamic addresses + no longer be considered "foreign." In v255, `link_drop_managed_config()` + removes all non-"foreign" configs when a link is configured, so the + restored dynamic configs are deleted on the link's first configuration + after a restart. + + * The proposed fix modifies control flow to skip the calling of + `link_drop_managed_config()` on a link's first configuration when the + new .network file has `KeepConfiguration=yes`. This has the effect of + restoring the pre-LP: #2098183 behavior, resolving the regression. + + [ Test Plan ] + 0. Grab a fresh Noble LXD VM + 1. `sudo apt install systemd` # you never know + 2. Open two terminals + 2a. In terminal 1, monitor network events: `ip -ts monitor link address route dev enp5s0` + 2b. In terminal 2, `sudo vi /etc/netplan/10-lxc.yaml` and add `critical: true` + 3. `sudo netplan apply` + 4. `sudo systemctl restart systemd-networkd` + 5. Go back to terminal 1 and observe the output. + + 5a. Failure output (unpatched package): exact device names / address types do not matter + ``` + ubuntu@noble-vm:~$ ip -ts monitor link address route dev enp5s0 + ... + [2026-11-09T21:18:20.073592] Deleted local 172.23.126.199 table local proto kernel scope host src 172.23.126.199 + [2026-11-09T21:18:20.115181] 2: enp5s0 inet 172.23.126.199/12 metric 100 brd 172.31.255.255 scope global enp5s0 + valid_lft forever preferred_lft forever + [2026-11-09T21:18:20.115283] local 172.23.126.199 table local proto kernel scope host src + ... + ubuntu@noble-vm:~$ + ``` + + 5b. Success output (patched package): note the absence of `Deleted` entries + ``` + root@noble-vm:~# ip -ts monitor link address route dev enp5s0 + [2026-12-01T19:07:06.430201] 2: enp5s0 inet 172.23.126.199/12 metric 100 brd 172.31.255.255 scope global enp5s0 + valid_lft forever preferred_lft forever + [2026-12-01T19:07:07.189153] 2: enp5s0 inet6 2601:18a:8385:15d9:216:3eff:fede:ef05/64 scope global mngtmpaddr noprefixroute + valid_lft forever preferred_lft forever + ^C + root@noble-vm:~# + ``` + + [ Where problems could occur ] + * The change is a conditional guard before calling `link_drop_managed_config()`. + + * If the condition were wrong, either the original regression (DHCP address/route flapping on every networkd restart) would persist, or managed configs would never be dropped on reconfiguration: e.g. obsolete addresses lingering after `netplan apply`, `networkctl reconfigure`, or `systemctl restart systemd-networkd`. + + * Restart behavior with KeepConfiguration=no/dhcp/static should remain unchanged. + + * If the .network file is changed while networkd is not running, addresses/routes removed from the configuration are kept across the restart instead of dropped (this is the pre-LP: #2098183 behavior which differs from upstream v257). + + [ Other Info ] + * More than one approach exists for resolving this regression. + + * One approach is an adaptation [1] of upstream commit e09b7588 [2], which creates a similar guard within `link_drop_managed_config()`. + + - This apptoach was not chosen because its placement means it affects more than just the 'restart' path (e.g. reconfigure, carrier loss, unmanage) and it still drops and re-requests static configs on restart with KeepConfiguration=yes , while this patch restores the pre-LP: #2098183 behavior (nothing dropped). All of these issues were resolved in later upstream reworks (dd6d53a8dc [3] and 82df2e0f04 [4] in v257, PR #36414 [5] in v258), which combined are much too large of a change for an SRU. + + * Another approach is an adaptation [6] of aforementioned upstream + commit 82df2e0f04 [4] by Cho Jaeho in the duplicate bug LP: 2174378. + This approach was not explored in-depth, but it seems have the same idea + as this proposed patch [7] (adding a conditional guard to + `link_drop_managed_config()`). + + * The proposed patch [7] attached to this bug was authored by Jamie Nguyen. + + [1] https://launchpadlibrarian.net/886204116/lp2170677-networkd-drop-only-static-configs.patch + [2] https://github.com/systemd/systemd/commit/e09b7588 + [3] https://github.com/systemd/systemd/commit/dd6d53a8dc + [4] https://github.com/systemd/systemd/commit/82df2e0f04 + [5] https://github.com/systemd/systemd/pull/36414 + [6] https://launchpadlibrarian.net/884717763/lp-2174378-network-keep-configuration-dhcpv4-restart.patch + [7] https://launchpadlibrarian.net/881332241/3-lp2170677-networkd-keep-deserialized-config.patch + + -------------------------------------------------------------------------- + *Original bug* + [Impact] - The systemd-networkd restart operation unexpectedly removes DHCP dynamic addresses and routes even with KeepConfiguration=yes/true, on Ubuntu 24.04. + The systemd-networkd restart operation unexpectedly removes DHCP dynamic addresses and routes even with KeepConfiguration=yes/true, on Ubuntu 24.04. This is a 100% reproducible regression in my environment. [Environment] OS: Ubuntu 24.04.3 systemd: systemd:255.4-1ubuntu8.12 (255.4-1ubuntu8.17 also has the same issue) During this bug fix process https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2098183, Ubuntu backported upstream systemd-networkd serialization/deserialization support from upstream PR #34989 to fix DHCP/NDisc configuration loss when systemd-networkd is stopped. However, this change appears to have introduced a regression during systemd-networkd restarts: 1. When the old systemd-networkd exits, it serializes dynamically acquired configuration, such as DHCPv4/DHCPv6/NDisc addresses and routes. 2. When the new systemd-networkd starts, it first enumerates the existing kernel address/route objects as foreign. Then manager_deserialize() matches them with the serialized state and restores their source, for example: NETWORK_CONFIG_SOURCE_FOREIGN -> NETWORK_CONFIG_SOURCE_DHCP4 3. After that, the old v255 cleanup path runs link_drop_managed_config(). In v255, link_drop_managed_addresses() skips only foreign addresses. Since the deserialized DHCP/NDisc address is no longer foreign, it is treated as managed configuration and removed. [Result] Restarting systemd-networkd unexpectedly triggers deletion of DHCP/NDisc dynamic configuration. [Expected result] Restarting systemd-networkd should not remove existing DHCP dynamic configuration, especially when KeepConfiguration=yes is configured. [Steps to reproduce the problem] - 1. Make sure that KeepConfiguration is set to true/yes: + 1. Make sure that KeepConfiguration is set to true/yes: root@xxx:/etc/netplan# cat /run/systemd/network/10-netplan-eth0.network [Match] Name=eth0 [Network] DHCP=ipv4 LinkLocalAddressing=ipv6 KeepConfiguration=true [DHCP] RouteMetric=100 UseMTU=true - 2. Restart systemd-networkd: + 2. Restart systemd-networkd: systemctl restart systemd-networkd - 3. I observed through the ip monitor that the DHCP address was deleted: + 3. I observed through the ip monitor that the DHCP address was deleted: root@xxx:/etc/netplan# ip -ts monitor link address route dev eth0 [2026-10-13T16:22:44.564824] Deleted 192.168.122.1 proto dhcp scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.565428] Deleted default via 192.168.122.1 proto dhcp src 192.168.122.113 metric 100 - [2026-10-13T16:22:44.566066] Deleted 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 + [2026-10-13T16:22:44.566066] Deleted 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 valid_lft forever preferred_lft forever [2026-10-13T16:22:44.567151] Deleted 192.168.122.0/24 proto kernel scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.567816] Deleted broadcast 192.168.122.255 table local proto kernel scope link src 192.168.122.113 [2026-10-13T16:22:44.568545] Deleted local 192.168.122.113 table local proto kernel scope host src 192.168.122.113 - [2026-10-13T16:22:44.603101] 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 + [2026-10-13T16:22:44.603101] 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 valid_lft forever preferred_lft forever [2026-10-13T16:22:44.604425] local 192.168.122.113 table local proto kernel scope host src 192.168.122.113 [2026-10-13T16:22:44.605296] broadcast 192.168.122.255 table local proto kernel scope link src 192.168.122.113 [2026-10-13T16:22:44.606257] 192.168.122.0/24 proto kernel scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.607310] 192.168.122.1 proto dhcp scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.608106] default via 192.168.122.1 proto dhcp src 192.168.122.113 metric 100 [Upstream status] Upstream later changed this area significantly. In particular: https://github.com/systemd/systemd/commit/e09b758876219de8222df798114d1d63b0323b58 This commit renamed link_drop_managed_*() to link_drop_static_*() and changed the semantics so that dynamic addresses are no longer removed by that path. issue: https://github.com/systemd/systemd/issues/36411 fix PR: https://github.com/systemd/systemd/pull/36414 This would preserve the intended LP: #2098183 fix while avoiding deletion of deserialized dynamic network configuration during systemd- networkd restart. [Question] Does Ubuntu 24.04 have any plans to fix this regression? ** Description changed: [ Impact ] * Since systemd 255.4-1ubuntu8.9 (LP: #2098183), restarting systemd-networkd drops dynamically acquired DHCPv4/DHCPv6/NDisc addresses and routes even when the interface has `KeepConfiguration=yes`, causing a short network interruption. This is a regression. * This occurs because LP: #2098183 essentially made dynamic addresses no longer be considered "foreign." In v255, `link_drop_managed_config()` removes all non-"foreign" configs when a link is configured, so the restored dynamic configs are deleted on the link's first configuration after a restart. * The proposed fix modifies control flow to skip the calling of `link_drop_managed_config()` on a link's first configuration when the new .network file has `KeepConfiguration=yes`. This has the effect of restoring the pre-LP: #2098183 behavior, resolving the regression. [ Test Plan ] 0. Grab a fresh Noble LXD VM 1. `sudo apt install systemd` # you never know 2. Open two terminals 2a. In terminal 1, monitor network events: `ip -ts monitor link address route dev enp5s0` 2b. In terminal 2, `sudo vi /etc/netplan/10-lxc.yaml` and add `critical: true` 3. `sudo netplan apply` 4. `sudo systemctl restart systemd-networkd` 5. Go back to terminal 1 and observe the output. 5a. Failure output (unpatched package): exact device names / address types do not matter ``` ubuntu@noble-vm:~$ ip -ts monitor link address route dev enp5s0 ... [2026-11-09T21:18:20.073592] Deleted local 172.23.126.199 table local proto kernel scope host src 172.23.126.199 [2026-11-09T21:18:20.115181] 2: enp5s0 inet 172.23.126.199/12 metric 100 brd 172.31.255.255 scope global enp5s0 valid_lft forever preferred_lft forever [2026-11-09T21:18:20.115283] local 172.23.126.199 table local proto kernel scope host src ... ubuntu@noble-vm:~$ ``` 5b. Success output (patched package): note the absence of `Deleted` entries ``` root@noble-vm:~# ip -ts monitor link address route dev enp5s0 [2026-12-01T19:07:06.430201] 2: enp5s0 inet 172.23.126.199/12 metric 100 brd 172.31.255.255 scope global enp5s0 valid_lft forever preferred_lft forever [2026-12-01T19:07:07.189153] 2: enp5s0 inet6 2601:18a:8385:15d9:216:3eff:fede:ef05/64 scope global mngtmpaddr noprefixroute valid_lft forever preferred_lft forever ^C root@noble-vm:~# ``` [ Where problems could occur ] * The change is a conditional guard before calling `link_drop_managed_config()`. * If the condition were wrong, either the original regression (DHCP address/route flapping on every networkd restart) would persist, or managed configs would never be dropped on reconfiguration: e.g. obsolete addresses lingering after `netplan apply`, `networkctl reconfigure`, or `systemctl restart systemd-networkd`. * Restart behavior with KeepConfiguration=no/dhcp/static should remain unchanged. * If the .network file is changed while networkd is not running, addresses/routes removed from the configuration are kept across the restart instead of dropped (this is the pre-LP: #2098183 behavior which differs from upstream v257). [ Other Info ] * More than one approach exists for resolving this regression. - * One approach is an adaptation [1] of upstream commit e09b7588 [2], which creates a similar guard within `link_drop_managed_config()`. + * One approach is an adaptation [1] of upstream commit e09b7588 [2], which creates a similar guard within the scope of `link_drop_managed_config()`. - - This apptoach was not chosen because its placement means it affects more than just the 'restart' path (e.g. reconfigure, carrier loss, unmanage) and it still drops and re-requests static configs on restart with KeepConfiguration=yes , while this patch restores the pre-LP: #2098183 behavior (nothing dropped). All of these issues were resolved in later upstream reworks (dd6d53a8dc [3] and 82df2e0f04 [4] in v257, PR #36414 [5] in v258), which combined are much too large of a change for an SRU. + - This approach was not chosen because its placement means it affects more than just the 'restart' path (e.g. reconfigure, carrier loss, unmanage) and it still drops and re-requests static configs on restart with KeepConfiguration=yes, while this patch restores the pre-LP: #2098183 behavior (nothing dropped). All of these issues were resolved in later upstream reworks (dd6d53a8dc [3] and 82df2e0f04 [4] in v257, PR #36414 [5] in v258), which combined are much too large of a change for an SRU. * Another approach is an adaptation [6] of aforementioned upstream - commit 82df2e0f04 [4] by Cho Jaeho in the duplicate bug LP: 2174378. + commit 82df2e0f04 [4] by Cho Jaeho in the duplicate bug LP: #2174378. This approach was not explored in-depth, but it seems have the same idea as this proposed patch [7] (adding a conditional guard to `link_drop_managed_config()`). * The proposed patch [7] attached to this bug was authored by Jamie Nguyen. [1] https://launchpadlibrarian.net/886204116/lp2170677-networkd-drop-only-static-configs.patch [2] https://github.com/systemd/systemd/commit/e09b7588 [3] https://github.com/systemd/systemd/commit/dd6d53a8dc [4] https://github.com/systemd/systemd/commit/82df2e0f04 [5] https://github.com/systemd/systemd/pull/36414 [6] https://launchpadlibrarian.net/884717763/lp-2174378-network-keep-configuration-dhcpv4-restart.patch [7] https://launchpadlibrarian.net/881332241/3-lp2170677-networkd-keep-deserialized-config.patch - -------------------------------------------------------------------------- + ---------------------------- *Original bug* [Impact] The systemd-networkd restart operation unexpectedly removes DHCP dynamic addresses and routes even with KeepConfiguration=yes/true, on Ubuntu 24.04. This is a 100% reproducible regression in my environment. [Environment] OS: Ubuntu 24.04.3 systemd: systemd:255.4-1ubuntu8.12 (255.4-1ubuntu8.17 also has the same issue) During this bug fix process https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2098183, Ubuntu backported upstream systemd-networkd serialization/deserialization support from upstream PR #34989 to fix DHCP/NDisc configuration loss when systemd-networkd is stopped. However, this change appears to have introduced a regression during systemd-networkd restarts: 1. When the old systemd-networkd exits, it serializes dynamically acquired configuration, such as DHCPv4/DHCPv6/NDisc addresses and routes. 2. When the new systemd-networkd starts, it first enumerates the existing kernel address/route objects as foreign. Then manager_deserialize() matches them with the serialized state and restores their source, for example: NETWORK_CONFIG_SOURCE_FOREIGN -> NETWORK_CONFIG_SOURCE_DHCP4 3. After that, the old v255 cleanup path runs link_drop_managed_config(). In v255, link_drop_managed_addresses() skips only foreign addresses. Since the deserialized DHCP/NDisc address is no longer foreign, it is treated as managed configuration and removed. [Result] Restarting systemd-networkd unexpectedly triggers deletion of DHCP/NDisc dynamic configuration. [Expected result] Restarting systemd-networkd should not remove existing DHCP dynamic configuration, especially when KeepConfiguration=yes is configured. [Steps to reproduce the problem] 1. Make sure that KeepConfiguration is set to true/yes: root@xxx:/etc/netplan# cat /run/systemd/network/10-netplan-eth0.network [Match] Name=eth0 [Network] DHCP=ipv4 LinkLocalAddressing=ipv6 KeepConfiguration=true [DHCP] RouteMetric=100 UseMTU=true 2. Restart systemd-networkd: systemctl restart systemd-networkd 3. I observed through the ip monitor that the DHCP address was deleted: root@xxx:/etc/netplan# ip -ts monitor link address route dev eth0 [2026-10-13T16:22:44.564824] Deleted 192.168.122.1 proto dhcp scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.565428] Deleted default via 192.168.122.1 proto dhcp src 192.168.122.113 metric 100 [2026-10-13T16:22:44.566066] Deleted 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 valid_lft forever preferred_lft forever [2026-10-13T16:22:44.567151] Deleted 192.168.122.0/24 proto kernel scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.567816] Deleted broadcast 192.168.122.255 table local proto kernel scope link src 192.168.122.113 [2026-10-13T16:22:44.568545] Deleted local 192.168.122.113 table local proto kernel scope host src 192.168.122.113 [2026-10-13T16:22:44.603101] 2: eth0 inet 192.168.122.113/24 metric 100 brd 192.168.122.255 scope global eth0 valid_lft forever preferred_lft forever [2026-10-13T16:22:44.604425] local 192.168.122.113 table local proto kernel scope host src 192.168.122.113 [2026-10-13T16:22:44.605296] broadcast 192.168.122.255 table local proto kernel scope link src 192.168.122.113 [2026-10-13T16:22:44.606257] 192.168.122.0/24 proto kernel scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.607310] 192.168.122.1 proto dhcp scope link src 192.168.122.113 metric 100 [2026-10-13T16:22:44.608106] default via 192.168.122.1 proto dhcp src 192.168.122.113 metric 100 [Upstream status] Upstream later changed this area significantly. In particular: https://github.com/systemd/systemd/commit/e09b758876219de8222df798114d1d63b0323b58 This commit renamed link_drop_managed_*() to link_drop_static_*() and changed the semantics so that dynamic addresses are no longer removed by that path. issue: https://github.com/systemd/systemd/issues/36411 fix PR: https://github.com/systemd/systemd/pull/36414 This would preserve the intended LP: #2098183 fix while avoiding deletion of deserialized dynamic network configuration during systemd- networkd restart. [Question] Does Ubuntu 24.04 have any plans to fix this regression? -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2170677 Title: systemd-networkd restart drops DHCP config with KeepConfiguration=yes To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2170677/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
