Add a persistent kernel argument and choose the default kernel
Practitioner20 minYour VMRHEL and Debian families
Objective
audit_backlog_limit=8192 is on the command line of every kernel after a reboot, and you can switch the default kernel and back.
Requirements
- A VM with at least two installed kernels for the default-kernel part. One is enough for the argument.
Setup
cat /proc/cmdline
rpm -q kernel 2>/dev/null || ls /boot/vmlinuz-*Steps
- Add audit_backlog_limit=8192 to every existing boot entry and to the defaults used by future kernels.
- Reboot and prove the running kernel received it.
- Set the older kernel as the default, confirm, then set the newest one back.
Verification
grep -o 'audit_backlog_limit=[0-9]*' /proc/cmdline
sudo grubby --info=ALL | grep -c audit_backlog_limit # RHEL family
sudo grubby --default-kernel # RHEL familyShow the solution
RHEL family:
sudo grubby --update-kernel=ALL --args="audit_backlog_limit=8192"
sudo sed -i 's/^GRUB_CMDLINE_LINUX="/&audit_backlog_limit=8192 /' /etc/default/grub
[ -f /etc/kernel/cmdline ] && cat /etc/kernel/cmdline # add it here too if this file exists
sudo grubby --set-default /boot/vmlinuz-<older-version>
sudo grubby --default-kernel
sudo grubby --set-default /boot/vmlinuz-$(rpm -q --last kernel | head -1 | sed 's/^kernel-//; s/ .*//')Debian and Ubuntu:
sudo sed -i 's/^GRUB_CMDLINE_LINUX="/&audit_backlog_limit=8192 /' /etc/default/grub
sudo update-grubRemove it later with grubby --update-kernel=ALL --remove-args="audit_backlog_limit" and the reverse edit in /etc/default/grub.