auditd Error: 'The audit system is in immutable mode, no rule changes allowed' — Cause, Fix, and Troubleshooting Guide
Fix auditctl 'audit system is in immutable mode, no rule changes allowed' (-e 2): rules are locked until reboot. Edit persistent rules and reboot.
- #security
- #hardening
- #troubleshooting
- #linux
- #auditd
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
What this error means
auditctl refused to add, delete, or modify an audit rule because the audit system is locked in immutable mode (-e 2). This is a deliberate hardening setting: once the rules are loaded and locked, they cannot be changed until the next reboot, preventing an attacker (or a mistake) from silently disabling auditing at runtime.
Error - The audit system is in immutable mode, no rule changes allowed
The audit system is in immutable mode, no rule changes allowed
Because CIS/STIG baselines frequently mandate -e 2, this “error” is often the system working as intended — the task is to change rules the correct way, through persistent config plus a reboot.
How it manifests on the host
sudo auditctl -w /etc/passwd -p wafails withaudit system is in immutable mode.auditctl -D(delete all) is rejected.- A configuration-management run that reloads audit rules fails on hardened hosts only.
auditctl -sshowsenabled 2.
System configuration causes
-e 2set in the rules. A final-e 2line in/etc/audit/rules.d/*.rules(oraudit.rules) locks the config at load.- CIS/STIG baseline applied that mandates immutable mode.
- Attempting runtime edits instead of editing persistent rule files and reloading at boot.
- Config-management drift trying to reconcile rules against a locked live config.
Interrogating the host
# Is immutable mode actually on? (enabled 2 = locked)
sudo auditctl -s | grep -i enabled
# Where is -e 2 configured?
sudo grep -R -- '-e 2' /etc/audit/rules.d/ /etc/audit/audit.rules 2>/dev/null
# What rules are currently loaded?
sudo auditctl -l | head
enabled 2 confirms the lock; the -e 2 line shows which rules file enforces it.
Remediation
You cannot unlock at runtime — that is the point. Change the persistent rules and reboot.
1. Edit the persistent rule files (never expect runtime edits to stick):
sudoedit /etc/audit/rules.d/hardening.rules
# add/adjust your -w / -a rules ABOVE the final -e 2 line
2. Regenerate and validate the compiled ruleset:
sudo augenrules --load # compiles rules.d/*.rules into audit.rules
sudo auditctl -s # still 'enabled 2' until reboot
3. Reboot to apply the new immutable ruleset:
sudo systemctl reboot
# after reboot:
sudo auditctl -l # verify the new rules are present
4. If you must iterate quickly in a lab, temporarily set -e 1 (changeable) in the rules file, test, then restore -e 2 and reboot for the hardened state. Do not leave production at -e 1.
Hardening the host
- Keep
-e 2as the last line in your rules; anything after it is ignored at load. - Immutable mode means rule changes require a reboot — schedule audit-rule updates with your maintenance windows.
- Do not weaken to
-e 1on production to dodge the reboot; that defeats the tamper-resistance the baseline requires. augenrules --loadonly compiles files; the immutability still gates the live change until reboot.
Related system errors
- auditd ‘backlog limit exceeded’ Error Guide
- Audit Logging and Threat Detection with AI
- CIS Benchmark Hardening for Linux Servers
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.