Where are default kernel arguments stored?

A new kernel was added today by an update (6.11) and I noticed that some parameters I had removed from /etc/default/grub were back in effect. I had to run sudo grub2-mkconfig -o /etc/grub2.cfg to ensure the new kernel worked the way I’d set up.

I figured any new kernel would be set up in grub based on /etc/default/grub but it seems like the parameters were taken from somewhere else. Is there another file I should edit?

More specific details below, although I don’t think they matter.

Details

There was a swap partition when I installed the system, but I removed it afterwards. Booting became impossible because the kernel had a resume= parameter, making it wait for the partition forever (no time limit).

I booted with an older kernel (6.8) which wasn’t affected by this issue, updated /etc/default/grup and run the command above, and grub was fixed for both kernels installed at the time (6.8 and 6.10).

Today 6.11 was installed, and again it started waiting forever for a swap partition that doesn’t exist. I fixed it just by running the mkconfig command again.

I guess this will keep happening every time a new kernel is installed? Where are the default args copied from, if not grub config?

The grub2-mkconfig commands copies the paramaters from /etc/default/grub to /etc/kernel/cmdline and kernel-install as called from the kernel update scripts copies the parameters from /etc/kernel/cmdline to the new file in /boot/loader/entries.

2 Likes

Interesting, I still found the unwanted parameters in /etc/kernel/cmdline even after having updated /etc/default/grub and run grub2-mkconfig. I removed them manually, hopefully that fixes it.

Maybe I should say: grub2-mkconfig used to create /etc/kernel/cmdline from the information in /etc/default/grub. Sometimes the grub2 provided scripts are modified and changed how they work.

There have been many changes in grub configuration over the years. If your system has been updated over multiple versions or you foloowed some older grub customization document you may be using a deprecated configuration.

Fedora now uses grub2-mkconfig -o /boot/grub2/grub.cfg as described in Working with the GRUB 2 Boot Loader. That document discusses use of /etc/grub2.d/ for customization.

cat /boot/efi/EFI/fedora/grub.cfg should look like:

search --no-floppy --root-dev-only --fs-uuid --set=dev <UUID>
set prefix=($dev)/grub2
export $prefix
configfile $prefix/grub.cfg

where <UUID> matches the entry for /boot in lsblk -o +UUID.

It hasn’t been a week since this was installed, really. grub.cfg looks like you’d expect, except that /boot isn’t its own partition. So if /etc/kernel/cmdline was supposed to be updated, it’s not old configuration preventing it.

EDIT: Just noticed that the target of mkconfig you mentioned is a different file. Thanks, I’ll keep that in mind. I probably found an old article/post about what the equivalent of update-grub was.

This is correct for directly modifying that file and is documented as such.
However, /etc/grub2.cfg and /etc/grub2-efi.cfg are both symlinks to /boot/grub2/grub.cfg so the command used by the OP was also correct.

# ls -l /etc/grub2*
lrwxrwxrwx. 1 root root 22 May 28 19:00 /etc/grub2.cfg -> ../boot/grub2/grub.cfg
lrwxrwxrwx. 1 root root 22 May 28 19:00 /etc/grub2-efi.cfg -> ../boot/grub2/grub.cfg