Need help with converting growroot to a systemd service

Lennart Poettering mzerqung at 0pointer.de
Mon Aug 11 14:42:44 UTC 2014


On Mon, 11.08.14 16:25, Juerg Haefliger (juergh at gmail.com) wrote:

> On Mon, Aug 11, 20
> > > [Unit]
> > > Description=Grow the root partition
> > > After=systemd-readahead-collect.service systemd-readahead-replay.service
> > > Before=systemd-fsck at .service sysroot.mount
> >
> > This will not work. "systemd-fsck at .service" is is not a unit name (but
> > just a template for unit names), and dependencies may only be declared
> > relative to other units, never to templates. (I admit though that this
> > might be useful to have, but then again, I am not sure how we could
> > implement this nicely...).
> >
> > My recommendation would be to add a dropin file
> > systemd-fsck at .service/foobar.conf or so, which adds the reverse
> > dependency of the one you are looking for. Or in other words: extend the
> > systemd-fsck at .service definition, instead of your growroot.service
> definition.
> 
> Are you saying I should replace the existing systemd-fsck at .service file
> with my own version or what exactly do you mean by 'extending'?

You can extend any unit file in systemd by creating a subdir in
/etc/systemd/system/ named after the unit, but suffixed with ".d", and
then dropping a .conf file in there. Files like this will be read after
the main unit file has been read and its settings can hence override or
extend the settings from the main unit file. For instance units systemd
will look for both the .d/ directory of the instance and of the template.

Hence:

  mkdir -p /etc/systemd/system/systemd-fsck at .service.d
  echo "..." > /etc/systemd/system/systemd-fsck at .service.d/foobar.conf
  systemctl daemon-reload

Allows you to extend the definitions in systemd-fsck at .service by your
own settings.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the devel mailing list