Bug 1180837 - network.service does not wait for interface during boot when DEVTIMEOUT is defined
Summary: network.service does not wait for interface during boot when DEVTIMEOUT is de...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 25
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Lukáš Nykrýn
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-10 21:47 UTC by Sven-Olof Klasson
Modified: 2017-11-20 09:55 UTC (History)
6 users (show)

Fixed In Version: initscripts-9.69-1.fc25
Clone Of:
Environment:
Last Closed: 2017-11-20 09:55:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Configuration and log files (5.29 KB, text/plain)
2015-01-10 21:47 UTC, Sven-Olof Klasson
no flags Details

Description Sven-Olof Klasson 2015-01-10 21:47:49 UTC
Created attachment 978626 [details]
Configuration and log files

Description of problem:
Sometimes a interface is not yet available when it is brought up by network.service during boot. Even if DEVTIMEOUT is defined the scripts does not wait for the interface do become available.

Version-Release number of selected component (if applicable):
initscripts-9.56.1-6.fc21.x86_64

How reproducible:
About once in 10 reboots.

Steps to Reproduce:
1. Configure the system to use network.service instead of NetworkManager
2. Define DEVTIMEOUT=5 in /etc/sysconfig/network
3. Repeatedly reboot until problem is seen.

Actual results:
Ethernet interface not brought up during boot.
Error message "Device enp1s0 does not seem to be present, delaying initialization."

Expected results:
Ethernet interfaces up after boot.

Additional info:
Configuration and log attached.

When network.service starts function is_available_wait() is called. This then calls is_available(). And if return status is 1 a loop is entered to wait for the interface. However if the interface is not yet available, and there is no "alias" in /etc/modprobe.d/*.conf, is_availble() returns 2. Thus the wait loop is not entered when needed.

This patch works for me.

--- /etc/sysconfig/network-scripts/network-functions.original
+++ /etc/sysconfig/network-scripts/network-functions
@@ -333,27 +333,27 @@
 is_available_wait ()
 {
     [ -z "$1" ] && return 1
 
     local retry=${2##*[!0-9]*}
 
     is_available $1
     ret=$?
 
-    [ 0"$ret" -ne 1 ] && return $ret
+    [ 0"$ret" -ne 2 ] && return $ret
 
     while [ 0"$retry" -gt 0 ]; do
         sleep 1
         [ -d "/sys/class/net/$1" ] && return 0
         retry=$(($retry -1))
     done
 
-    return 1
+    return 2
 }
 
 need_hostname ()
 {
     CHECK_HOSTNAME=$(hostname)
     if [ "$CHECK_HOSTNAME" = "(none)" -o "$CHECK_HOSTNAME" = "localhost" -o \
 	"$CHECK_HOSTNAME" = "localhost.localdomain" ]; then
 	return 0
     else

Comment 1 Lukáš Nykrýn 2015-01-12 11:18:22 UTC
Actually this was written specifically fro the case when is_available return 1, so that needs to stay.

So I would suggest something like:

diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 1ecbcfc..9a5e359 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -336,18 +336,16 @@ is_available_wait ()
 
     local retry=${2##*[!0-9]*}
 
-    is_available $1
+    is_available $1 && return 0
     ret=$?
 
-    [ 0"$ret" -ne 1 ] && return $ret
-
     while [ 0"$retry" -gt 0 ]; do
         sleep 1
         [ -d "/sys/class/net/$1" ] && return 0
         retry=$(($retry -1))
     done
 
-    return 1
+    return $ret
 }
 
 need_hostname ()

Comment 2 Sven-Olof Klasson 2015-01-12 16:52:15 UTC
(In reply to Lukáš Nykrýn from comment #1)

I have tested your patch and confirm it solves the problem.

Comment 3 Lukáš Nykrýn 2015-01-13 09:20:26 UTC
Thanks for testing, the patch is now in upstream and will be in next release of initscripts.

https://git.fedorahosted.org/cgit/initscripts.git/commit/?id=1f230a3d2e2733e30577c91645005801ab2c0f40

Comment 4 Fedora End Of Life 2015-11-04 15:53:44 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-12-02 07:11:25 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Robert Scheck 2016-08-31 16:49:28 UTC
Just for those (like me) who spent a lot of time with Microsoft Hyper-V and
initscripts to get up the network interface during boot (because synthetic
network interfaces are initialized with ~ 15 seconds delay): Yes, it's this
issue and RHEL 7 suffers the same problem, this is however bug #1287726 ;-)

Comment 7 David Kaspar // Dee'Kej 2016-09-01 07:58:39 UTC
Robert, thanks for bringing this up to our attention. I will reopen the BZ, so the patch from RHEL is considered for Fedora as well. However, I can't set any ETA, we are currently very busy...

Thank you for your understanding.

Comment 8 Fedora End Of Life 2017-11-16 18:36:17 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 David Kaspar // Dee'Kej 2017-11-20 09:55:45 UTC
Already fixed some time ago:
https://github.com/fedora-sysv/initscripts/commit/1f230a3d2e2733e30577c916450058


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