DOKK / manpages / debian 12 / policy-rcd-declarative / policy-rc.d-declarative.8.en
POLICY-RC.D-DECLARATIVE(8) POLICY-RC.D-DECLARATIVE(8)

policy-rc.d-declarative - define system service policies declaratively

policy-rc.d

Debian policy states that packages providing system services need to start those services by default, and that the starting of the service should be done by way of the /usr/sbin/invoke-rc.d script. This script will execute a program /usr/sbin/policy-rc.d if it exists, allowing the local system administrator to override behaviour if wanted by creating a policy script according to the interface specified and installing it as /usr/sbin/policy-rc.d.

This interface, however, has some downsides:

  • While the definition of the policy-rc.d interface specifies that policy scripts should be installed by way of the alternatives system, there are various cases (e.g., the initial installation of Debian from the Debian installer) where installing a policy script is desirable before the alternatives system is available for use. The result is that the installer creates a policy-rc.d script without going through the alternatives system, which it then removes at the end of the installation. A side effect of this is that any creation of a policy script in the installer will be blown away at the end of an installation.

    As a result of this, at least one derivative distribution believed they were installing a policy script into all their installations when in fact they weren't.

  • Because the default state is for there to be no policy script on the system, the fact that the interface exists in the first place is something that is unknown to many long-time Debian users. Having something that can be configured through a (set of) configuration files in /etc instead makes the system discoverable, and allows for better documentation of the interface.

Moreover, a scripted interface is far more powerful than necessary; in most cases, all that is needed is a default policy for all services, which does not require a turing-complete language.

This policy script attempts to solve these issues by allowing system administrators to provide init script policies by way of a declarative interface, rather than a scripted one. It does this by way of a directory /etc/service-policy.d in which packages and/or system administrators may place files describing the policy to be followed. For more information on how these files should be structured, please see the service-policy.d(5) man page.

The policy script interface definition states that policy scripts must support "--quiet" and "--list" arguments. This policy script does not (yet) implement those.

The list of allowed actions may be somewhat small at present. Future versions of this policy script are likely to add more, or to add a way to create custom actions. Wishlist bugs (or patches) welcome!

The policy script interface also specifies a runlevel argument to the script. This policy script does not currently use or read that argument, because it is believed to be not helpful. This may change in the future.

/usr/share/doc/init-system-helpers/README.policy-rc.d.gz, invoke-rc.d(8), service-policy.d(5)

2020-11-23