RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2077605 - NetworkManager 1.36.0 loses DHCP lease and doesn't try again
Summary: NetworkManager 1.36.0 loses DHCP lease and doesn't try again
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: NetworkManager
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Fernando F. Mancera
QA Contact: Vladimir Benes
URL:
Whiteboard:
: 2077752 (view as bug list)
Depends On: 2050216 2077752
Blocks: 2077052 2090280
TreeView+ depends on / blocked
 
Reported: 2022-04-21 18:08 UTC by Stephen Benjamin
Modified: 2022-11-08 11:22 UTC (History)
13 users (show)

Fixed In Version: NetworkManager-1.39.3-1.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2090280 (view as bug list)
Environment:
Last Closed: 2022-11-08 10:10:31 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-119590 0 None None None 2022-04-21 18:14:38 UTC
Red Hat Product Errata RHBA-2022:7680 0 None None None 2022-11-08 10:10:55 UTC
freedesktop.org Gitlab NetworkManager/NetworkManager/-/commit/bf5927b978fccec1390bcc7d3d5719d7fe7c3450 0 None None None 2022-04-28 08:54:08 UTC

Description Stephen Benjamin 2022-04-21 18:08:33 UTC
In OpenShift, we rebased on RHEL 8.6 and saw failures to install with ovn-kubernetes.  Oddly, this only happens on Azure some of the time.

However,  what appears to happen after restarting NetworkManager very rapidly after getting a lease, we DHCP again but the interface never gets the IP.  The logs say "ip4: set state fail (was pending, reason: check-ip-state)" -- what is check-ip-state?

I will attach a while journal, but the timeline I've pieced together looks like this:



**** 14:00:54 Start NM

Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg configure-ovs.sh[1742]: + systemctl restart NetworkManager

**** 14:00:54 We got a DHCP lease

Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg systemd[1]: NetworkManager-wait-online.service: Succeeded.
[...]
Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2153]: <debug> [1650549654.8062] dhcp4 (eth0): option ip_address           => '10.0.128.6'

**** 14:00:54 Network Manager shut down again....

Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg systemd[1]: Stopping Network Manager...
Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2153]: <info>  [1650549654.8070] caught SIGTERM, shutting down normally.

**** 14:00:54 Starting again....

Apr 21 14:00:54 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg systemd[1]: Starting Network Manager...

**** 14:00:55 Try to DHCP again

Apr 21 14:00:55 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2753]: <debug> [1650549655.0340] dhcp4 (eth0): send REQUEST to 255.255.255.255

**** 14:00:55 Get a lease again

Apr 21 14:00:55 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2753]: <debug> [1650549655.0492] dhcp4 (eth0): option ip_address           => '10.0.128.6'

**** 14:00:55 But NetworkManager doesn't apply it to the interface

Apr 21 14:00:55 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2753]: <debug> [1650549655.0505] device[e1c2da34f52474c2] (eth0): ip:dhcp4: set state fail (was pending)
Apr 21 14:00:55 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2753]: <debug> [1650549655.0509] device[e1c2da34f52474c2] (eth0): ip4: set state fail (was pending, reason: check-ip-state)
[...]
Apr 21 14:01:15 ci-ln-v6m988k-002ac-p4b5q-worker-centralus2-r4mkg NetworkManager[2753]: <debug> [1650549675.0392] device[e1c2da34f52474c2] (eth0): ip4: required-timeout: expired

Comment 2 Stephen Benjamin 2022-04-21 18:10:49 UTC
Here's the package version we were  using:

Name 	Version 	Release/Dist 	Arch
NetworkManager 	1.36.0 	2.el8 	x86_64
NetworkManager-cloud-setup 	1.36.0 	2.el8 	x86_64
NetworkManager-libnm 	1.36.0 	2.el8 	x86_64
NetworkManager-ovs 	1.36.0 	2.el8 	x86_64
NetworkManager-team 	1.36.0 	2.el8 	x86_64
NetworkManager-tui 	1.36.0 	2.el8 	x86_64

Comment 3 Colin Walters 2022-04-21 20:33:29 UTC
Skimming things here, https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/80c9e2d9eca328ee69e9046648bb08f02e05696e may be related?

BTW, it should be possible to boot an 8.5 node, use `rpm-ostree usroverlay` and then `rpm -Uvh` on the 8.6 builds to try verifying that direction.

Comment 4 Thomas Haller 2022-04-22 05:46:56 UTC
there are two problems here.

1) when NetworkManager restarts, it leaves the interface up (so that you could restart remotely, without cutting yourself off). It also means, after restart, it currently will not add IP addresses/routes that are not there, and not delete IP adresses/routes which are unexpectedly there.

The intend is, that you shouldn't notice that NetworkManager restarted.  It also means, restarting the daemon is usually the wrong thing to do, because NetworkManager actively tries that there are not changes by doing that. It only makes sense when you update the rpm, or you change a fundamental setting in NetworkManager.conf (many settings can be reloaded without restart). In those cases, are reboot is the safe option. Of course, restart must work well, so we have a problem here that we need to fix.

In this case, the restart happened while the interface was not fully configured (at 1650549654.8070). NetworkManager doesn't remember that the IP addresses are not there, because when it restarted the profile was only half up. So after restart it assumes that the address is missing for legitimate reasons, and will not re-add it(*).

This behavior is flawed. When restarting, NetworkManager needs to take full control of the interface again, and re-configure it. That makes the restart more noticeable, but it's necessary. It's probably still a good advise: don't restart NetworkManager unless you really need to and know what you do.

This aspect is a duplicate of bug 2050216.


2) not adding the IP address (*) is a problem, because it means we can also not ACCEPT the lease. Note that after restart, NM will do DHCP, but it would not have configured the IP address. Then, accepting the lease fails (at 1650549655.0502). Even if it wouldn't fail (to accept the lease), due to problem (1) it would not configure the IP address from DHCP. The second problem here is that DHCP fails, and that NM doesn't restart it. DHCP needs to be restarted on fatal errors to retry. That is a bug, and was partly discussed on bug 2001986. Usually, you wouldn't notice, because DHCP does not fail in such a bad way.

Comment 5 Thomas Haller 2022-04-22 06:45:33 UTC
about problem 2, I opened bug 2077752.

This rhbz depends on the two mentioned bugs.

Comment 6 Colin Walters 2022-04-26 16:07:36 UTC
The `systemctl restart NetworkManager` is in https://github.com/openshift/machine-config-operator/blob/2a1e3a6e53214b6470191389ba3c0e16a5c14ee7/templates/common/_base/files/configure-ovs-network.yaml#L391
and indeed it seems likely to me it could just be `systemctl reload NetworkManager`.

Comment 7 Colin Walters 2022-04-26 16:11:40 UTC
So https://github.com/openshift/machine-config-operator/pull/2992 is a bit related to this I think but I just tossed up https://github.com/openshift/machine-config-operator/pull/3119

Comment 8 Thomas Haller 2022-04-26 16:25:06 UTC
ok,  I closed bug 2077752 as duplicate of this one. Because otherwise this rhbz had no purpose and was only waiting for the other two bugs. Also, I did it this way, because this bug has some discussion that might be important, so I'd rather not close this as a duplicate of the bug with no discussion, but the other way around).


Let's interpret this bug (bug 2077605) to be about problem 2) from comment 4.
For problem 1), please refer to bug 2050216.

Note that the bigger problem of this issue is actually bug 2050216 (not bug 2077605). So you probably want to follow up there...

Comment 9 Thomas Haller 2022-04-26 16:29:24 UTC
*** Bug 2077752 has been marked as a duplicate of this bug. ***

Comment 10 Colin Walters 2022-04-26 18:29:02 UTC
@thaller
What about having NM use its existing SIGTERM handler to block shutdown until it's reached an "idle" or stable state?

Comment 11 Thomas Haller 2022-04-26 18:58:03 UTC
(In reply to Colin Walters from comment #10)
> @thaller
> What about having NM use its existing SIGTERM handler to block shutdown
> until it's reached an "idle" or stable state?

I think that would not work.

For one, trying to get a DHCP lease could take a long time (or even indefinitely, depending on `ipv4.dhcp-timeout`). This could block shutdown indefinitely, and if you give up waiting after a timeout, you still can run into problem 1.

Also, the combined state of the device (`nmcli device`) is composed of several things, among others IPv4 and IPv6 configuration. Usually, we consider a device ready, when it reaches "activated" state. That then would for example unblock `NetworkManager-wait-online.service`). But with `ipv4.may-fail=yes`, the device can be in activated state when only IPv6 is ready, while DHCPv4 is still pending. So it would be hard to determine when all configuration (IP and other) is ready, so that some form of problem 1) doesn't happen during restart.

Comment 12 Colin Walters 2022-04-26 19:21:43 UTC
OK, I think another alternative is serializing to e.g. `/run` the state that we want to keep.

Comment 14 Vladimir Benes 2022-05-03 14:19:37 UTC
    @rhbz1086906
    @delete_testeth0 @restart_if_needed
    @wait-online-for-both-ips
    Scenario: NM - general - wait-online - for both ipv4 and ipv6
    * Prepare simulated test "testG" device
    * Add "ethernet" connection named "con_general" for device "testG" with options "ipv4.may-fail no ipv6.may-fail no"
    * Restart NM
    * Execute "/usr/bin/nm-online -s -q --timeout=30"
    When "inet .* global" is visible with command "ip a s testG"
    Then "inet6 .* global" is visible with command "ip a s testG"

tested 100 times w/o any issue with main branch copr package

Comment 23 Vladimir Benes 2022-05-24 07:28:27 UTC
We have a new test in NMCI
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1050

It randomly slows down the DHCP server and does a service restart. This covers both situations when DHCPv4 is done or not.

Comment 28 errata-xmlrpc 2022-11-08 10:10:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (NetworkManager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7680


Note You need to log in before you can comment on or make changes to this bug.