Bug 710502

Summary: NM-wait-online.service does not wait for link up
Product: [Fedora] Fedora Reporter: Michal Schmidt <mschmidt>
Component: NetworkManagerAssignee: Dan Williams <dcbw>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 15CC: dcbw, igeorgex, jklimes, johannbg, jturner, lpoetter, metherid, mschmidt, notting, plautrba, tilmann
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: NetworkManager-0.8.9997-4.git20110620.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 703852 Environment:
Last Closed: 2011-06-24 03:55:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
modified NetworkManager-wait-online.service
none
[PATCH] systemd: fix NetworkManager-wait-online.service to wait for link up none

Description Michal Schmidt 2011-06-03 15:06:04 UTC
+++ This bug was initially created as a clone of Bug #703852 +++
[...]

NetworkManager-wait-online.service is not working as expected. It quits
immediately with a failure:

[   21.703189] systemd[1]: Job NetworkManager.service/start finished, result=done
[   21.706765] systemd[1]: About to execute: /usr/bin/nm-online -q -x --timeout=30
[   21.723075] systemd[1]: Forked /usr/bin/nm-online as 814
[   21.726549] systemd[1]: NetworkManager-wait-online.service changed dead -> start
[   21.865662] r8169 0000:02:00.0: em1: link down
[   21.868962] r8169 0000:02:00.0: em1: link down
[   21.872380] ADDRCONF(NETDEV_UP): em1: link is not ready
[   22.011777] systemd[1]: Got D-Bus request: org.freedesktop.DBus.NameOwnerChanged() on /org/freedesktop/DBus
[   22.016442] systemd[1]: Received SIGCHLD from PID 814 (nm-online).
[   22.019876] systemd[1]: Got SIGCHLD for process 814 (nm-online)
[   22.023156] systemd[1]: Child 814 died (code=exited, status=1/FAILURE)
[   22.026386] systemd[1]: Child 814 belongs to NetworkManager-wait-online.service
[   22.029609] systemd[1]: NetworkManager-wait-online.service: main process exited, code=exited, status=1


   The link is not ready yet, therefore NM is not connecting. "-x" was
   passed to nm-online, so it quits.
   That's why the original NM initscript did something similar to:
ExecStart=/bin/sh -c 'nm-online -q --timeout=10 || nm-online -q -x --timeout=30'
   (which is what I originally proposed for NetworkManager-wait-online.service)

Comment 1 Michal Schmidt 2011-06-03 15:09:23 UTC
The "-x" parameter was added to the service in 1:0.8.9997-1.git20110531.fc15

Comment 2 Bill Nottingham 2011-06-03 15:56:47 UTC
The '-x' is to make sure it doesn't spin excessively if NM isn't running at all - having the above wait 10 seconds seems like overkill.

Comment 3 Michal Schmidt 2011-06-03 16:34:15 UTC
(In reply to comment #2)
> The '-x' is to make sure it doesn't spin excessively if NM isn't running at all

Wouldn't that be a misconfiguration?
Would adding Requisite=NetworkManager.service to the unit file do the right thing?

Comment 4 Bill Nottingham 2011-06-03 18:17:56 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > The '-x' is to make sure it doesn't spin excessively if NM isn't running at all
> 
> Wouldn't that be a misconfiguration?

Perhaps, but I think you want enable/disable of NetworkManager.service to cause NM-wait-online.service to do the right thing. For example...

> Would adding Requisite=NetworkManager.service to the unit file do the right
> thing?

No, because that would fail the transaction entirely if the admin disabled NM, but not NM-wait-online.

Comment 5 Michal Schmidt 2011-06-04 20:13:20 UTC
Created attachment 503013 [details]
modified NetworkManager-wait-online.service

(In reply to comment #4)
> (In reply to comment #3)
> > Would adding Requisite=NetworkManager.service to the unit file do the right
> > thing?
> 
> No, because that would fail the transaction entirely if the admin disabled NM,
> but not NM-wait-online.

In my testing it works fine.
I removed the '-x', and added 'Requisite=NetworkManager.service'.
Then tested with the intentionally wrong configuration:
  chkconfig network on
  systemctl enable NetworkManager-wait-online.service
  systemctl disable NetworkManager.service
  reboot

The system boots without any trouble. In the debug log I can see NM-wait-online failing as expected and everything else is happy:

...
[    2.274090] systemd[1]: Installed new job network.service/start as 82
[    2.274093] systemd[1]: Installed new job network.target/start as 83
[    2.274096] systemd[1]: Installed new job NetworkManager-wait-online.service/start as 84
[    2.274099] systemd[1]: Installed new job NetworkManager.service/verify-active as 85
...
[    3.202838] systemd[1]: Job NetworkManager.service/verify-active finished, result=skipped
[    3.202865] systemd[1]: Job NetworkManager-wait-online.service/start finished, result=dependency
[    3.202890] systemd[1]: Job NetworkManager-wait-online.service/start failed with result 'dependency'.
...
[    3.224272] systemd[1]: About to execute: /etc/rc.d/init.d/network start
[    3.231816] systemd[1]: Forked /etc/rc.d/init.d/network as 430
[    3.232588] systemd[1]: network.service changed dead -> start
...
[    7.510302] systemd[1]: network.service changed start -> running
[    7.510336] systemd[1]: Job network.service/start finished, result=done
[    7.517202] systemd[1]: network.target changed dead -> active
[    7.517212] systemd[1]: Job network.target/start finished, result=done

Comment 6 Michal Schmidt 2011-06-14 09:09:37 UTC
Bill, after reading the previous comment, do you still have any objections to the proposed change in NetworkManager-wait-online.service?

Comment 7 Bill Nottingham 2011-06-14 18:15:15 UTC
No.

Comment 8 Michal Schmidt 2011-06-17 07:26:31 UTC
Created attachment 505199 [details]
[PATCH] systemd: fix NetworkManager-wait-online.service to wait for  link up

Dan, please apply the attached patch. Thanks.

Comment 9 Jirka Klimes 2011-06-17 12:06:33 UTC
Pushed: ffbb7df4b85c68aafe4578750a1f78fc9d734fb8
Thanks!

Comment 10 Fedora Update System 2011-06-21 01:07:46 UTC
NetworkManager-0.8.9997-4.git20110620.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/NetworkManager-0.8.9997-4.git20110620.fc15

Comment 11 Fedora Update System 2011-06-21 23:53:18 UTC
Package NetworkManager-0.8.9997-4.git20110620.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing NetworkManager-0.8.9997-4.git20110620.fc15'
as soon as you are able to, then reboot.
Please go to the following url:
https://admin.fedoraproject.org/updates/NetworkManager-0.8.9997-4.git20110620.fc15
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2011-06-24 03:55:31 UTC
NetworkManager-0.8.9997-4.git20110620.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.