tencent cloud

Adding Kernel Parameters via GRUB on Linux Instances
Last updated:2025-11-25 11:27:45
Adding Kernel Parameters via GRUB on Linux Instances
Last updated: 2025-11-25 11:27:45

Scenarios

This document describes how to add kernel parameters via Grand Unified Bootloader (GRUB) on Cloud Virtual Machine (CVM) instances of Tencent Cloud. If you are using GRUB and want to modify or add kernel parameters, you can edit the GRUB configuration file. The following part describes the method for adding kernel boot parameters to the GRUB configuration file for specific distributions.

Example Operating Systems

This document uses CentOS 7.9, Ubuntu 24.04, OpenCloudOS 9, TencentOS Server 3.X, and TencentOS Server 4.X as example operating systems of CVM instances.

Prerequisites

Linux CVM instances have been purchased. If you have not purchased any CVM instance, see Purchasing a Customized Linux Instance.

Operation Steps

OpenCloudOS 9, TencentOS Server 3.X, and TencentOS Server 4.X systems have introduced the mainstream BLSCFG feature of GRUB in the industry. The default configurations are written in a fixed form to the entry file corresponding to /boot/loader/entries/. Therefore, modifying the general configuration file /etc/default/grub does not affect the kernel parameters of specific versions. Currently, the grubby tool is needed to modify the corresponding kernel parameters.
Perform the following operations based on your operating system version.
1. Log in to a Linux instance as described in Connecting to a Linux Instance via OrcaTerm (Recommended).
2. Add kernel boot parameters.
CentOS 7.9
Ubuntu 24.04
OpenCloudOS 9
TencentOS Server 3.X/TencentOS Server 4.X
1. Run the following command to edit the file /etc/default/grub.
vim /etc/default/grub
2. Press i to switch to the edit mode, locate the line GRUB_CMDLINE_LINUX, and add kernel parameters in the format of "name=value" to the end of GRUB_CMDLINE_LINUX. For example, the kernel parameter to be added is systemd.debug-shell=1.



3. Press Esc, enter :wq, save the file, and return to the command line.
4. Run the following command to regenerate the kernel configurations.
grub2-mkconfig -o /boot/grub2/grub.cfg
5. Run the following command to restart the instance.
reboot
6. Run the following command to check whether the modification is successful.
cat /proc/cmdline
If the returned result includes the added parameter, the addition is successful.



1. Run the following command to edit the file /etc/default/grub.
vim /etc/default/grub
2. Press i to switch to the edit mode, locate the line GRUB_CMDLINE_LINUX_DEFAULT, and add kernel parameters in the format of "name=value" to the end of GRUB_CMDLINE_LINUX_DEFAULT. For example, the kernel parameter to be added is systemd.debug-shell=1.



3. Press Esc, enter :wq, save the file, and return to the command line.
4. Run the following command to regenerate the kernel configurations.
grub-mkconfig -o /boot/grub/grub.cfg
5. Run the following command to restart the instance.
reboot
6. Run the following command to check whether the modification is successful.
cat /proc/cmdline
If the returned result includes the added parameter, the addition is successful.



1. Run the following command to add a kernel parameter.
grubby --update-kernel=ALL --args="systemd.debug-shell=1"
2. Run the following command to verify whether the addition is successful.
grubby --info ALL
If the added parameter is included as shown in the following figure, it indicates that the addition is successful.



3. Run the following command to restart the instance.
reboot
4. Run the following command to check whether the modification is successful.
cat /proc/cmdline
If the returned result includes the added parameter, the addition is successful.



1. Run the following command to add a kernel parameter.
grubby --update-kernel=ALL --args="systemd.debug-shell=1"
2. Run the following command to verify whether the addition is successful.
grubby --info ALL
If the added parameter is included as shown in the following figure, it indicates that the addition is successful.



3. Run the following command to restart the instance.
reboot
4. Run the following command to check whether the modification is successful.
cat /proc/cmdline
If the returned result includes the added parameter, the addition is successful.




Disabling the BLSCFG Feature and Reading the Traditional Kernel Parameter Configuration File

If GRUB_ENABLE_BLSCFG=true is set in /etc/default/grub, the system uses the BLSCFG feature of GRUB. If you want to disable the BLSCFG feature and add parameters using the traditional kernel parameter configuration file, set GRUB_ENABLE_BLSCFG=false in /etc/default/grub.

Operation Steps

Note:
This method applies to recent RHEL distributions, such as TencentOS Server 3.1 and TencentOS Server 3.2.
This method uses the traditional GRUB approach similar to that in CentOS 7, which reads configuration parameters from /etc/default/grub by default.
TencentOS Server 3.X/TencentOS Server 4.X
1. Run the following command to open the /etc/default/grub file.
vim /etc/default/grub
2. Press i to switch to the edit mode, locate the line GRUB_CMDLINE_LINUX, and add kernel parameters in the format of "name=value" to the end of GRUB_CMDLINE_LINUX. For example, the kernel parameter to be added is systemd.debug-shell=1.



3. Press Esc, enter :wq, save the file, and return to the command line.
4. Run the following command to disable the BLSCFG feature.
sed -i "s/GRUB_ENABLE_BLSCFG=true/GRUB_ENABLE_BLSCFG=false/g" /etc/default/grub
5. Run the following command to regenerate the kernel configurations.
grub2-mkconfig -o /boot/grub2/grub.cfg
6. Run the following command to restart the instance.
reboot
7. Run the following command to check whether the modification is successful.
cat /proc/cmdline
If the returned result includes the added parameter, the addition is successful.




Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback