Linux command
kernelstub 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Print the current configuration
sudo kernelstub -p
Copy kernel and initrd to ESP
sudo kernelstub
Set kernel boot options
sudo kernelstub -o "quiet splash"
Add a kernel boot option
sudo kernelstub -a "nomodeset"
Remove a kernel boot option
sudo kernelstub -d "quiet"
Simulate actions
sudo kernelstub -c
说明
kernelstub is an automatic EFI System Partition (ESP) manager for booting Linux on UEFI systems. It copies the current kernel and initramfs images to the ESP so they are discoverable by EFI firmware and boot loaders, and sets up NVRAM boot menu entries for direct kernel booting (EFI stub booting). The tool automatically updates these entries when new kernel versions are installed. It can create systemd-boot compatible loader configurations and manages kernel boot parameters persistently via configuration files. It is primarily used on Pop!_OS, which uses systemd-boot instead of GRUB as its default bootloader.
参数
- -h, --help
- Display help text and exit.
- -c, --dry-run
- Simulate all actions without actually performing them.
- -p, --print-config
- Print the current configuration and exit.
- -e _PATH_, --esp-path _PATH_
- Manually specify the path to the EFI System Partition (default: /boot/efi).
- -r _PATH_, --root-path _PATH_
- The path where the root filesystem to use is mounted.
- -k _PATH_, --kernel-path _PATH_
- The path to the kernel image.
- -i _PATH_, --initrd-path _PATH_
- The path to the initrd image.
- -o _OPTIONS_, --options _OPTIONS_
- Set the complete kernel boot options (saves to config).
- -a _OPTIONS_, --add-options _OPTIONS_
- Add boot options to the configuration if not already present.
- -d _OPTIONS_, --delete-options _OPTIONS_
- Remove boot options from the configuration if present.
- -g _FILE_, --log-file _FILE_
- Path to the log file (default: /var/log/kernelstub.log).
- -l, --loader
- Create a systemd-boot compatible loader configuration (saves to config).
- -n, --no-loader
- Turn off creating loader configuration.
- -s, --stub
- Set up NVRAM entries for the copied kernel (saves to config).
- -m, --manage-only
- Only copy entries to ESP, do not set up NVRAM entries (saves to config).
- -f, --force-update
- Forcibly update loader.conf to set the new entry as default.
- -v, --verbose
- Increase verbosity. Use -vv for debug output.
FAQ
What is the kernelstub command used for?
kernelstub is an automatic EFI System Partition (ESP) manager for booting Linux on UEFI systems. It copies the current kernel and initramfs images to the ESP so they are discoverable by EFI firmware and boot loaders, and sets up NVRAM boot menu entries for direct kernel booting (EFI stub booting). The tool automatically updates these entries when new kernel versions are installed. It can create systemd-boot compatible loader configurations and manages kernel boot parameters persistently via configuration files. It is primarily used on Pop!_OS, which uses systemd-boot instead of GRUB as its default bootloader.
How do I run a basic kernelstub example?
Run `sudo kernelstub -p` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h, --help do in kernelstub?
Display help text and exit.