zg-policy-rc.d command not found

In this troubleshooting guide we learn how to fix zg-policy-rc.d command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

zg-policy-rc.d: command not found

or when using sudo you get the following error message

sudo: zg-policy-rc.d: command not found

Solutions to zg-policy-rc.d: command not found

How To Fix zg-policy-rc.d: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu zg-policy-rc.d is provided by policyrcd-script-zg2 package.

policyrcd-script-zg2 is:

This package contains a script which is linked via the alternatives subsystem to /usr/sbin/policy-rc.d. This script looks for a local policy-rc.d script in /usr/local and /etc, providing a policy- and FHS-compliant way to interface invoke-rc.d with a local script.

Without this package, a local admin wanting to cleanly interface with invoke-rc.d is forced to drop a local binary to /usr/sbin and/or manually interface with the alternatives system. Both ways of doing this are clumsy and error-prone, so this package offers a clean way of interfacing with sysvrc and file-rc.

Since there are at least two packages containing their own version of invoke-rc.d, having a search path policy for policy-rc.d can be messy and is prone to be unstructured and uncoordinated.

Hence, having a dedicated package is the clean way of doing things.

This package has its upstream sources maintained in the Debian project, so there is no upstream URL.

To fix this problem, we can install more using the command below.

sudo apt-get -y install policyrcd-script-zg2

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install policyrcd-script-zg2.

sudo apt -y install policyrcd-script-zg2

Or if you have aptitude installed you can use the following command.

sudo aptitude install policyrcd-script-zg2

Summary

In this tutorial we learn how to fix zg-policy-rc.d command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.