[systemd-devel] unit's configuration directory

Colin Guthrie gmane at colin.guthr.ie
Sun Dec 29 04:46:30 PST 2013


'Twas brillig, and dE at 29/12/13 08:29 did gyre and gimble:
> Hi!
> 
> I was reading systemd.unit man which states --
> 
> |/etc/systemd/system
> 
> As a directory for unit configuration, or something similar to conf.d
> 
> But in Fedora, this directory just contains symlinks to other units
> (.service and .target) and empty directories --
> 
> .                                   default.target          
> multi-user.target.wants      syslog.service
> ..                                  default.target.wants    
> printer.target.wants         system-update.target.wants
> bluetooth.target.wants              display-manager.service 
> sockets.target.wants
> dbus-org.bluez.service              getty.target.wants      
> spice-vdagentd.target.wants
> dbus-org.freedesktop.Avahi.service  graphical.target.wants  
> sysinit.target.wants
> 
> Making me suspicious of this directory.

These directories *are* configuration!! The *.wants/ folders are
indicate when units are "enabled". e.g. if a unit's [Install] section
says "WantedBy=multi-user.targer" then when the unit is enabled, a
symlink to it will be placed in
/etc/systemd/system/mutli-unit.target.wants/. This is how the "it is
enabled" information is actually stored.

Likewise if the unit has a "Alias=dbus-org.bluez.service" in it's
[Install] section then enabling that unit will create the symlink
/etc/systemd/system/dbus-org.bluez.service to the unit.

> So where can I get documentation of unit configuration?

Not really sure what you mean here. Unit files can be copied from
/usr/lib/systemd/system/foo.service to /etc/systemd/system/foo.service
to override the package provided version, or (preferably) you can create
a /etc/systemd/system/foo.service.d/ folder and drop in *.conf files to
override/extend specific parts of a unit (this sort of replaces the
/etc/sysconfig/foo files of old).

All this is described in the systemd.unit man page, with the drop-in
stuff specifically referenced as follows:

       Along with a unit file foo.service, the directory foo.service.wants/
       may exist. All unit files symlinked from such a directory are
       implicitly added as dependencies of type Wanted= to the unit. This is
       useful to hook units into the start-up of other units, without having
       to modify their unit files. For details about the semantics of
Wanted=,
       see below. The preferred way to create symlinks in the .wants/
       directory of a unit file is with the enable command of the
systemctl(1)
       tool which reads information from the [Install] section of unit files
       (see below). A similar functionality exists for Requires= type
       dependencies as well, the directory suffix is .requires/ in this
case.


HTHs.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list