How to add a kernel parameter

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

How to add a kernel parameter

Post by rene »

Sometimes and/or for specific hardware we need to tell the Linux kernel to treat it specially through the use of a kernel parameter. Posted here as a tutorial in order to be able to quickly refer to it from posts that need the advise given.

1. Temporarily add a kernel parameter

Kernel parameters tend to be not needed generally, and adding one you often do as little other than testing. In this case it's best to just add it temporarily for one boot directly from the Grub menu, the black OS-picker menu you get when starting the computer. If you dual-boot with e.g. Windows and have not specifically adjusted things you should get said menu on startup automatically; if you single-boot you may not without on a UEFI system tapping the Esc key at the point that the boot transitions from BIOS to disk or on a Legacy system holding down Left-Shift at that time.

Once in the Grub menu you highlight the relevant Linux boot entry, use e to edit it and add the suggested kernel parameter on the "linux" line, instead of or before or after where it normally says "quiet splash". An example when the suggested kernel parameter is i915.enable_fbc=0 would be

Code: Select all

linux   /boot/vmlinuz-5.8.0-53-generic root=UUID=12345678-1234-5678-9abc-123456789abc ro quiet splash i915.enable_fbc=0
Then press F10 to boot. Once booted you can verify from cat /proc/cmdline that indeed the parameter was specified.

2. "Permanently" add a kernel parameter

Permanently in the sense of not needing to provide it manually per boot: it is otherwise of course as easily undone as done. For this you add the parameter to /etc/default/grub with e.g.

Code: Select all

sudo nano /etc/default/grub
and add to the GRUB_CMDLINE_LINUX_DEFAULT string, again instead of or before or after where it normally says "quiet splash". The example when the suggested kernel parameter is i915.enable_fbc=0 is

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.enable_fbc=0"
Save the file, run sudo update-grub and reboot. You can again once booted verify from cat /proc/cmdline that the parameter was specified.
Last edited by karlchen on Thu Dec 30, 2021 2:57 pm, edited 1 time in total.
Reason: Corrected the last occurrence to read: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.enable_fbc=0" (it was i915_enable_fbc=0. Note _ vs .)
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: How to add a kernel parameter

Post by Termy »

For clarification, I'd change all instances of "kernel parameter" to "kernel boot parameter", to avoid ambiguity, because they are notably different, which led to me viewing this thread thinking it was something else.
I'm also Terminalforlife on GitHub.
User avatar
SMG
Level 25
Level 25
Posts: 31971
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How to add a kernel parameter

Post by SMG »

rene wrote: Sat May 22, 2021 6:21 am
2. "Permanently" add a kernel parameter

Permanently in the sense of not needing to provide it manually per boot: it is otherwise of course as easily undone as done. For this you add the parameter to /etc/default/grub with e.g.

Code: Select all

sudo nano /etc/default/grub
and add to the GRUB_CMDLINE_LINUX_DEFAULT string, again instead of or before or after where it normally says "quiet splash". The example when the suggested kernel parameter is i915.enable_fbc=0 is

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915_enable_fbc=0"
Save the file, run sudo update-grub and reboot. You can again once booted verify from cat /proc/cmdline that the parameter was specified.
Thanks rene for creating this tutorial as I pass it along to others quite a bit.

One recent poster let me know they ran into a problem because they typed exactly what was on the GRUB_CMDLINE_LINUX_DEFAULT line. There is an _ instead of a . between i915 and enable. (Which I never before noticed. :oops: ) They asked if it could be corrected. I let them know I would pass along the request which is in the second half of this post.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How to add a kernel parameter

Post by rene »

See that karlchen already did. Interesting. Had also never noticed before...
Ignoramus
Level 1
Level 1
Posts: 31
Joined: Fri Nov 26, 2021 4:43 pm

Re: How to add a kernel parameter

Post by Ignoramus »

I'm not techie at all and brand new to Linux and I got a bit confused about the making a parameter permanent thing, so is it OK if I add a link to the question I posted about it, and, of course, the answers that helped clarify what I had to do? How do I install a kernel parameter permanently? (viewtopic.php?f=46&t=367103&p=2133435#p2133435)
jimmy2x
Level 1
Level 1
Posts: 49
Joined: Mon Aug 14, 2023 7:56 pm

Re: How to add a kernel parameter

Post by jimmy2x »

For some reason that boot up it didn’t save the parameter even though I properly editing grub. However once rebooting and editing on grub menu then using nano, the parameter was in the file.. hmm.. atleast I know the parameter just odd
User avatar
SMG
Level 25
Level 25
Posts: 31971
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: How to add a kernel parameter

Post by SMG »

jimmy2x wrote: Tue Aug 15, 2023 5:42 pm For some reason that boot up it didn’t save the parameter even though I properly editing grub. However once rebooting and editing on grub menu then using nano, the parameter was in the file.. hmm.. atleast I know the parameter just odd
You have to make sure to run sudo update-grub after editing and saving the file so the file is used the next time you boot.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
jimmy2x
Level 1
Level 1
Posts: 49
Joined: Mon Aug 14, 2023 7:56 pm

Re: How to add a kernel parameter

Post by jimmy2x »

Duhh. I’m sorry I did not do that the first time! Thx
Post Reply

Return to “Tutorials”