0

I'm trying to add a kernel option "xxx" by adding it to the existing

GRUB_CMDLINE_LINUX="xxxx crashkernel=auto rhgb quiet"

line in /etc/default/grub, but after doing so, when I run

grub2-mkconfig –o /boot/grub2/grub.cfg

it produces exactly the same grub.cfg file as before (confirmed with diff).

What am I missing?

I'm running CentOS Linux release 7.6.1810 (Core)

2 Answers 2

0

I'm not using CentOS (so can't test it), but this should do it:

GRUB_CMDLINE_LINUX="xxxx crashkernel=auto rhgb quiet ${GRUB_CMDLINE_LINUX}"

1
  • I tried this, ran grub2-mkconfig -o file1, and it produced the desired "xxx" kernel option, previously missing. Then I removed your suggestion and ran grub2-mkconfig -o file2, diff'd the two files, which should have produced the original grub.cfg that I had yesterday, but it did not. Not only is it the same as file1 (both now have my new "xxx" kernel option, with or without your suggestion) but they are different now from my original grub.cfg, the biggest difference being that it's changed all my hd0 to hd2. So now I'm really confused. Nov 11, 2019 at 19:35
0

First I would try to make a change in any of the other files in /etc/grub.d You can even make an error on purpose to force grub2-mkconfig to throw an error.

Also make sure you're not copying the command from a script that you may have stored on your computer, or from a website. Type the command grub2-mkconfig -o /boot/grub2/grub.cfg manually.

Character "-" and "–" are not the same, so it's easy to miss that.

3
  • The in command is Unicode 2013, should replace it by ASCII -
    – Cnfn
    Apr 30, 2022 at 9:37
  • Well pointed out, I actually didn't see that. But that's actually the point of my suggestion, copying sometimes has this consequence. For some reason when I copied from my own notes it just converted the dash. So the best bet here is to type the command manually.
    – kissumisha
    May 1, 2022 at 17:48
  • Side note: In case it does not help, be aware that grub2-mkconfig is a shell script which can be executed in "verbose": sh -x $(command -v grub2-mkconfig)
    – Hermann
    May 1, 2022 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .