[systemd-devel] /etc/systemd/system/default.target.wants/ no longer checked for unit files

Lennart Poettering lennart at poettering.net
Sun Jul 16 14:31:40 UTC 2017


On Fri, 14.07.17 13:24, Mantas Mikulėnas (grawity at gmail.com) wrote:

> On Fri, Jul 14, 2017 at 12:13 PM, Richard W.M. Jones <rjones at redhat.com>
> wrote:
> 
> >
> > https://github.com/systemd/systemd/issues/6334
> >
> > Since this commit
> > https://github.com/systemd/systemd/commit/2d058a87ffb2d31a50422a8aebd119
> > bbb4427244
> > (in v233 and v234), you can no longer create
> > /etc/systemd/system/default.target.wants/ and drop in service files
> > (or symlinks).  The directory is skipped.  I have reverted the commit
> > on top of systemd from git and that makes defaults.target.wants work
> > again.
> >
> > Is this supposed to work?  It worked fine since at least Fedora 18-25,
> > but it is now broken in Fedora 26.
> >
> > If it was never supposed to work, how are you supposed to enable a
> > service for the default target, even allowing for the user to change
> > the default target and still have the service enabled?
> >
> 
> The current convention is to install all regular services into
> multi-user.target, and I would expect all custom "daily use" targets to be
> superset of multi-user.target as well, like the provided graphical.target
> already is.
> 
> IMHO, don't try to second-guess the user. If they know how to create custom
> targets, they'll probably know how to look what's inside their
> multi-user.target.wants/ and deal with it.

default.target and multi-user.target are quite different:

For system services, default.target is generally an alias for either
multi-user.target or graphical.target, but can point to anything else,
too. By dropping in your deps into default.target you say "whatever
the user picks as default, even if it is emergency.target, I want my
service started".

For user services, default.target is a regular unit, and not an alias,
as there things are usually quite a bit simpler.

Do note that if the user starts his system with a special
runlevel/target specified on the kernel cmdline, default.target has no
effect, as we don't bother with it then but directly boot into the
specified name.

Hence, unless you are really really sure your stuff should be loaded
under all conditions, then default.target in system mode might be an
option. In most cases however that's not desirable, and
multi-user.target is the better place (or graphical.target, or so).

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list