policygentool command not found

In this troubleshooting guide we learn how to fix policygentool command not found error message

Introduction

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

policygentool: command not found

or when using sudo you get the following error message

sudo: policygentool: command not found

Solutions to policygentool: command not found

How To Fix policygentool: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu policygentool is provided by selinux-policy-dev package.

selinux-policy-dev is:

The SELinux Reference Policy (refpolicy) is a complete SELinux policy, as an alternative to the existing strict and targeted policies available from http://selinux.sf.net. The goal is to have this policy as the system policy, be and used as the basis for creating other policies. Refpolicy is based on the current strict and targeted policies, but aims to accomplish many additional goals:

  • Strong Modularity
  • Clearly stated security Goals
  • Documentation
  • Development Tool Support
  • Forward Looking
  • Configurability
  • Flexible Base Policy
  • Application Policy Variations
  • Multi-Level Security

This package provides header files for building your own SELinux policy packages compatible with official policy packages.

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

sudo apt-get -y install selinux-policy-dev

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

You can also use apt command to install selinux-policy-dev.

sudo apt -y install selinux-policy-dev

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

sudo aptitude install selinux-policy-dev

Summary

In this tutorial we learn how to fix policygentool command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.