[systemd-devel] starting a service before anything else....

Lennart Poettering lennart at poettering.net
Mon Jul 2 10:45:09 UTC 2018


On Mo, 02.07.18 10:50, MALET Jean-Luc (jeanluc.malet.snowsat at gmail.com) wrote:

> 
> 
> Le 28/06/2018 à 17:02, Reindl Harald a écrit :
> > Am 28.06.2018 um 16:55 schrieb MALET Jean-Luc:
> > > I'm in charge of setting up an embedded solution based on debian, so on
> > > systemd, I'm more used to old init process, that was easy to tweak
> > > because based on script... but well... times seems now on systemd.
> > > 
> > > I'm really puzzled because since the documentation seems to lack
> > > information, I have to find information on tutorials that focus only on
> > > late services..
> > > 
> > > I found on one how to find the targets using "systemctl list-units
> > > --type=target" and some diagram explaining what target are suposed to be
> > > run in what order.... but well...
> > > 
> > > my issue is that I've to run a script as early as possible, before
> > > mounts are done because lot of service will fail without , so I created
> > > a service
> > > 
> > > [Unit]
> > > Description=mount some file systems before anything and prepare the system
> > > Before=systemd-remount-fs.service
> > + DefaultDependencies=no
> ok this seems to do the trick....
> it could be nice to have some documentation that explain what are the
> DefaultDependencies.... I hate that someone choose to do something for me
> without beeing aware of it.... at least when enabling a service display it's
> Dependencies...

This is extensively documented. For example for service units, you
find this here:

https://www.freedesktop.org/software/systemd/man/systemd.service.html#Automatic%20Dependencies

For the other unit types there are similar sections in the respective
man pages.

> it's just my point of view, but for me, what isn't in the service file
> shouldn't be executed... when I ask a coffee, I don't want that charge me a
> sweet in addition....

Well, the idea is to make the common cases simple, and everything else
possible. That's why for regular service we add in deps that are
likely sufficient for most cases, and for everything else there is
DefaultDependencies=no.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list