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
Stuck on this DevOps Security & Hardening error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
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
Fixed it? Get 500 DevOps Security & Hardening & 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.
Stuck on this? Start guided troubleshooting
Open an interactive diagnostic session with this error already loaded. Work a step-by-step plan, record what each check returns, land on a root cause, and export a clean incident summary — no account needed to start.
Did this fix your issue?
Solved it a different way?
Share the fix that worked for you — reviewed, then published to help the next engineer.
That looks like it may contain a secret (key, token, password, or connection string). Please remove it — a note with a detected secret can’t be published.
Thanks — that helps. Published notes appear after a quick review.
Trending errors this week
The error guides other engineers are actually reading right now.
- 1mount: wrong fs type, bad option, bad superblock
- 2Docker 'failed to set up container networking': Fix the Bridge and IP Pool
- 3Docker 'failed to create shim task': How to Fix the containerd Runtime Error
- 4Transport endpoint is not connected
- 5modprobe: FATAL: Module not found
- 6mount: wrong fs type, bad option, bad superblock
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.