Troubleshooting SELinux

This document covers the basics of troubleshooting SELinux.

SELinux decisions, such as allowing or disallowing access, are cached. This cache is known as the Access Vector Cache (AVC). Denial messages are logged when SELinux denies access. For example, an SELinux error generated by the Apache web server may appear as comm="/usr/sbin/httpd".

Each error message includes information on the source context (scontext) of that part of your system performing an action, and the target context (tcontext), the target of the action. In many cases, the source is a binary and the target a file.

Understanding Denials

When SELinux prevents any software from accessing a particular resource, for example, when Firefox is denied access to /etc/shadow, it generates a message and logs it in /var/log/audit/audit.log or /var/log/messages if audit service is disabled. If the log contains avc: denied that means it is an SELinux policy denial. Note that you would need administrator privileges (root access) on your system to be able to read this log file. An example denial would look like:

key=59918130 scontext=unconfined_u:unconfined_r:nsplugin_t:s0-s0:c0.c1023

Using the setroubleshoot utility

setroubleshoot is a utility that parses the messages from SELinux and provides comprehensive help on what it means and possible actions to take. It has both a graphical utility for your desktop and a server side component that can send email alerts. It is installed by default on Fedora. To install it on your system, use the Software tool in GUI or enter the following command:

$ sudo dnf install setroubleshoot

To start the program, run the following command:

$ sealert

You can find recent alerts in the browser that appears.

To troubleshoot an error, click the troubleshoot button in the SELinux Alert browser. The browser will return available options for resolving the error and commands to run to fix the problem.

Some troubleshooting events can be resolved by enabling a boolean switch policy. This will allow the activity to procede in the future, regardless of SELinux enforcing policy. It is not recommended to utilize booleans without fully understanding the issue. For more information on booleans, see the Booleans chapter in the SELinux User’s and Administrator’s Guide.

Additional Resources