Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've seen this sometime now, but not finding anything in the ubuntu man about this peculiar policy-rc.d binary that prevents services from being started/restarted/stopped when called by dpkg/apt, so I would like to know what is the reason of this.

Setting up lxc (0.9.0-0ubuntu3.6) ...
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of start.

Apparently, no package owns this binary:

dpkg -S /usr/sbin/policy-rc.d
dpkg-query: no path found matching pattern /usr/sbin/policy-rc.d
share|improve this question

1 Answer 1

up vote 3 down vote accepted

This "script" is included in the sysv-rc package. This is part of a Debian policy which allows sysadmins to control what services starts/restarts/stops whenever they install/upgrade/uninstall packages:

POLICY-RC.D Policy layer (/usr/sbin/policy-rc.d) interface:

Most Debian systems will not have this script as the need for a policy layer is not very common. Most people using chroot jails just need an one-line script which returns an exit status of 101 as the jailed /usr/sbin/policy-rc.d script.

The /usr/sbin/policy-rc.d file must be managed through the alternatives system (/usr/sbin/update-alternatives) by any packages providing it.

/usr/sbin/policy-rc.d [options] []

/usr/sbin/policy-rc.d [options] --list [...]

(Source)

So, what happens here? Well, whenever this script is present it will return a code which states the current policy of the local system (which is by default 101 = action forbidden by policy). If you want to change the policy, just modify the file as root to any of this values:

  0 - action allowed
  1 - unknown action (therefore, undefined policy)
 100 - unknown initscript id
 101 - action forbidden by policy
 102 - subsystem error
 103 - syntax error
 104 - [reserved]
 105 - behaviour uncertain, policy undefined.
 106 - action not allowed. Use the returned fallback actions
       (which are implied to be "allowed") instead. 

The script is still a place holder, but when completed all these values could be returned. If you want to allow any change just change exit 101 for exit 0 and done. Whenever you install/remove/upgrade a service these will be (re)started/stopped.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.