[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#904558: What should happen when maintscripts fail to restart a service



On Tue, Oct 09, 2018 at 10:52:15AM +0200, Wouter Verhelst wrote:
> - The policy-rc.d interface could be extended to allow it to signal a
>   "restart, but do not fail on error" kind of policy. This would work
>   for the "we have thousands of desktops and don't care about a service
>   failing to restart" kind of enviromnent.

Wanting to investigate this a bit further, I find that, actually, such a
possibility already exists.

According to "man invoke-rc.d", policy-rc.d can exit with exit state 106
and provide a number of actions on stdout. These are then actions that
invoke-rc.d must try in order "until one of them succeeds". As such, a
policy-rc.d implementation written like so:

#!/bin/sh

if [ "$1" != ssh ]
then
	exit 0
fi
echo "$2 stop"
exit 106

would result in the system attempting whatever init script action was
being asked for, followed by a "stop" action (except in the case of the
"ssh" service, which must not fail before we close a shell, ever). This
assumes that a "stop" action when the daemon fails to start will be
successful; I don't know whether all init scripts in Debian act that
way, but I do think that they should. If they do, then this will cause
mean that init scripts which fail will not cause general packaging
unhappiness.

With that background, IMHO the proper reply to this question before the
committee is that yes, postinst scripts should fail when an init script
fails, but we should also better document the policy-rc.d interface to
point out that the above is possible and can be done where it makes
sense. If long-time Debian Developers (not just me, but also the members
of the committee) do not know well how it works, then clearly it is
underdocumented!

(Having said that, I haven't tested any of this, so it is certainly
possible that the implementation does not match the documentation...)

-- 
Could you people please use IRC like normal people?!?

  -- Amaya Rodrigo Sastre, trying to quiet down the buzz in the DebConf 2008
     Hacklab


Reply to: