[systemd-devel] multi-user.target only wants network.service if I'm doing 'systemct show runlevel3.target'

Lennart Poettering lennart at poettering.net
Tue Feb 3 16:29:11 PST 2015


On Thu, 25.12.14 08:37, Andrei Borzenkov (arvidjaar at gmail.com) wrote:

> This looks like fallout of moving to generators for sysv units. Before
> systemd added dependencies on runlevelX.target directly to units built
> from initscripts. This forced runlevelX.target resolution and
> everything was OK. Now core systemd never references these targets
> directly.
> 
> This is a genuine bug which will bite people. But it looks like worked
> just by accident before anyway :( So we need possibility to define
> aliases for existing units without exhaustive search across all unit
> definitions ... may be unit.alias.d?

This is a real shortcoming of the current logic in systemd, indeed.

So, one possible way out of this might be add a .wants/ dep from
multi-user.target.wants/ to runlevel3.target, if runlevel3.target is
linked to that. THis would cause runlevel3.target to be loaded, which
would then detect the symlink and merge it into
multi-user.target. After loading it would try to create the .wants
link, but recognize that it is now trying to create a .wants link on
itself, and suppress it.

These extra .wants symlinks could even be generated dynamically from
sysv-generator, so that people can easily override the runlevel
mappings by placing a symlink in /etc, without having to manually also
add the .wants/ link at the same time...

It's a bit ugly, and feels a bit hackish, but should work. 

Another option would be to actually add expose the internal dependency
type "References" to the outside. It's only purpose is to act as
reference for the GC logic, thus ensuring that its target is
loaded. 

I am kinda leaning towards the sysv-generator option. 

Happy to take a patch if anybody wants to hack this up...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list