SELinux Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=2860
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.
Remember
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).
First checks
audit2why -a— explain denialsgetenforce / sestatus— mode and policyls -Z <path>— file contextps -eZ | grep <proc>— process contextausearch -m AVC -ts recent— recent denialssemanage fcontext -l | grep <path>— context rules for a path
Verify in this order
operation denied → AVC logged → cause classified (label, boolean, port, policy) → smallest fix → enforcing works
Where it usually breaks
First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2860