View previous topic :: View next topic |
Author |
Message |
Akaihiryuu l33t
Joined: 08 May 2003 Posts: 798 Location: Columbus, OH
|
Posted: Wed Oct 26, 2016 12:21 am Post subject: /etc/init.d/net-online weird errors |
|
|
If the net-online script tries to run during the boot process, it basically just spams really weird errors and hangs indefinitely (preventing the rc scripts from completing). Syslog is not logging the error so I can't reproduce it exactly, but it is saying invalid argument in line 59 and 60 (alternating) in /etc/init.d/net-online. These lines are
read x < /sys/class/net/$dev/carrier [ $x -eq 1 ] && : $((carriers += 1))
read x < /sys/class/net/$dev/operstate [ "$x" = up ] && : $((configured += 1))
If I have need="net-online" in ANY service in conf.d, this happens. And it will hang forever until I put it in maintenance mode, take that line out of the entry in conf.d, and restart it again. The only thing I can figure is at that point in the boot process, the entries in /sys/class/net/eth1 are not there. (I have net-online set to depend only on net-eth1.)
If I wait until everything is running, and THEN run net-online, it works fine. Something is terribly terribly broken in the startup scripts, anyone have any idea what it could be? I'm wanting to have services depend on net-online for a reason. If openrc is really this broken, I may just have to switch to systemd even though I don't like it. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Oct 26, 2016 1:03 am Post subject: |
|
|
You somehow have a broken initscript. Those should be four lines, not two:
Code: | read x < /sys/class/net/$dev/carrier
[ $x -eq 1 ] && : $((carriers += 1))
read x < /sys/class/net/$dev/operstate
[ "$x" = up ] && : $((configured += 1)) |
|
|
Back to top |
|
|
Akaihiryuu l33t
Joined: 08 May 2003 Posts: 798 Location: Columbus, OH
|
Posted: Wed Oct 26, 2016 1:42 am Post subject: |
|
|
Ant P. wrote: | You somehow have a broken initscript. Those should be four lines, not two:
Code: | read x < /sys/class/net/$dev/carrier
[ $x -eq 1 ] && : $((carriers += 1))
read x < /sys/class/net/$dev/operstate
[ "$x" = up ] && : $((configured += 1)) |
|
It actually is 4 lines, it ended up being a copy/paste problem when I pasted it here. That's what I have. |
|
Back to top |
|
|
guitou Guru
Joined: 02 Oct 2003 Posts: 534 Location: France
|
Posted: Wed Oct 26, 2016 12:07 pm Post subject: |
|
|
Hello, looking at net-online script, I think you should try and manually run some bash commands from get_interfaces function:
Code: |
for ifname in /sys/class/net/*; do
read iftype < ${ifname}/type
[ "$iftype" = "1" ] && printf "%s " ${ifname##*/}
done
|
And for each dev listed, you may then check values of /sys/class/net/$dev/carrier and /sys/class/net/$dev/operstate
This should help you identify which device gets in the loop while not yet initialized/configured (dummy?)
++
Gi) |
|
Back to top |
|
|
Akaihiryuu l33t
Joined: 08 May 2003 Posts: 798 Location: Columbus, OH
|
Posted: Wed Oct 26, 2016 3:01 pm Post subject: |
|
|
guitou wrote: | Hello, looking at net-online script, I think you should try and manually run some bash commands from get_interfaces function:
Code: |
for ifname in /sys/class/net/*; do
read iftype < ${ifname}/type
[ "$iftype" = "1" ] && printf "%s " ${ifname##*/}
done
|
And for each dev listed, you may then check values of /sys/class/net/$dev/carrier and /sys/class/net/$dev/operstate
This should help you identify which device gets in the loop while not yet initialized/configured (dummy?)
++
Gi) |
By the time I can actually access the system, they are all there. It's something that must not be getting initialized during boot time. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23055
|
Posted: Thu Oct 27, 2016 1:35 am Post subject: |
|
|
You could temporarily patch the script to have set -x before the relevant commands and set +x after them, so that bash prints each command before executing it. That would show you which commands and paths provoke the error message. As an example of the output you can get: Code: | (set -x; for a in /dev/null; do read < "$a"; done )
+ for a in /dev/null
+ read
|
|
|
Back to top |
|
|
guitou Guru
Joined: 02 Oct 2003 Posts: 534 Location: France
|
Posted: Thu Oct 27, 2016 2:18 pm Post subject: |
|
|
Hello.
My bad, except from a typo in /etc/conf.d/net-online, only eth1 should be checked indeed.
Then, as you said, matter is probably that /sys/classes/net/eth1 is not yet populated. Ans as to try and figure out why, if it does always happen, maybe you just have services with need="net-online" at a lower run level than net.eth1. Otherwise if it happened just once or is happening sometimes, it might rather be a physical connection issue (broken cable, switch, ISP...).
++
Gi) |
|
Back to top |
|
|
|