[systemd-devel] Semantic of WantedBy=default.target
Silvio Knizek
killermoehre at gmx.net
Thu Aug 14 12:52:58 UTC 2025
Am Mittwoch, dem 13.08.2025 um 09:21 +0300 schrieb Andrei Borzenkov:
> On Tue, Aug 12, 2025 at 11:59 AM Silvio Knizek <[killermoehre at gmx.net](mailto:killermoehre at gmx.net)> wrote:
>
> > Am Dienstag, dem 12.08.2025 um 11:02 +0300 schrieb Andrei Borzenkov:
> >
> > I spent some time trying to understand why a service that should have been started was not. It turned out rather simple - the service was WantedBy=default.target, I explicitly used "3" on the kernel command line and this made systemd to ignore /etc/systemd/system/default.target.wants.
> >
> > Is there any reason to not treat systemd.unit as default in this case? After all, "default target" is the target that systemd starts when running as /sbin/init and passing systemd.unit is entirely equivalent to overriding default.target once at run-time.
> >
> > Hi Andrei,
> >
> > 3 on the k-c-l means "isolate into multi-user.target", not "make the multi-user.target the default.target" or "isolate into default.target".
> >
> > So your default.target was never started.
> >
>
>
> Sigh. Please explain the reason why starting multi-user.target as
> alias to defaut.target should start different services compared to
> starting multi-user.target as systemd.target on the kernel command
> line.
`multi-user.target` is *not* an alias to `default.target`. `default.target` may be an alias – a.k.a. symlink – to `multi-user.target`, `graphical.target` or any other unit.
> I know how it is implemented and why it happens. I ask whether this
> behavior is intentional and reasonable.
I, as and admin, expect that when I start `multi-user.target` (which happens if I specify `3` on the k-c-l), all the units in `multi-user.target.wants/` are started.
If I start `default.target`, I expect `default.target.wants/` and `${symlinked_unit}.wants/` to be started.
Of course, if `default.target.wants/` is pointing to `${symlinked_unit}.wants/`, than it's the same, but normally those are different directories. And therefor different behavior.
Makes absolute sense for me.
> > If you want default behaviour, don't specify anything.
> >
> > BR
> > Silvio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250814/36bc7a14/attachment.htm>
More information about the systemd-devel
mailing list