Linux kernel boot parameters

Kernel parameters

There are three ways to pass options to the kernel and thus control its behaviour:

  1. When building the kernel—in the kernel’s config file. See Kernel#Compilation for details.
  2. When starting the kernel—using command line parameters (usually through a boot loader).
  3. At runtime—through the files in /proc/sys/ (see sysctl) and /sys/ .

Note: The options of loadable modules can be set via .conf files in /etc/modprobe.d/ . See Kernel module#Using files in /etc/modprobe.d/.

Between the three methods, the configurable options differ in availability, their name and the method in which they are specified. This page only explains the second method (kernel command line parameters) and shows a list of the most used kernel parameters in Arch Linux.

Most parameters are associated with subsystems and work only if the kernel is configured with those subsystems built in. They also depend on the presence of the hardware they are associated with.

Kernel command line parameters either have the format parameter or parameter=value .

Configuration

  • You can check the parameters your system was booted up with by running cat /proc/cmdline and see if it includes your changes.
  • The Arch Linux installation medium uses Syslinux for BIOS systems, and GRUB for UEFI systems.

Kernel parameters can be set either temporarily by editing the boot entry in the boot loader’s boot selection menu, or permanently by modifying the boot loader’s configuration file.

The following examples add the quiet and splash parameters to Syslinux, systemd-boot, GRUB, GRUB Legacy, LILO, and rEFInd.

Syslinux

linux /boot/vmlinuz-linux root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw initrd=/boot/initramfs-linux.img quiet splash
  • To make the change persistent after reboot, edit /boot/syslinux/syslinux.cfg and add them to the APPEND line:
APPEND root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash

For more information on configuring Syslinux, see the Syslinux article.

systemd-boot

initrd=\initramfs-linux.img root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash
  • If you have not set a value for menu timeout, you will need to hold Space while booting for the systemd-boot menu to appear.
  • If you cannot edit the parameters from the boot menu, you may need to edit /boot/loader/loader.conf and add editor 1 to enable editing.
  • To make the change persistent after reboot, edit /boot/loader/entries/arch.conf (assuming you set up your EFI system partition) and add them to the options line:
options root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash

For more information on configuring systemd-boot, see the systemd-boot article.

Читайте также:  Astra linux vpn соединение

GRUB

linux /boot/vmlinuz-linux root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash
  • To make the change persistent after reboot, you could manually edit /boot/grub/grub.cfg with the exact line from above, or if using grub-mkconfig:
GRUB_CMDLINE_LINUX_DEFAULT
# grub-mkconfig -o /boot/grub/grub.cfg

For more information on configuring GRUB, see the GRUB article.

GRUB Legacy

kernel /boot/vmlinuz-linux root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash
  • To make the change persistent after reboot, edit /boot/grub/menu.lst and add them to the kernel line, exactly like above.

For more information on configuring GRUB Legacy, see the GRUB Legacy article.

LILO

image=/boot/vmlinuz-linux . quiet splash

For more information on configuring LILO, see the LILO article.

rEFInd

  • Press + , F2 , or Insert on the desired menu entry and press it again on the submenu entry. Add kernel parameters at the end of the string:
root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw initrd=\boot\initramfs-linux.img quiet splash
  • To make the change persistent after reboot, edit /boot/refind_linux.conf and append them between the quotes in all required lines, for example
"Boot using default options" "root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash"
  • If you have disabled auto-detection of OSes in rEFInd and are defining OS stanzas instead in esp/EFI/refind/refind.conf to load your OSes, you can edit it like:

For more information on configuring rEFInd, see the rEFInd article.

EFISTUB

dracut

dracut is capable of embedding the kernel parameters in the initramfs, thus allowing to omit them from the boot loader configuration. See dracut#Kernel command line options.

Hijacking cmdline

Even without access to your bootloader it is possible to change your kernel parameters to enable debugging (if you have root access). This can be accomplished by overwriting /proc/cmdline which stores the kernel parameters. However /proc/cmdline is not writable even as root, so this hack is accomplished by using a bind mount to mask the path.

Читайте также:  Распаковка system new dat br linux

First create a file containing the desired kernel parameters

root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 ro console=tty1 logo.nologo debug

Then use a bind mount to overwrite the parameters

# mount -n --bind -o ro /root/cmdline /proc/cmdline

The -n option skips adding the mount to /etc/mtab , so it will work even if root is mounted read-only. You can cat /proc/cmdline to confirm that your change was successful.

Parameter list

This list is not comprehensive. For a complete list of all options, please see the kernel documentation.

    The kernel uses rw if neither ro or rw are explicitly set on kernel command line (see bootparam(7) § General non-device-specific boot arguments ). However, mkinitcpio uses ro as the default value overriding the kernel’s default (see mkinitcpio(8) § EARLY INIT ENVIRONMENT ). Boot loaders may also have their own configured default, for example, grub-mkconfig uses rw (see FS#36275 as a reference).

Note: rw is required when using mkinitcpio’s fsck hook (see [1]) or when using F2FS as the root file system.

See also

Источник

About Kernel Boot Parameters

This document provides simple instructions for adding a Linux kernel boot parameter to an Ubuntu system using GRUB 2.

When advised to try using a particular kernel boot parameter, it is usually a good idea to first add the parameter temporarily for testing. Once you have determined that adding the parameter has the desired effect, you can then add it permanently. Directions for both methods are below.

  • are case-sensitive
  • are sometimes just a simple word («splash» or «noapic«)
  • sometimes have an = sign with various possible values («acpi_backlight=vendor«)
  • sometimes include punctuation («i8042.noloop«)

Always enter kernel boot parameters exactly as advised. Errors in spelling or formatting or invalid values will not result in any error message, they will simply have no effect.

A complete list of parameters supported by the latest mainline kernel is available at The kernel’s command-line parameters.

Temporarily Add a Kernel Boot Parameter for Testing

  1. Restart your system, or shut it down and then power it on again.
  2. As the system starts to boot repeated tap the Esc key in order to force the «GNU GRUB» menu to appear. For BIOS-mode (not UEFI-mode) booting a SHIFT key can be held down continuously until the menu appears. The «GNU GRUB» menu will look something like this:
https://wiki.ubuntu.com/Kernel/KernelBootParameters?action=AttachFile&do=get&target=grub2_default_menu.png
The Grub menu allows for choosing between different boot targets and modes
  • If the system hangs at the initial vendor logo screen when you hold down SHIFT, just release the SHIFT key briefly then hold it down again until the «GNU GRUB» menu appears.
    Once the «GNU GRUB» menu appears highlight the desired entry and press the e key to enter edit mode. The edit mode screen will look something like this:
    https://wiki.ubuntu.com/Kernel/KernelBootParameters?action=AttachFile&do=get&target=grub2_menu_editing.png
    By editing the linux line, kernel and initrd parameters can be modified for just a single boot

    Note: The parameter(s) you’ve added to the linux line are only temporary: They will affect this boot session, but once you restart the system they will no longer be in effect.

    Permanently Add a Kernel Boot Parameter

    1. Log in to the system and start a terminal window (Applications->Accessories->Terminal).
    2. In the terminal window at the $ prompt, enter the command: sudo gedit /etc/default/grub
      • Enter your password when prompted by [sudo].
      • If the file /etc/default/grub appears to be empty or does not exist, see the instructions for earlier releases above).
    3. In the editor window, use the arrow keys to move the cursor to the line beginning with «GRUB_CMDLINE_LINUX_DEFAULT» then edit that line, adding your parameter(s) to the text inside the double-quotes after the words «quiet splash«. (Be sure to add a SPACE after «splash» before adding your new parameter.) Click the Save button, then close the editor window.
    4. In the terminal window at the $ prompt, enter the command: sudo update-grub
    5. Restart the system.

    Note: The parameter(s) you’ve added to the GRUB_CMDLINE_LINUX_DEFAULT line are persistent, and will be in effect for every subsequent boot session (unless you remove them by repeating the procedure above).

    Kernel/KernelBootParameters (последним исправлял пользователь merlijn-sebrechts 2022-12-02 14:25:41)

    The material on this wiki is available under a free license, see Copyright / License for details.

    Источник

Оцените статью
Adblock
detector