[systemd-devel] What unit file should I depend on?

Lennart Poettering lennart at poettering.net
Wed Feb 1 10:13:44 PST 2012


On Wed, 01.02.12 03:40, Manuel Amador (rudd-o at rudd-o.com) wrote:

> Thanks for the info.
> 
> What I mean to do is create a unit file that, dropped in, will automatically 
> run on boot without having to enable anything.  Let's be specific:
> 
> [Unit]
> Blah blah blah
> After=cryptsetup.target fedora-storage-init-late.service local-fs.target
> WantedBy=local-fs.target

So, this is supposed to be run in the early boot phase? You need to
DefaultDependencies=no in that case because otherwise you automatically
gain an ordering dependency on basic.target, and are thus started during
the normal boot phase only.

> In other words:
> 
> - I want local-fs.target to "pull in" my unit without having to touch local-
> fs.target to add a Requires= dependency,

Add a local-fs.target.wants/ symlink for your unit.

> - I don't want the local-fs.target to be "reached" until my own unit is done 
> mounting filesystems,

The order it before local-fs.target, with Before=local-fs.target

> - I don't want my unit file to execute before the late block device 
> initialization is done,

Devices show up as they are made available as they are found. There is
no point in time where "all block devices" have been found. Services
which assume such a point in time exists are broken.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list