User:Pietinger/Tutorials/Kernel Commandline Parameter

Tutorial: Kernel Command Line 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 command line parameters (for security reasons) you must enable this:

Paramter: 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 external initramfs (= external CPIO archive) then 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.