Something has changed in v9. With AlmaLinux 8, I used to disable IPv6 and auto-rename of the network adapter with the following commands but they do not work with v9.
grub2-editenv - list | grep kernelopts
grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) net.ifnames=0 ipv6.disable=1"
How do you modify the boot parameter in AlmaLinux 9?
grub2-editenv - list command output is not showing kernelopts option to update kernel commandline. There is mention of it here (How to modify the boot parameter in RHEL 9 - Red Hat Customer Portal) but you have to have a paid subscription to get past the paywall.
Finally, is there a better method (best practices) which also survives reboots and kernel updates?
Both EL8 and EL9 do use BLS by default. That means a file in /boot/loader/entries/ for each kernel.
EL8 has dereference of the ‘kernelopts’ in those file. EL9 does not.
(The removal of kernelopts is mentioned in Chapter 12. Kernel Red Hat Enterprise Linux 9 | Red Hat Customer Portal )
You probably should edit
/etc/default/grub and rerun
grub2-mkconfig -o /boot/grub2/grub.cfg anyway but that might not affect existing entries.
i tend to use grubby these days, its much easier when adding/removing parameters than fiddling with /etc/default/grub (especially if you’re using ansible!) and no need to update grub or worry about /boot/loader/entries and uefi/bios, just reboot (and kernelopts is definitely deprecated in v9):
grubby --update-kernel ALL --args 'net.ifnames=0'
grubby --update-kernel ALL --remove-args='ipv6.disable=1'