Bug#964967: systemd: ExecStartPost executed even if ExecStart fails immediately

Michael Biebl biebl at debian.org
Mon Jul 13 16:49:18 BST 2020


Am 13.07.20 um 17:04 schrieb Drexl Johannes:
> Package: systemd
> Version: 241-7~deb10u4
> Severity: normal
> 
> Dear Maintainer,
> 
> tests on systemd environment variables under certain conditions got me puzzled,
> and I guess this would be considered a bug.
> 
> A systemd service will execute all ExecStartPost statements, even if the 
> corresponding service configured with ExecStart has bailed out with error code.
> One can test it with a [Service] section like that:
> 
> Type=exec

If you want this behaviour, use Type=oneshot, not Type=exec
See man systemd.service
>            •   The exec type is similar to simple, but the service manager will consider the unit started immediately after the main service binary has been executed. The service manager will delay starting of follow-up units until that point. (Or in other
>                words: simple proceeds with further jobs right after fork() returns, while exec will not proceed before both fork() and execve() in the service process succeeded.) Note that this means systemctl start command lines for exec services will report
>                failure when the service's binary cannot be invoked successfully (for example because the selected User= doesn't exist, or the service binary is missing).

Afaics, everything is working as documented

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20200713/7415529f/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list