Difference between revisions of "Kernel parameters"

From ArchWiki
Jump to: navigation, search
(Parameters list)
(Parameters list: add Template:Ic; add init=/usr/lib/systemd/systemd to the table)
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Kernel]]
 
[[Category:Kernel]]
There are three ways to pass options to the kernel and thus control its behavior:
+
There are three ways to pass options to the kernel and thus control its behaviour:
* When building the kernel.
+
* When starting the kernel (usually, when invoked from a boot loader).
+
* At runtime (through the files in {{ic|/proc}} and {{ic|/sys}}).
+
  
This page now explains in more detail the second method and shows a list of most used kernel parameters in Arch Linux. For a complete list of all known options, please see the [http://www.kernel.org/doc/Documentation/kernel-parameters.txt kernel documentation].
+
# When building the kernel.
 +
# When starting the kernel (usually, when invoked from a boot loader).
 +
# At runtime (through the files in {{ic|/proc}} and {{ic|/sys}}).
 +
 
 +
This page now explains in more detail the second method and shows a list of most used kernel parameters in Arch Linux.
  
 
== Configuration ==
 
== Configuration ==
=== When building the kernel ===
 
{{Stub|More to come...}}
 
  
=== When starting the kernel ===
+
Kernel parameters can be set either temporarily by editing the boot menu when it shows up, or by modifying the boot loader's configuration file.
Kernel parameters can be set by modifying boot loader configuration file. You can also set them manually for current boot when the boot loader menu shows up.
+
  
Here we are adding the parameters {{ic|quiet}} and {{ic|splash}} to GRUB, GRUB Legacy, LILO and Syslinux.
+
Here we are adding the parameters {{ic|quiet}} and {{ic|splash}} to [[Syslinux]], [[GRUB]], [[GRUB Legacy]] and [[LILO]].
  
==== [[GRUB]] ====
+
==== Syslinux ====
Edit the file {{ic|/etc/default/grub}} and append your kernel options to the line {{ic|1=GRUB_CMDLINE_LINUX_DEFAULT=""}}:
+
{{hc|/etc/default/grub|2=GRUB_CMDLINE_LINUX_DEFAULT="ro quiet splash"}}
+
  
Re-generate {{ic|grub.cfg}} with:
+
* Press {{Keypress|Tab}} when the menu shows up and add them at the end of the string:
{{bc|# grub-mkconfig -o /boot/grub/grub.cfg}}
+
  
The resulting line in {{ic|/boot/grub/grub.cfg}} will look like:
+
: {{bc|1=> .linux ../vmlinuz-linux root=/dev/sda3 ro initrd=../initramfs-linux.img ''quiet splash''}}
{{hc|/boot/grub/grub.cfg|2=
+
linux /vmlinuz-linux root=/dev/sda3 quiet splash}}
+
  
==== [[GRUB Legacy]] ====
+
: Press {{Keypress|Enter}} to boot with these parameters.
For GRUB Legacy the kernel parameters go into the kernel line of {{ic|menu.lst}}.
+
{{hc|/boot/grub/menu.lst|2=
+
kernel /vmlinuz-linux root=/dev/sda3 ro quiet splash}}
+
  
==== [[LILO]] ====
+
* To make the change persistent after reboot, edit {{ic|/boot/syslinux/syslinux.cfg}} and add them to the {{ic|APPEND}} line:
{{hc|/etc/lilo.conf|2=
+
image=/boot/vmlinuz-linux
+
        [...]
+
        quiet splash}}
+
  
==== [[Syslinux]] ====
+
: {{bc|1=APPEND root=/dev/sda3 ro ''quiet splash''}}
{{hc|/boot/syslinux/syslinux.cfg|2=
+
APPEND root=UUID=988d4e11-8237-4af3-5ab6-77627128g9d0 ro vga=current quiet splash}}
+
  
=== At runtime ===
+
For more information on configuring Syslinux, see the [[Syslinux]] article.
{{Stub|More to come...}}
+
 
 +
==== GRUB ====
 +
 
 +
* Press {{Keypress|e}} when the menu shows up and add them on the {{ic|linux}} line:
 +
 
 +
: {{bc|1=linux  /boot/vmlinuz-linux root=UUID=978e3e81-8048-4ae1-8a06-aa727458e8ff ro  ''quiet splash''}}
 +
 
 +
: Press {{Keypress|b}} to boot with these parameters.
 +
 
 +
* To make the change persistent after reboot, while you ''could'' manually edit {{ic|/boot/grub/grub.cfg}} with the exact line from above, for beginners it's recommended to:
 +
 
 +
:Edit {{ic|/etc/default/grub}} and append your kernel options to the {{ic|GRUB_CMDLINE_LINUX_DEFAULT}} line:
 +
 
 +
:: {{bc|1=GRUB_CMDLINE_LINUX_DEFAULT="''quiet splash''"}}
 +
 
 +
:And then automatically re-generate the {{ic|grub.cfg}} file with:
 +
 
 +
:: {{bc|# grub-mkconfig -o /boot/grub/grub.cfg}}
 +
 
 +
For more information on configuring GRUB, see the [[GRUB]] article.
 +
 
 +
==== GRUB Legacy ====
 +
 
 +
* Press {{Keypress|e}} when the menu shows up and add them on the {{ic|kernel}} line:
 +
 
 +
: {{bc|1=kernel /boot/vmlinuz-linux root=/dev/sda3 ro ''quiet splash''}}
 +
 
 +
: Press {{Keypress|b}} to boot with these parameters.
 +
 
 +
* To make the change persistent after reboot, edit {{ic|/boot/grub/menu.lst}} and add them to the {{ic|kernel}} line, exactly like above.
 +
 
 +
For more information on configuring GRUB Legacy, see the [[GRUB Legacy]] article.
 +
 
 +
==== LILO ====
 +
 
 +
* Add them to {{ic|/etc/lilo.conf}}:
 +
 
 +
: {{bc|<nowiki>
 +
image=/boot/vmlinuz-linux
 +
        ...
 +
        </nowiki>''quiet splash''}}
 +
 
 +
For more information on configuring LILO, see the [[LILO]] article.
  
 
== Parameters list ==
 
== Parameters list ==
{{Note|Not all of the listed options are always available. Most 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.}}
 
=== [[Init]] ===
 
1-6 : change to specified runlevel
 
  
=== [[SystemD]] ===
+
{{Expansion|The list needs more parameters.}}
systemd.unit=$target : boot to target
+
  
 +
{{Note|Not all of the listed options are always available. Most 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.}}
 +
 +
{| border="1"
 +
![[SysVinit]]!![[systemd]]!!Description
 +
|-
 +
| {{ic|3}} || {{ic|1=systemd.unit=multi-user}} || Boot to a specified runlevel (3, in this case). Works with 1-6.
 +
|-
 +
| {{ic|1}}  || {{ic|1=systemd.unit=rescue}} || Boot to Single-user mode (root).
 +
|-
 +
| {{ic|nomodeset}} || {{ic|nomodeset}} || Disable [[Kernel Mode Setting]].
 +
|-
 +
| {{ic|1=loglevel=3}} || {{ic|1=loglevel=3}} || Removes "misaligned reg" and "unknown connector type" messages during boot with the [[Nouveau]] driver. See [https://bbs.archlinux.org/viewtopic.php?id=137509 this] topic.
 +
|-
 +
| -- || {{ic|1=init=/usr/lib/systemd/systemd}} || Boot using [[Systemd#Installation|systemd]] instead of SysVinit.
 +
|}
  
 
All of these parameters are case-sensitive.
 
All of these parameters are case-sensitive.
{{Stub|Add list here.}}
+
 
You can find a list of kernel parameters here: https://www.kernel.org/doc/Documentation/kernel-parameters.txt
+
For a complete list of all known options, please see the [https://www.kernel.org/doc/Documentation/kernel-parameters.txt kernel documentation].
  
 
== See Also ==
 
== See Also ==
 +
 
* [[sysctl]]
 
* [[sysctl]]
* [https://www.kernel.org/doc/Documentation/kernel-parameters.txt Linux Kernel Documentation :: kernel-parameters.txt]
 
 
* [http://files.kroah.com/lkn/lkn_pdf/ch09.pdf List of kernel parameters with further explanation and grouped by similar options]
 
* [http://files.kroah.com/lkn/lkn_pdf/ch09.pdf List of kernel parameters with further explanation and grouped by similar options]

Revision as of 22:19, 4 November 2012

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

  1. When building the kernel.
  2. When starting the kernel (usually, when invoked from a boot loader).
  3. At runtime (through the files in /proc and /sys).

This page now explains in more detail the second method and shows a list of most used kernel parameters in Arch Linux.

Configuration

Kernel parameters can be set either temporarily by editing the boot menu when it shows up, or by modifying the boot loader's configuration file.

Here we are adding the parameters quiet and splash to Syslinux, GRUB, GRUB Legacy and LILO.

Syslinux

  • Press Template:Keypress when the menu shows up and add them at the end of the string:
> .linux ../vmlinuz-linux root=/dev/sda3 ro initrd=../initramfs-linux.img quiet splash
Press Template:Keypress to boot with these parameters.
  • To make the change persistent after reboot, edit /boot/syslinux/syslinux.cfg and add them to the APPEND line:
APPEND root=/dev/sda3 ro quiet splash

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

GRUB

linux   /boot/vmlinuz-linux root=UUID=978e3e81-8048-4ae1-8a06-aa727458e8ff ro  quiet splash
Press Template:Keypress to boot with these parameters.
  • To make the change persistent after reboot, while you could manually edit /boot/grub/grub.cfg with the exact line from above, for beginners it's recommended to:
Edit /etc/default/grub and append your kernel options to the GRUB_CMDLINE_LINUX_DEFAULT line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
And then automatically re-generate the grub.cfg file with:
# grub-mkconfig -o /boot/grub/grub.cfg

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

GRUB Legacy

kernel /boot/vmlinuz-linux root=/dev/sda3 ro quiet splash
Press Template:Keypress to boot with these parameters.
  • 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

  • Add them to /etc/lilo.conf:
image=/boot/vmlinuz-linux
        ...
        quiet splash

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

Parameters list

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: The list needs more parameters. (Discuss in Talk:Kernel parameters#)
Note: Not all of the listed options are always available. Most 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.
SysVinit systemd Description
3 systemd.unit=multi-user Boot to a specified runlevel (3, in this case). Works with 1-6.
1 systemd.unit=rescue Boot to Single-user mode (root).
nomodeset nomodeset Disable Kernel Mode Setting.
loglevel=3 loglevel=3 Removes "misaligned reg" and "unknown connector type" messages during boot with the Nouveau driver. See this topic.
-- init=/usr/lib/systemd/systemd Boot using systemd instead of SysVinit.

All of these parameters are case-sensitive.

For a complete list of all known options, please see the kernel documentation.

See Also