User:Pietinger/Tutorials/Kernel Commandline Parameter

Tutorial: Kernel Commandline Parameter
This is a short overview how you can give your kernel some parameters. Main difference is how you boot your kernel: Using a bootmanager (like grub) or using UEFI (booting a stub kernel directly).

A list of all possible parameters kernel will understand is here: https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

What always work
Independent how you boot your kernel you can always "hardcode" needed parameters into your kernel directly with (EXAMPLE):

Using grub
Edit in the variable GRUB_CMDLINE_LINUX. See more here: GRUB

Using UEFI
Configure your UEFI boot entry with additional options when creating this entry (EXAMPLE]:

See more here: Efibootmgr and here: EFI_stub

Can I mix it ?
Yes, you can give your kernel some parameters via built-in command line and some more via grub or UEFI. Kernel will put both informations together (at boot-time). But it is not recommended. Maybe there exists some special constellations where you need it. If you dont want that your bootmanager or UEFI will add (or even override) your built-in commandline parameters (for security reasons) you must enable this:

Parameter: root=
Why it is not recommended to use root=/dev/sdXY ?

Because it could confuse your kernel. This can happen if you have two (or more) hard disks in your system. Then it could be that sometimes your 2nd harddisk becomes /dev/sda and your first harddisk is /dev/sdb and then kernel will not find its root partition on /dev/sda2 because this is now the 2nd partiton of your 2nd harddisk. Another problem can occure if you have an USB-stick attached to your system when booting. Here it is also possible your harddisk becomes /dev/sdb instead /dev/sda.

So I should always use root=PARTUUID=... ?

Yes, it is better (more safe), BUT there is one exception: If you use an initramfs it could be you must use root=UUID=... instead. Of course then you must use the real UUID and not the PARTUUID. Just ask for it with blkid.

By the way: The same is true for your /etc/fstab. I recommend to label your partitions if you have a GPT disk. I did this with:

and now I use these:

Of course you can use also "UUID=" but dont use "LABEL=" for a GPT disk. See more here: fstab

Parameter: quiet
With this command line parameter you can suppress most output of your kernel when booting. If you still see some warnings and think this parameter does not work then read this kernel bug report: https://bugzilla.kernel.org/show_bug.cgi?id=217226