Best Way to Fix semanage command Not Found Error in AlmaLinux 8/9

In this tutorial, we intend to teach you How to Fix semanage command Not Found Error in AlmaLinux.

semanage is used to configure certain elements of SELinux policy without requiring modification to or recompilation from policy sources. This includes the mapping from Linux usernames to SELinux user identities (which controls the initial security context assigned to Linux users when they log in and bounds their authorized role set) as well as security context mappings for various kinds of objects, such as network ports, interfaces, and nodes (hosts) as well as the file context mapping.

Fix semanage command Not Found Error in AlmaLinux 8/9

We are trying to run a command by using the semanage command to make changes in the SELinux policy in our case. But we are faced with the following command error:

-bash: semanage: command not found

We found that there is a package that provides semanage command in AlmaLinux.

It is called dnf provides. It is an option to find out the package that provides the queried file called /usr/sbin/semanage.

In this guide, we intend to show you how to use this package to install the necessary packages to get the semanage command.

Fix semanage command Error with “dnf provides” option

At this point, use the following command to see what packages you need to install to use your semanage command:

dnf provides /usr/sbin/semanage

In your output you will see:

Last metadata expiration check: 86 days, 20:38:05 ago on Mon 23 May 2022 08:02:48 AM EDT.
policycoreutils-python-utils-2.9-19.el8.noarch : SELinux policy core python
: utilities
Repo : baseos
Matched from:
Filename : /usr/sbin/semanage

At this point, you need to install the “policycoreutils-python-utils-2.9-19.el8.noarch package to use the semanage command:

dnf install policycoreutils-python-utils

When your installation is completed, try running the semanage command again and it will work!

Also, you can use the following commands to get more help with semanage command:

# man semanage
# semanage --help
usage: semanage [-h]
semanage is used to configure certain elements of SELinux policy with-out
requiring modification to or recompilation from policy source.
positional arguments:

import Import local customizations
export Output local customizations
login Manage login mappings between linux users and SELinux
confined users
user Manage SELinux confined users (Roles and levels for an
SELinux user)

port Manage network port type definitions
ibpkey Manage infiniband ibpkey type definitions
ibendport Manage infiniband end port type definitions
interface Manage network interface type definitions
module Manage SELinux policy modules
node Manage network node type definitions
fcontext Manage file context mapping definitions
boolean Manage booleans to selectively enable functionality
permissive Manage process type enforcement mode
dontaudit Disable/Enable dontaudit rules in policy

optional arguments:
-h, --help show this help message and exit

That’s it, you are done.


At this point, you have learned to Fix the ‘semanage command’ Not Found Error in AlmaLinux. You can easily fix the issue by installing a package and starting to use it. Hope you enjoy it.

Also, you may be interested in these articles on the Orcacore Website:

Steps To Fix dnf update Error: Transaction test error

Install and Configure Elasticsearch on AlmaLinux 8

How To Configure Networking on AlmaLinux

Install and Configure OpenLiteSpeed on AlmaLinux 8

Check Open Ports on AlmaLinux 8 / 9 with Easy Methods

Install VMware Tools on AlmaLinux 8

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

Stay informed and not overwhelmed, subscribe now!