Home Computer Tutorials Computer Knowledge How to add/remove kernel boot parameters/parameters and GRUB boot script on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams

How to add/remove kernel boot parameters/parameters and GRUB boot script on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams

Mar 20, 2024 pm 05:36 PM
linux fedora rhel

如何在Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS流上添加/删除内核引导参数/参数和GRUB引导脚本

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:

  1. All GRUBboot on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  2. Display specific GRUB boot items on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  3. Add new kernel boot arguments/parameters to all GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  4. Add new kernel boot arguments/parameters to specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
  5. Remove kernel boot parameters/parameters from all GRUBBoot NTFS on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS streams
  6. Remove kernel boot parameters/parameters from specific GRUB boot entries on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  7. Add GRUB boot entry with custom kernel parameters/parameters on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  8. Set the GRUB boot entry as the default entry on Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS Stream
  9. Remove a GRUB boot entry from the Fedora/RHEL/AlmaLinux/Rocky Linux/CentOS stream
  10. 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:

  1. The index number
  2. Full kernel path
  3. Kernel boot parameters are also called kernel parameters
  4. Full path to the root file system
  5. Full path to "initrd" file
  6. Title of GRUB boot entry
  7. 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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is Linux actually good for? What is Linux actually good for? Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to monitor Nginx SSL performance on Debian How to monitor Nginx SSL performance on Debian Apr 12, 2025 pm 10:18 PM

This article describes how to effectively monitor the SSL performance of Nginx servers on Debian systems. We will use NginxExporter to export Nginx status data to Prometheus and then visually display it through Grafana. Step 1: Configuring Nginx First, we need to enable the stub_status module in the Nginx configuration file to obtain the status information of Nginx. Add the following snippet in your Nginx configuration file (usually located in /etc/nginx/nginx.conf or its include file): location/nginx_status{stub_status

How to start monitoring of oracle How to start monitoring of oracle Apr 12, 2025 am 06:00 AM

The steps to start an Oracle listener are as follows: Check the listener status (using the lsnrctl status command) For Windows, start the "TNS Listener" service in Oracle Services Manager For Linux and Unix, use the lsnrctl start command to start the listener run the lsnrctl status command to verify that the listener is started

How to set up a recycling bin in Debian system How to set up a recycling bin in Debian system Apr 12, 2025 pm 10:51 PM

This article introduces two methods of configuring a recycling bin in a Debian system: a graphical interface and a command line. Method 1: Use the Nautilus graphical interface to open the file manager: Find and start the Nautilus file manager (usually called "File") in the desktop or application menu. Find the Recycle Bin: Look for the Recycle Bin folder in the left navigation bar. If it is not found, try clicking "Other Location" or "Computer" to search. Configure Recycle Bin properties: Right-click "Recycle Bin" and select "Properties". In the Properties window, you can adjust the following settings: Maximum Size: Limit the disk space available in the Recycle Bin. Retention time: Set the preservation before the file is automatically deleted in the recycling bin

How to restart the apache server How to restart the apache server Apr 13, 2025 pm 01:12 PM

To restart the Apache server, follow these steps: Linux/macOS: Run sudo systemctl restart apache2. Windows: Run net stop Apache2.4 and then net start Apache2.4. Run netstat -a | findstr 80 to check the server status.

How to optimize the performance of debian readdir How to optimize the performance of debian readdir Apr 13, 2025 am 08:48 AM

In Debian systems, readdir system calls are used to read directory contents. If its performance is not good, try the following optimization strategy: Simplify the number of directory files: Split large directories into multiple small directories as much as possible, reducing the number of items processed per readdir call. Enable directory content caching: build a cache mechanism, update the cache regularly or when directory content changes, and reduce frequent calls to readdir. Memory caches (such as Memcached or Redis) or local caches (such as files or databases) can be considered. Adopt efficient data structure: If you implement directory traversal by yourself, select more efficient data structures (such as hash tables instead of linear search) to store and access directory information

See all articles