Bug 739338

Summary: Network.service entered failed state because of syntax error
Product: [openSUSE] openSUSE 12.1 Reporter: Marcus Husar <marcus.husar>
Component: NetworkAssignee: Marius Tomaschewski <mt>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P2 - High CC: fcrozat, marcus.husar
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: SUSE Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: The route for the IPv4 default gateway configured in yast.
The output of "route -n".
The output of "systemctl status network.service".
Parts of /var/log/messages with error messages.
Patch disabling posix mode that may be set in profile

Description Marcus Husar 2012-01-03 16:53:01 UTC
Created attachment 469567 [details]
The route for the IPv4 default gateway configured in yast.

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.16) Gecko/20111108 Iceweasel/3.5.16 (like Firefox/3.5.16)

Systemd unit network.service (/etc/init.d/network) fails to start properly because of syntax error in /etc/sysconfig/network/scripts/functions.

I’ll attach parts of logfiles, error messages, and the routing table. Please ask if more information is needed.



Reproducible: Always

Steps to Reproduce:
1. Reboot system or systemctl restart network.service
2. Look into /var/log/messages
Actual Results:  
Everything seems to be fine. The problem is that the service fails and I get lots of error messages.

Also the routing table misses an entry for the default gateway. So I have no network access. Maybe that is a consequence of this bug, but I think it is a different bug that I will file in a few minutes.

Expected Results:  
Network service starts without errors and server is online.
Comment 1 Marcus Husar 2012-01-03 16:55:40 UTC
Created attachment 469568 [details]
The output of "route -n".

There should be a row for the IPv4 default gateway. One may add it by "route add default gw xxx.xxx.133.1".
Comment 2 Marcus Husar 2012-01-03 16:57:17 UTC
Created attachment 469571 [details]
The output of "systemctl status network.service".
Comment 3 Marcus Husar 2012-01-03 16:58:17 UTC
Created attachment 469572 [details]
Parts of /var/log/messages with error messages.
Comment 4 Marcus Husar 2012-01-04 14:20:30 UTC
I found the source of the problem.

/etc/init.d/network and /etc/init.d/network-remote are started by systemd which uses /bin/sh (not /bin/bash!). But the scripts sourced by those LSB scripts have some bash only syntax.

Possible solutions:
* Rewrite the scripts in /etc/sysconfig/network/scripts/ to /bin/sh
* Allow systemd to use bash

Just source some scripts in this directory, e.g. functions, ifstatus-route, ifup-route,… out of /bin/sh. There are exactly the same syntax errors as in systemd. So systemd just runs /bin/sh.

I bet these syntax errors are causing this bug #739345, too.

Thanks for your help.
Comment 5 Frederic Crozat 2012-01-09 15:25:57 UTC
where did you found systemd is using /bin/sh ?

systemd is using execve, not a call to /bin/sh.

If /bin/sh is called somewhere, it is probably by the #! of a called script.
Comment 6 Marius Tomaschewski 2012-01-09 17:19:13 UTC
The network scripts need and always needed a bash to enable features like
support of constructs like e.g.:

     a=""
     while ... do ... a=x;... done < <(command)
     echo $a

regex matches, ... and is always using #!/bin/bash, that is used in every
network script we ship in sysconfig.

*** This bug has been marked as a duplicate of bug 587428 ***
Comment 7 Marius Tomaschewski 2012-01-09 17:25:30 UTC
*** Bug 739345 has been marked as a duplicate of this bug. ***
Comment 8 Marius Tomaschewski 2012-01-09 18:21:48 UTC
Going to add

unset POSIXLY_CORRECT ; set +o posix

at the begin of the scripts.
Comment 9 Marius Tomaschewski 2012-01-09 19:52:45 UTC
Created attachment 470335 [details]
Patch disabling posix mode that may be set in profile
Comment 10 Bernhard Wiedemann 2012-01-10 10:00:53 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/99577 12.1 / sysconfig
Comment 11 Bernhard Wiedemann 2012-01-10 11:00:33 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/99585 12.1 / sysconfig
Comment 12 Bernhard Wiedemann 2012-01-10 12:00:23 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/99593 11.4 / sysconfig
https://build.opensuse.org/request/show/99595 11.3 / sysconfig
Comment 13 Marius Tomaschewski 2012-01-10 12:51:16 UTC
fixed & submitted.
Comment 14 Bernhard Wiedemann 2012-02-15 20:00:24 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/105293 Factory / sysconfig
Comment 15 Bernhard Wiedemann 2012-02-17 22:00:58 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/105749 Evergreen:11.2 / sysconfig
Comment 16 Bernhard Wiedemann 2012-02-22 13:00:31 UTC
This is an autogenerated message for OBS integration:
This bug (739338) was mentioned in
https://build.opensuse.org/request/show/106448 Evergreen:11.2 / sysconfig