


How to add/remove kernel boot parameters/parameters and GRUB boot script on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
On Fedora 39, RHEL 9, AlmaLinux 9, Rocky Linux 9, and CentOS Stream 9 Linux distributions, you can use the grubby program to manage GRUB boot entries.
In this article, we will show you how to use GRUBY to add/remove kernel boot parameters from the GRUB boot entry on Fedora, RHEL, AlmaLinux, Rocky Linux and CentOS Stream. We will also show you how to add/remove customized GRUB boot entries and set specific GRUB boot entries as default using GRUBY on Fedora, RHEL, AlmaLinux, Rocky Linux, and CentOS Stream.
Content topic:
- All GRUBboot on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Display specific GRUB boot items on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Add new kernel boot arguments/parameters to all GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Add new kernel boot arguments/parameters to specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
- Remove kernel boot parameters/parameters from all GRUBBoot NTFS on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
- Remove kernel boot parameters/parameters from specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Add GRUB boot entry with custom kernel parameters/parameters on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Set the GRUB boot entry as the default entry on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
- Remove a GRUB boot entry from the Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS stream
- in conclusion
All GRUBboot on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
To list all GRUB boot entries for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streaming systems, run grubby as follows:
$sudo grubby --info = ALL
As you can see, all GRUB boot entries (X2) for the CentOS Stream 9 system are listed.
Each boot entry has:
- The index number
- Full kernel path
- Kernel boot parameters are also called kernel parameters
- Full path to the root file system
- Full path to "initrd" file
- Title of GRUB boot entry
- The ID of the configuration file for this boot entry (can be found in the "/ot/loader/entry/" directory)
Display specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
You can use GRUBY to display information about specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems.
To display information about the default GRUB boot entry, run the following command:
$sudo grubby --info=default
The default GRUB boot entry should be displayed.
You can also display information about GRUB boot entries at a specific index. Index numbers start from 0.
To display information about the first GRUB boot entry (at index 0), run the following command:
$sudo grubby——info=0
Similarly, you can use the following command to display information for the second GRUB boot entry (at index 1), and so on:
$sudo grubby——info=1
Add new kernel boot arguments/parameters to all GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
To add a kernel boot parameter/parameter (such as "nomodeset") to all GRUB boot entries in Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems, run the following command:
$sudo gRUBY–UPDATE-KERNEL=all–args=‘noodeset’
To add multiple kernel boot arguments/parameters (e.g. "onomodeset" and "nouveau.Blacklist=1") to all GRUB boot entries for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems, separate them with spaces Kernel boot parameters/parameters as follows:
$sudo grubby——update—core = ALL——args =’nomodeset nouveau. blacklist = 1 ‘
As you can see, the kernel boot parameters/parameters "nomodeset" and "nouveau.blacklist = 1" are added to all GRUB boot entries.
$sudo grubby --info = ALL
Add new kernel boot arguments/parameters to specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
To add kernel boot parameters/arguments (such as "selinux=0") to the default GRUB boot entry of Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems, please run the following command:
$sudo grubby --update-core=default --args='selinux=0 '
To add multiple kernel boot parameters/parameters (such as "selinux=0" and "ipv6.disable=1") to the default GRUB boot entry for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streaming systems, please Use spaces to separate kernel boot arguments/parameters like this:
$sudo gRUBY–UPDATE-KERNEL=DEFAULT–args=‘selinux=0 ipv6.able=1’
Similarly, you can add kernel boot parameters/parameters to the GRUB boot entry at a specific index (e.g. index 0) like this:
$sudo grubby——update—core=0——args=’selinux=0 ipv6.disable=1 ‘
As you can see, the kernel boot parameters/parameters "selinux=0" and "ipv6.disable=1" are only added to the default (index 0) GRUB boot entry.
$sudo grubby --info = ALL
Remove kernel boot parameters/parameters from all GRUBBoot NTFS on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
To remove kernel boot parameters/parameters (such as "nomodeset") from all GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streaming systems, run the following command:
$sudo grubby——update—core = ALL——remove—args =’nomodeset ‘
To remove multiple kernel boot arguments/parameters (such as "onomodeset" and "nouveau.Blacklist=1") from all GRUB boot entries for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems, separate them with spaces Kernel boot parameters/parameters as follows:
$sudo grubby——update—core = ALL——remove—args =’nomodeset nouveau. blacklist = 1 ‘
As you can see, the kernel boot parameters/parameters "nomodeset" and "nouveau.blacklist=1" are removed from all GRUB boot entries.
$sudo grubby --info = ALL
Remove kernel boot parameters/parameters from specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
To remove kernel boot parameters/parameters from the default GRUB boot entry for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streaming systems (assuming "selinux = 0"), run the following command:
$sudo grubby——update—core=Default——remove—args=’selinux=0 ‘
To remove multiple kernel boot parameters/parameters (such as "selinux=0" and "ipv6.disable=1") from the default GRUB boot entry for Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streaming systems, use Space separated kernel boot arguments/arguments as follows:
$sudo grubby --update-core=default --remove-args='selinux=0 ipv6.disable=1 '
Similarly, you can remove kernel boot parameters/parameters from the GRUB boot entry at a specific index (e.g. index 0) as follows:
$sudo grubby——update—core=0——remove—args=’selinux=0 ipv6.disable=1 ‘
As you can see, the kernel boot parameters/parameters "selinux=0" and "ipv6.able=1" are only removed from the default (index 0) GRUB boot entry.
$sudo grubby --info=default
Add GRUB boot entry with custom kernel parameters/parameters on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
Sometimes, it is better to create a copy of the default GRUB boot entry and modify the kernel parameters/parameters on the copied GRUB boot entry rather than destroying the factory default GRUB boot entry.
To create a copy of the default GRUB boot entry, you need to know the full kernel path and "initrd" path of the default GRUB boot entry.
To find the complete kernel path and the "initrd" path of the default GRUB boot entry, run the following command:
$sudo grubby --info=default
The full kernel path [1] and "initrd" path [2] of the default GRUB boot entry should be displayed. Please pay attention to this information.
To create a copy of the default GRUB boot entry using the kernel path and "initrd" path found in the output of the previous command, run the following command:
$sudo grubby——copy—default
——add—core=”/boot/vmlinuz—5.14.0—391.el9.x86_64″
——initrd =”/boot/initramfs—5.14.0—391.el9.x86_64.img $tuned_initrd”
——title="$(cat/etc/redhat—release)—Disable SELinux—$(uname—r)"
Note: Please make sure to replace the kernel path and "initrd" path with the paths in the "-add-core=" and "-initrd=" sections respectively. Additionally, use a descriptive title for the GRUB boot entry in the "-title=" section.
Note: In "-title", "$(cat/etc/redhat-release)" is replaced by the operating system and version name (i.e. CentOS Stream 9), and "$(uname-r)" is replaced by The version number of the currently used Linux kernel (i.e. 5.14.0—391.el9.x86_64).
A new GRUB boot entry should be created.
As you can see, a new GRUB boot entry [1] was created at index 0 [2].
$sudo grubby --info = ALL
You can use grubby "--args" option to add new kernel parameters/parameters, and use "--remove-args" option to remove kernel parameters/parameters from the newly created GRUB boot entry (at index 0).
For example, to add the "selinux = 0" kernel parameter/parameter and remove the "quiet" kernel parameter/parameter from the newly created GRUB boot entry (at index 0), run the grubby command as follows:
$sudo grubby --update-core=0 --args="selinux=0" --remove-args="quiet"
As you can see, the "selinux=0" kernel parameter/parameter is added and the "quiet" kernel parameter/parameter is removed from the newly created GRUB boot entry (at index 0).
$sudo grubby——info=0
Set the GRUB boot entry as the default entry on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
After you create a custom GRUB boot entry, you may want to set it as the default GRUB boot entry for your computer/server so that your computer/server boots with it by default.
You can find the index of the default GRUB boot entry using the following command:
$sudo grubby——default—index
As you can see, the default index is 1.
The index of the custom GRUB boot entry we added is 0.
To set a custom GRUB boot entry as the default, run the following command:
$sudo gRubby–set-default-index=0
The GRUB boot entry at index 0 should be set as the default boot entry.
As you can see, the customized GRUB boot entry is set as the default boot entry.
Customized GRUB boot items are automatically selected from the GRUB boot loader.
As you can see, the custom GRUB boot entry contains all the custom kernel parameters/parameters we configured.
Remove a GRUB boot entry from the Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS stream
You can also use GRUBY to delete GRUB boot entries from Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream systems.
We created a new GRUBboot entry [1] at index 0 [1] to demonstrate the process of removing GRUBboot entry using grubby.
To delete the GRUB boot entry at index 0, run the following command:
$sudo grubby——remove—core = 0
As you can see, the GRUB boot entry was removed and the index was resized.
in conclusion
In this article, we show you how to list GRUB boot entries using grubby. We also showed you how to use grubby to add kernel boot parameters/parameters to a GRUB boot entry, and how to use grubby to remove kernel boot parameters/parameters from a GRUB boot entry. We also show you how to add/remove custom GRUB boot entries using grubby. Finally, we showed you how to use grubby to set a GRUB boot entry as the default. The process shown in this article should work on Fedora, RHEL, AlmaLinux, Rocky Linux and CentOS Stream operating systems.
The above is the detailed content of How to add/remove kernel boot parameters/parameters and GRUB boot script on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.
