Linux Labs EspañolES

Hardware and boot Labs

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

bash
cat /proc/cmdline
rpm -q kernel 2>/dev/null || ls /boot/vmlinuz-*

Steps

  1. Add audit_backlog_limit=8192 to every existing boot entry and to the defaults used by future kernels.
  2. Reboot and prove the running kernel received it.
  3. Set the older kernel as the default, confirm, then set the newest one back.

Verification

bash
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 family
Show the solution

RHEL family:

bash
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:

bash
sudo sed -i 's/^GRUB_CMDLINE_LINUX="/&audit_backlog_limit=8192 /' /etc/default/grub
sudo update-grub

Remove it later with grubby --update-kernel=ALL --remove-args="audit_backlog_limit" and the reverse edit in /etc/default/grub.