[systemd-devel] systemd-journald, syslog.socket and service activation

Andrei Borzenkov arvidjaar at gmail.com
Thu Jul 2 14:44:51 UTC 2020


02.07.2020 16:09, Thomas HUMMEL пишет:
> 
> [Unit]
> Requires=syslog.socket
> 
> [Install]
> ;Alias=syslog.service
> 
...
> 
> # systemctl start rsyslog
> A dependency job for rsyslog.service failed. See 'journalctl -xe' for
> details.
> 
> BUT rsyslog service (and daemon) are actually running:
> 
>    Active: active (running) since Thu 2020-07-02 14:45:37 CEST; 2min 10s
> ago
> 
...
> Question 1:
> ------------
>  How is it that despite a Requires= not satisfied the service is run
> (and that this behavior is different at boot time) ?

This is common misunderstanding. Dependencies are between jobs, not
between units. Requires means systemd will submit additional job for
dependent unit - nothing more nothing less. Unless systemd is also told
to wait for result of this additional job, both are started in parallel
and failure of dependent job does not affect other unit in any way.

I'm yet to see use case where Requires without After makes sense to
justify this implementation.

> 
> Question 2:
> -----------
> 
> Where (is it hard coded) can I get the info telling me that
> syslog.socket unit can socket-activate the syslog.service (hence the
> need of the Alias I guess) ?

By default foo.socket activates foo.service. This is actually documented
in "man systemd.socket".

> 
> Question 3:
> ------------
> 
> I can also issue, right after boot several systemctl start rsyslog
> command. The first few ones will print the 'A dependency job for
> rsyslog.service failed. See 'journalctl -xe' for details.' message, but
> ultimately, the last one will launch rsyslog service without any message :
> 
> # systemctl start rsyslog
> A dependency job for rsyslog.service failed. See 'journalctl -xe' for
> details.
> # systemctl start rsyslog
> A dependency job for rsyslog.service failed. See 'journalctl -xe' for
> details.
> # systemctl start rsyslog
> A dependency job for rsyslog.service failed. See 'journalctl -xe' for
> details.
> # systemctl start rsyslog
> A dependency job for rsyslog.service failed. See 'journalctl -xe' for
> details.
> # systemctl start rsyslog
> #
> 
> rsyslog service will end up running but still no syslog journald socket
> (which seems normal considering the dependency but weird as I did not
> have any message about it at the last start command)
> 
> # ls -l /run/systemd/journal/syslog
> ls: cannot access '/run/systemd/journal/syslog': No such file or directory
> 
> 
> What am I missing ?
> 
> Note: rsyslog service is of Type notify and has a Restart value of no-fail
> 
> Thanks for your help
> 
> -- 
> Thomas HUMMEL
> 
> 
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list