Bug 66616

Summary: swap.target in sysinit.target with After
Product: systemd Reporter: Harald Hoyer <harald>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTABUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Harald Hoyer 2013-07-05 11:17:15 UTC
I removed "After=swap.target" from sysinit.target:

# systemd-delta 
[...]

[OVERRIDDEN] /etc/systemd/system/sysinit.target → /usr/lib/systemd/system/sysinit.target

--- /usr/lib/systemd/system/sysinit.target      2013-07-05 13:13:24.934943143 +0200
+++ /etc/systemd/system/sysinit.target  2013-07-05 11:01:50.829617792 +0200
@@ -10,5 +10,5 @@
 Documentation=man:systemd.special(7)
 Conflicts=emergency.service emergency.target
 Wants=local-fs.target swap.target
-After=local-fs.target swap.target emergency.service emergency.target
+After=local-fs.target emergency.service emergency.target
 RefuseManualStart=yes

[...]
# fgrep -r swap.target /lib/systemd/system /etc/systemd/system /run/systemd/
/lib/systemd/system/sysinit.target:Wants=local-fs.target swap.target
/lib/systemd/system/sysinit.target:After=local-fs.target swap.target emergency.service emergency.target
/etc/systemd/system/sysinit.target:Wants=local-fs.target swap.target
/run/systemd/generator/dev-disk-by\x2duuid-0a5847a8\x2d358d\x2d454f\x2dab98\x2d8592de5ca4ba.swap:Before=swap.target


BUT:

# systemctl show sysinit.target| fgrep swap.target
Wants=local-fs.target swap.target [...]
After=local-fs.target [...] swap.target [...]

It is still there! How come?
Comment 1 Lennart Poettering 2013-09-12 17:43:48 UTC
If DefaultDependencies= is on then all target units which have a wants= to another unit will get an after= to it as well, unless it already has a before=.

This is done so that it is sufficient to symlink a unit into a .wants/ directory of a target to get both an After= and a Wants= symlink.

To get rid of the After= set DEfaultDependencies=no in either of the targets (or set Before=).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.