Kernel parameters (简体中文)

From ArchWiki


附注: 部分内容未翻译(在 Talk:Kernel parameters (简体中文)# 中讨论)


  1. 在编译内核时:在内核的 config 文件中。详见内核#编译
  2. 在内核启动时:通过命令行参数(通常通过启动管理器设置)。
  3. 在运行时:通过 /proc/sys/(参见 sysctl)和 /sys/ 中的文件。

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.

内核命令行参数的格式为 parameterparameter=value

注意: 内核参数均区分大小写。
提示: 可加载模块的选项可通过 /etc/modprobe.d/ 中的 .conf 文件设置。参见 Kernel module#Using files in /etc/modprobe.d/



下面示例:把参数quietsplash 加到启动管理器 Syslinux, GRUB, GRUB LegacyLILO中.


  • 当出现启动选择菜单的时候,按 Tab 进入修改模式:
> .linux ../vmlinuz-linux root=/dev/sda3 ro initrd=../initramfs-linux.img quiet splash
Press Enter 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



  • 当启动菜单出现时 按 e进入编辑界面:
initrd=\initramfs-linux.img root=/dev/sda2 quiet splash
Enter 即可按照输入的参数启动。
  • 如果没有设置显示启动菜单, 你需要按住Space启动电脑来进入启动菜单 。
  • 如果不能够从启动菜单上进行编辑,修改 /boot/loader/loader.conf 加入 editor 1 来开启编辑功能。
options root=/dev/sda2 quiet splash

更多信息请参见 systemd-boot .


  • 在菜单出现后按 e 然后将它们添加至 linux 行:
linux /boot/vmlinuz-linux root=UUID=978e3e81-8048-4ae1-8a06-aa727458e8ff ro quiet splash
b 以便用这些参数启动。
  • 要使改变在重启后仍生效,您可以手动编辑 /boot/grub/grub.cfg 中的如上内容。对于初学者,建议:
编辑 /etc/default/grub 并将您的内核选项添加至 GRUB_CMDLINE_LINUX_DEFAULT 行:
然后重新生成 grub.cfg 文件:
# grub-mkconfig -o /boot/grub/grub.cfg

有关配置GRUB的更多信息,请参阅 GRUB

GRUB Legacy

  • Press e when the menu shows up and add them on the kernel line:
kernel /boot/vmlinuz-linux root=/dev/sda3 ro quiet splash
Press b 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.


  • Add them to /etc/lilo.conf:
        quiet splash

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



参数 说明
init Run specified binary instead of /sbin/init as init process. The systemd-sysvcompat package symlinks /sbin/init to /usr/lib/systemd/systemd to use systemd. Set it to /bin/sh to boot to the shell.
initrd Specify the location of the initial ramdisk. For UEFI boot managers and EFISTUB, the path must be specified using backslashes (\) as path separators.
cryptdevice Specify the location of a dm-crypt-encrypted partition plus a device mapper name.
debug Enable kernel debugging (events log level).
lsm Set the initialisation order of the Linux security modules, used to enable AppArmor, SELinux or TOMOYO.
maxcpus Maximum number of processors that an SMP kernel will bring up during bootup.
mem Force usage of a specific amount of memory to be used.
netdev 网络设备参数。
nomodeset Disable Kernel mode setting.
panic Time before automatic reboot on kernel panic.
resume Specify a swap device to use when waking from hibernation.
ro Mount root device read-only on boot (default1).
root 根文件系统。See init/do_mounts.c for kernel's supported device name formats. Note that an initramfs with udev supports more name formats.
rootflags Root filesystem mount options. Useful for setting options that cannot be applied by remounting (i.e. by systemd-remount-fs.service(8)). For example, the discard option of an XFS root volume.
rw Mount root device read-write on boot.
systemd.unit 启动到特定的目标
video Override framebuffer video defaults.

1 mkinitcpio uses ro as default value when neither rw or ro is set by the boot loader. Boot loaders may set the value to use, for example GRUB uses rw by default (see FS#36275 as a reference).