I mostly make settings through kernel parameters
Is it possible to add multi line(GRUB_CMDLINE_LINUX) for better control parameters?
Like this
GRUB_CMDLINE_LINUX=“parameters”
GRUB_CMDLINE_LINUX=“parameters”
GRUB_CMDLINE_LINUX=“parameters”
I mostly make settings through kernel parameters
Is it possible to add multi line(GRUB_CMDLINE_LINUX) for better control parameters?
Like this
GRUB_CMDLINE_LINUX=“parameters”
GRUB_CMDLINE_LINUX=“parameters”
GRUB_CMDLINE_LINUX=“parameters”
Multiple lines of GRUB_CMDLINE_LINUX=“parameters” will be ignored, afaik. Only the first line will work. You have to separate the parameters with a space like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
The difference:
GRUB_CMDLINE_LINUX_DEFAULT="param1 param2"
will be executed on every boot.
GRUB_CMDLINE_LINUX="param1 param2"
(without the “_DEFAULT”) will NOT be executed if the fall-back kernel is executed.
If you want to just have a better overview of the kernel parameters, something like the following would work.
The example is from my /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="intel_pstate=passive
lsm=landlock,lockdown,yama,integrity,apparmor,bpf
zswap.enabled=0
nowatchdog"
Kind of Off topic, but for future readers:
AFAIK, only the last one will work.
I think you can have multiple lines like this:
GRUB_CMDLINE_LINUX="parameters"
GRUB_CMDLINE_LINUX+=" parameters"
GRUB_CMDLINE_LINUX+=" parameters"
Note the usage of +=
catenation and the first space inside the additional strings. They should make the value as one bigger string.
Note also that I haven’t really tested this, but AFAIK it is treated as bash or sh script.
Please correct me if I’m wrong.
Are you asking others to test? It can be tested with a temporary save to a local file
The Manual says the same :
The file /etc/default/grub controls the operation of
grub-mkconfig
. It is sourced by a shell script, and so must be valid POSIX shell input; normally, it will just be a sequence of ‘KEY=value’ lines, but if the value contains spaces or other special characters then it must be quoted.
→ Are YOU asking others to test???
…or do you know for sure, or did you try it?
Why not?
As it is run with sh, then it should work.
And there are other syntactical ways too:
GRUB_CMDLINE_LINUX="parameters"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX parameters"
GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX parameters"
and the one presented in posts above. And probably more…
So many ways to do the same thing!
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.