Bug 789421

Summary: Two dependencies wrong between systemd units (IMHO)
Product: [openSUSE] openSUSE Tumbleweed Reporter: Dr. Werner Fink <werner>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: 13.1 Milestone 1   
Target Milestone: ---   
Hardware: All   
OS: SUSE Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Dr. Werner Fink 2012-11-13 16:55:33 UTC
During debuging insserv with dbus call to systemd I've detected two
dependencies which cold be wrong:

a) in /lib/systemd/system/localfs.service the line

       After=local-fs.target

   should be

       Before=local-fs.target

   as the target `local-fs.target' is similar to `$local_fs' from LSB

b) the insserv soriting algorithm shows

       insserv: There is a loop between service NetworkManager and NetworkManager-wait-online if started

   and indeed running

       systemctl dot | grep -i network | less

   shows:

       "network.target"->"NetworkManager-wait-online.service" [color="darkgrey"];
       "NetworkManager-wait-online.service"->"network.target" [color="darkgrey"];
Comment 1 Frederic Crozat 2012-11-15 16:04:49 UTC
a) localfs.service is a dummy service written to "hide" boot.localfs initscript (since this job is handled by systemd itself). But if we put Before=local-fs.target in it, initscripts which have a dependency on boot.localfs (such as boot.cycle, boot.dmraid) could be called by systemd before local-fs.target is reached, ie before all mount points needed to have "local-fs" are started properly.

b) I've just checked upstream .service for NetworkManager and we are missing "Before=network.target" in NetworkManager.service
Comment 2 Dr. Werner Fink 2012-11-21 09:29:42 UTC
(In reply to comment #1)

> a) localfs.service is a dummy service written to "hide" boot.localfs initscript
> (since this job is handled by systemd itself). But if we put
> Before=local-fs.target in it, initscripts which have a dependency on
> boot.localfs (such as boot.cycle, boot.dmraid) could be called by systemd
> before local-fs.target is reached, ie before all mount points needed to have
> "local-fs" are started properly.

Does this mean that systemd is ignoring

 # X-Start-Before:    boot.localfs

of the boot.dmraid script and the

 # Required-Start:    boot.localfs

of the boot.cycle script?     Within SysV and insserv the two lines caused an indirect dependency that is that $local_fs aka local-fs.target enclose not only the boot.localfs and optional the boot.crypto but also boot.dmraid and boot.cycle.
Comment 3 Bernhard Wiedemann 2012-11-23 13:00:33 UTC
This is an autogenerated message for OBS integration:
This bug (789421) was mentioned in
https://build.opensuse.org/request/show/142583 Factory / insserv
Comment 4 Bernhard Wiedemann 2012-11-23 15:00:13 UTC
This is an autogenerated message for OBS integration:
This bug (789421) was mentioned in
https://build.opensuse.org/request/show/142598 Factory / insserv
Comment 5 Bernhard Wiedemann 2012-11-26 16:00:23 UTC
This is an autogenerated message for OBS integration:
This bug (789421) was mentioned in
https://build.opensuse.org/request/show/142923 Factory / insserv
Comment 6 Frederic Crozat 2012-11-26 16:29:39 UTC
(In reply to comment #2)

> Does this mean that systemd is ignoring
> 
>  # X-Start-Before:    boot.localfs
> 
> of the boot.dmraid script 

No, boot.dmraid is correctly ordered :
systemctl show dmraid.service | grep Before

Before=local-fs-pre.target localfs.service lvm.service

> and the
> 
>  # Required-Start:    boot.localfs
> 
> of the boot.cycle script?  

systemctl show cycle.service | grep After
After=localfs.service loadmodules.service systemd-journald.socket

(and since localfs.service is after local-fs.target, we are safe)

> Within SysV and insserv the two lines caused an
> indirect dependency that is that $local_fs aka local-fs.target enclose not only
> the boot.localfs and optional the boot.crypto but also boot.dmraid and
> boot.cycle.

I changed insserv parsing code in systemd to always ignore boot.crypto and boot.localfs when parsing insserv.conf because they are handled "internally" by systemd (and were causing errors in systemd output).
Comment 7 Dr. Werner Fink 2012-11-27 13:19:42 UTC
... and I've remapped the local-fs.target aka the `$local_fs' facility for the localfs.service aka boot.localfs from After to Before to have a correct order chain for localfs in insserv.  This seems to work.

If the NetworkManager dependency rules is corrected now we may close this bug as fixed. Do you agree?
Comment 8 Frederic Crozat 2012-11-28 12:17:14 UTC
(In reply to comment #7)

> If the NetworkManager dependency rules is corrected now we may close this bug
> as fixed. Do you agree?

let me fix this one first :)
Comment 9 Frederic Crozat 2012-12-07 08:35:11 UTC
fix for NetworkManager pushed as sr#144435
Comment 10 Bernhard Wiedemann 2012-12-07 09:00:09 UTC
This is an autogenerated message for OBS integration:
This bug (789421) was mentioned in
https://build.opensuse.org/request/show/144476 Factory / NetworkManager