Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

SELinux Troubleshooting

Direct answer

SELinux troubleshooting reads AVC denials and applies the smallest fix: correct the label, enable a boolean, label a port, or as a last resort create a local policy module.

When to use this

Use it when a service fails only with SELinux enforcing.

First 30 seconds

1. ausearch -m AVC -ts recent — denials?

2. audit2why -a / sealert -a /var/log/audit/audit.log — suggested fix.

3. Label → restorecon/semanage; boolean → setsebool -P; port → semanage port.

4. No denial but still blocked → semodule -DB to show dontaudit, then semodule -B.

5. Last resort: audit2allow -M local_fix reviewed, semodule -i.

Operational verification

operation denied → AVC logged → cause classified (label, boolean, port, policy) → smallest fix → enforcing works

Evidence · next step

For SELinux → SELinux Troubleshooting, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for SELinux Troubleshooting. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it when a service fails only with SELinux enforcing.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

8 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

symptom/time → reproduce under known mode → correlate AVC/audit event → inspect subject/object context + policy/boolean → minimal persistent remediation → enforcing retest → regression

Healthy evidence: AVCs correlate with the exact failing syscall/path, contexts/policy are explained, the minimal fix persists and enforcing-mode acceptance tests pass

Step 2 Close the fix in enforcing mode Verify boundary

After the smallest correction, return to enforcing mode and clear or timestamp the audit window so the retest is unambiguous. Repeat the original operation from the same service domain and verify that no new denial appears for that path. Confirm labels survive restorecon and reboot expectations, and that any boolean or custom policy is persistent by design. Then perform the consumer-visible test, not only a service restart. A service that starts successfully can still encounter later denials on data, log, socket or network access. The limit of what it shows is an enforcing-mode original test with expected policy state and no new relevant AVCs, while unrelated audit noise remains separate.

Step 3 Verification and output interpretation Verify boundary

Verification chain. symptom/time → reproduce under known mode → correlate AVC/audit event → inspect subject/object context + policy/boolean → minimal persistent remediation → enforcing retest → regression

Step 4 Commands Verify boundary
ausearch -m AVC -ts recent
sealert -a /var/log/audit/audit.log
getsebool -a | grep httpd
Step 5 Treat AVC records as a structured policy decision Narrow the fault

SELinux troubleshooting starts with the exact denied operation, not with changing enforcement mode. An AVC record identifies the source context, target context, object class and denied permission that participated in the policy decision. Determine whether the labels are correct for the file, process, port or resource and whether the action is expected by the application’s supported policy. Mislabeling is common after copying data to nonstandard paths; a custom path may need the correct persistent file-context mapping followed by relabeling rather than a broad allow rule. Boolean settings can intentionally permit optional behavior, but they should be selected because they match the documented access pattern, not because an audit2allow result happened to compile.

Step 6 Separate labeling, policy and application failures Narrow the fault

Use a simple branch sequence. If no relevant AVC exists during the reproduced failure, SELinux has not yet been confirmed as the blocking boundary. If an AVC exists, compare the target label with the expected type and check whether the source domain should legitimately access that class and permission. Correct an incorrect label with persistent context configuration; enable a narrowly appropriate boolean when the workload matches its intended policy; create custom policy only when the access is both necessary and not represented by existing policy. Permissive mode can be a short diagnostic comparison, but success in permissive mode shows only that SELinux enforcement contributed to the failure, not that the generated allow rule is safe or minimal.

Step 7 Failure modes and next checks Narrow the fault

Suspicious evidence: irrelevant AVC noise drives changes, audit time/window is wrong, policy is generated broadly from logs, permissive/disabled mode masks the issue or the true failure is outside SELinux

Step 8 Common mistakes Narrow the fault
  • Using audit2allow blindly to create broad policies.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Use sealert or audit2why to explain denials. Only use audit2allow to build a module after confirming no label or boolean fixes it — review the generated rules. dontaudit rules can hide denials (semodule -DB temporarily).

Key checks
  • audit2why -a — explain denials
  • getenforce / sestatus — mode and policy
  • ls -Z <path> — file context
  • ps -eZ | grep <proc> — process context
  • ausearch -m AVC -ts recent — recent denials
  • semanage fcontext -l | grep <path> — context rules for a path
ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

Troubleshooting is resolved only when the first SELinux boundary is confirmed, corrected minimally/persistently and the original workload succeeds in enforcing mode without unrelated policy broadening.

In depth

From denial to correct fix

# ausearch -m AVC,USER_AVC -ts recent
type=AVC msg=audit(1764238891.412:921): avc:  denied  { read } for  pid=2211 comm="httpd" name="index.html" dev="dm-0" ino=393251 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0
# sealert -a /var/log/audit/audit.log | less
# ls -Z /srv/www/index.html
unconfined_u:object_r:user_home_t:s0 /srv/www/index.html

Red Hat's SELinux troubleshooting chapter uses ausearch -m AVC to find denials, sealert for explanations and suggested fixes, semanage fcontext with restorecon to apply correct labels, and semodule -DB to temporarily disable dontaudit rules so hidden denials appear (semodule -B re-enables them).

Choose the fix by cause

CauseFixExample
Wrong label (file moved from home, copied with mv)Label correctlysemanage fcontext -a -t httpd_sys_content_t '/srv/www(/.*)?' then restorecon -Rv /srv/www
Feature needs a booleanTurn on the booleansetsebool -P httpd_can_network_connect on
Service on a non-standard portAdd the port typesemanage port -a -t http_port_t -p tcp 8443
Genuinely missing policyLocal module, reviewedaudit2allow -M myhttpd < avc.log — read the .te before loading

Using audit2allow for a labelling problem produces an over-broad policy; fix labels and booleans first.

Reading the AVC

FieldMeaning
scontextProcess domain (httpd_t)
tcontextTarget type (user_home_t) — wrong for web content
tclassObject class (file, dir, tcp_socket)
permissive=0Enforcing — actually blocked

Finish in enforcing mode

setenforce 0 is a diagnostic switch for minutes, not a fix. After the change: setenforce 1, repeat the action, and confirm no new AVC with ausearch -m AVC -ts recent. getenforce and sestatus show the current mode; per-domain permissive (semanage permissive -a httpd_t) limits risk during investigation.

*The AVC audit entry uses example security contexts to illustrate an SELinux denial, not an actual audited access attempt.*

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

SELinux Troubleshooting is part of SELinux → SELinux Troubleshooting. SELinux Troubleshooting isolates whether an observed failure is caused by mode, context, label mapping, boolean, transition or policy by correlating AVC records with the exact denied operation before changing policy.

Topic-specific state model. SELinux Troubleshooting isolates whether an observed failure is caused by mode, context, label mapping, boolean, transition or policy by correlating AVC records with the exact denied operation before changing policy.

Interpretation rule. - An AVC appears near the failure ≠ it caused the user-visible symptom.

  • Disabling SELinux and seeing success ≠ disabling it is an acceptable fix or the policy issue is understood.

Method

SELinux troubleshooting workflow:

1. Confirm SELinux is the cause: ausearch -m AVC -ts recent shows denials at the time of the failure (or test with setenforce 0 briefly).

2. Explain: ausearch -m AVC -ts recent | audit2why — label, boolean or missing rule?

3. Fix in order of preference: correct label (restorecon/semanage fcontext), boolean (setsebool -P), port type (semanage port), and only then a local policy module.

4. Local module as last resort:

ausearch -m AVC -c myapp --raw | audit2allow -M myapp_local
semodule -i myapp_local.pp

Review generated rules — blanket allow rules can open more than needed.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Troubleshooting is resolved only when the first SELinux boundary is confirmed, corrected minimally/persistently and the original workload succeeds in enforcing mode without unrelated policy broadening.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. SELinux Troubleshooting owns symptom-to-policy isolation; hand off to DAC, service, filesystem, networking or application branches when SELinux is not the first failure.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in SELinux → SELinux Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://selinuxproject.org/page/Main_Page · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
selinux troubleshootingavc denial troubleshootingselinux denied
Embedded reference data

Quick lookup tables

SELinux Troubleshooting operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for SELinux Troubleshooting.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSELinux Troubleshooting isolates whether an observed failure is caused by mode, context, label mapping, boolean, transition or policy by correlating AVC records with the exact denied operation before changing policy.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainsymptom/time → reproduce under known mode → correlate AVC/audit event → inspect subject/object context + policy/boolean → minimal persistent remediation → enforcing retest → regressionTrace requested/configured state through effective state to the observed workload result.
Failure boundaryTroubleshooting closes only when the first SELinux boundary is proven, corrected minimally/persistently and the original workload succeeds in enforcing mode without unrelated policy broadening.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux security/trust evidence can establish this proof path: symptom/time → reproduce under known mode → correlate AVC/audit event → inspect subject/object context + policy/boolean → minimal persistent remediation → enforcing retest → regressionUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. Troubleshooting closes only when the first SELinux boundary is proven, corrected minimally/persistently and the original workload succeeds in enforcing mode without unrelated policy broadening.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks.Continue to the next unresolved boundary while preserving the original test condition.

SELinux Troubleshooting · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundarySELinux Troubleshooting
Topic pathSELinux → SELinux Troubleshooting
Runtime stateSELinux Troubleshooting isolates whether an observed failure is caused by mode, context, label mapping, boolean, transition or policy by correlating AVC records with the exact denied operation before changing policy.
Fast checks- Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for SELinux Troubleshooting. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check.
Verification chainsymptom/time → reproduce under known mode → correlate AVC/audit event → inspect subject/object context + policy/boolean → minimal persistent remediation → enforcing retest → regression Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary.
Failure boundaryTroubleshooting closes only when the first SELinux boundary is proven, corrected minimally/persistently and the original workload succeeds in enforcing mode without unrelated policy broadening. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?