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

arvidjaar at gmail.com arvidjaar at gmail.com
Wed Dec 24 22:26:25 PST 2014



Отправлено с iPhone

> 11 дек. 2014 г., в 15:27, Francis Moreau <francis.moro at gmail.com> написал(а):
> 
>> On 12/10/2014 10:19 AM, Francis Moreau wrote:
>> Hello,
>> 
>>> On 12/10/2014 07:23 AM, Ivan Shapovalov wrote:
>>>> On Tuesday 09 December 2014 at 17:25:48, Francis Moreau wrote:    
>>>> Hello Lennart,
>>>> 
>>>> Thanks for answering !
>>>> 
>>>>> On 12/09/2014 02:10 PM, Lennart Poettering wrote:
>>>>>> On Tue, 09.12.14 11:19, Francis Moreau (francis.moro at gmail.com) wrote:
>>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> I've a very weird behaviour with systemd 217:
>>>>>> 
>>>>>> # systemctl show -p Wants multi-user.target | grep network.service
>>>>>> # systemctl show -p Wants runlevel3.target | grep network.service
>>>>>> Wants= ... network.service ...
>>>>>> # systemctl show -p Wants multi-user.target | grep network.service
>>>>>> Wants=... network.service ...
>>>>>> 
>>>>>> So basically the network.service is not part of the multi-user target
>>>>>> dependencies. But if I'm showing the state of the runlevel3 target, the
>>>>>> network service magically becomes a dep of multi-user.target.
>>>>>> 
>>>>>> The network.service is an sysv service which is started by rc[345].d and
>>>>>> has in its LSB:
>>>>>> 
>>>>>> Provide: $network
>>>>>> 
>>>>>> Could anybody clarify what I'm facing ?
>>>>> 
>>>>> systemd lazy loads services from the file system as they are
>>>>> referenced. This includes symlinked aliases, which are only loaded when
>>>>> a unit is referenced by that specific name.
>>>> 
>>>> Sorry but I don't really understand.
>>>> 
>>>> Do you mean that the network.service wasn't loaded although the
>>>> runlevel3.target, which is an alias for multi-user target (default
>>>> target) wants it ?
>>>> 
>>>> I would be glad if you could enlight me because I'm confused.
>>> 
>>> Apparently, network.service gets pulled in only via runlevel3.target, i. e.
>>> there is a symlink of kind
>>> 
>>> /{etc,usr/lib,run}/systemd/system/runlevel3.target.wants/network.service -> network.service
>>> 
>>> That is, the Wants= dependency is generated for runlevel3.target only, not for
>>> multi-user.target.
>>> 
>>> And, because systemd loads units lazily, systemd does not know about runlevel3.target
>>> (and its dependencies) before anything forces systemd to load that unit.
>>> 
>>> After you issue `systemctl show runlevel3.target`, systemd loads that unit,
>>> loads its dependencies and merges them to multi-user.target (because runlevel3.target
>>> is an alias for multi-user.target).
>> 
>> That helps, thanks !
>> 
>> However that seems a bit weird to have a target with 'hidden'
>> dependencies that can appears magically when poking another one, at
>> least from my point of (user) view.
>> 
>> Was the lazy load mechanism integrated recently ? I'm asking because
>> systemd 208 doesn't show the same behaviour.
>> 
>> What's the recommanded way to make sure that the Wants= dependencies
>> generated for runlevel3 target get pplied as soon as possible to its
>> alias target 'multi-user' ?
> 
> Could anybody enlight me because I actually don't know how I'm supposed
> to start all services that runlevel3 would start otherwise. Should I add
> manually a "Wants=</etc/rd.d/rc3/S*>" dependency in the multi-user target ?
> 

Workaround would be to set default.target to runlevel3.target (or 5). This will trigger everything mult-user normally does in addition to direct dependencies. 

But in general aliasing via symlinks looks problematic enough.

> Thanks.
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list