[Pkg-systemd-maintainers] Bug#739085: systemd: run update-binfmts --disable via ExecStop=

Michael Biebl biebl at debian.org
Mon Feb 17 14:01:45 GMT 2014


Am 15.02.2014 21:13, schrieb Colin Watson:
> On Sat, Feb 15, 2014 at 08:12:45PM +0100, Michael Biebl wrote:
>> I noticed that the SysV init script runs
>> update-binfmts --disable on stop
>> 
>> The systemd service doesn't though.
>> Is this difference in behaviour deliberate or should we
>> also run disable on stop in the service file?
>> 
>> This could be done via
>>
>> ExecStop=/usr/sbin/update-binfmts --disable
> 
> It's an interesting question.  If you look closely at the sysvinit
> script, you'll see that it does define a stop action, but there's no
> Default-Stop; that means you can stop it manually if you want to, but it
> doesn't slow down shutdown by doing unnecessary work.
> 
> Is there a way to achieve a similar effect with systemd?  I haven't been
> able to find one by looking through the manual pages.

Yeah, this is possible.
binfmt-support.service uses DefaultDependencies=yes (the default value).

Aside from a set of orderings and dependencies this also adds
Conflicts=shutdown.target. See

# systemctl -p Conflicts show binfmt-support.service

This ensures, whenever the shutdown.target is activated, that unit is
stopped.

If you want to see which units will be stopped if you enter the shutdown
target, run

# systemctl -p ConflictedBy show shutdown.target

By using DefaultDependencies=no, you have more fine-grained control over
which dependencies and orderings are added to your service.
Usually, that property should only be used for early boot services,
though [1].

You also need to make sure to specify your dependencies/orderings
explictly now.

Untested:

[Unit]
Description=Enable support for additional executable binary formats
Documentation=man:update-binfmts(8)
DefaultDependencies=no
After=local-fs.target proc-sys-fs-binfmt_misc.automount

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/update-binfmts --enable
ExecStop=/usr/sbin/update-binfmts --disable
Restart=no

[Install]
WantedBy=multi-user.target

> (The stop action is mostly a nicety, so if this isn't achieveable, I
> think it would be better to omit ExecStop rather than slowing down
> shutdown.)

The combination of multi-user.target and DefaultDependencies=no is a bit
odd and if it's worth adding that, I'll leave to your discretion.


I've CCed the pkg-systemd-maintainers mailing list since I think this
issue is interesting enough for a wider audience.

Regards,
Michael


[1] man 5 systemd.unit
-- 
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: 884 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20140217/7a65d94c/attachment-0002.sig>


More information about the Pkg-systemd-maintainers mailing list