Bug#768178: systemd: sysvinit wrapper breaks newly-installed services

Michael Biebl biebl at debian.org
Wed Nov 5 18:31:32 GMT 2014


Am 05.11.2014 um 19:05 schrieb Ximin Luo:
> Package: systemd
> Version: 215-5+b1
> Severity: important
> 
> Hi, systemd is breaking unrelated software and preventing it from starting normally:

Well, the title of this bug report is misleading and wrong. I'll try to
explain what you're encountering.

> (Results below are the same if you call /etc/init.d/fp-facilitator directly, instead of "service fp-facilitator")
> 
> $ sudo aptitude install flashproxy-facilitator 
> [..]
> Setting up flashproxy-facilitator (1.7-1) ...

Since flashproxy-facilitator uses "invoke-rc.d flashproxy-facilitator
start" in postinst, the state of the service is "active (exited)" at
this point.

The default for sysv init scripts is RemainAfterExit=true [0], so even
if there are no running processes, the service is marked as active.
This is because systemd doesn't know, if the sysv init script is
supposed to start a long running process or a just some one shot commands.


> # configure the settings so things can work
> $ sudo sed -i -e 's/RUN_DAEMON="no"/RUN_DAEMON="yes"/g' /etc/default/fp-facilitator 
> $ sudo sed -i -e 's/^#\(.*\)websocket\(.*\)/\1websocket\2/g' /etc/flashproxy/facilitator-relays

> # now try starting the service
> $ sudo service fp-facilitator start

If the service is already considered active, a start will be no-op.

You'll need service fp-facilitator restart here (or stop + start, which
is the equivalent).

> $ sudo service fp-facilitator status
> ● fp-facilitator.service - LSB: Flash proxy facilitator
> [..]
>    Active: active (exited) since Wed 2014-11-05 17:56:58 GMT; 34s ago
> [..]
> Nov 05 17:56:58 pdeb2 fp-facilitator[19028]: Not starting Flash proxy facilitator (Disabled in /etc/default/fp-facilitator)..

> $ head -n2 /etc/default/fp-facilitator 
> # Change to "yes" to run the service.
> RUN_DAEMON="yes"
> 
> # Why isn't this working? Things worked perfectly fine with sysvinit.
> 
> $ sudo service fp-facilitator stop
> $ sudo service fp-facilitator start
> $ sudo service fp-facilitator status
> ● fp-facilitator.service - LSB: Flash proxy facilitator
> [..]
>    Active: active (running) since Wed 2014-11-05 17:57:46 GMT; 1s ago
> [..]
> 
> # Now it works? But I didn't change anything!

You did something different. You used "service fp-facilitator stop"
before starting the service. This will explicitly mark the service as
"inactive (dead)".

> This is very weird behaviour. I get that "sometimes it's the script's fault", but in /etc/init.d/fp-facilitator I source DEFAULTSFILE almost immediately, so RUN_DAEMON should be checked. Perhaps the systemctl redirector stuff is clobbering these variables?

systemd doesn't clobber any variables. The problem here is, that the
service is considered active, even though it isn't really, since it has
been neutered via the ENABLE flag. Therefore, such ENABLE or RUN_DAEMON
flags in /etc/default/ should be avoided.

A few recommendations
- Avoid such ENABLE flags in /etc/default/<service>
- Ship a native .service file to explicitly tell systemd about the type
of service [1] so it can track it more reliably.
- Iif you want to stick with sysv init scripts but tell systemd that the
sysv init script runs a long running process, add a
# pidfile: /var/run/foo.pid
pseudo header.


Does that clarify things?


Michael

[0]
http://www.freedesktop.org/software/systemd/man/systemd.service.html#RemainAfterExit=
[1]
http://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

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


More information about the Pkg-systemd-maintainers mailing list