<base version>-<patch number>.tl<distribution identifier>.<architecture>, for example, 5.4.241-24.0017.14.tl3.x86_64.Field | Description | Example |
Base version | Major version | 5.4.241 |
Patch number | Minor version iteration | 24.0017.14 |
Distribution identifier | tl3/tl4 | tl3(TencentOS Server 3)/tl4(TencentOS Server 4) |
Architecture | CPU architecture identifier | x86_64,aarch64 |
sudo.cat /etc/rpm/macros.dist to confirm the distribution identifier (tl3 or tl4) and ensure that the downloaded kernel package suffix matches the system. Packages for tl3 and tl4 are not interchangeable.df -h /boot to check the available space.dnf repolist to verify source availability.scp kernel-*.rpm root@<target IP>:/root/) or by logging in to the CVM console via VNC and transferring the file.# Confirm current user privilegeswhoami # Expected output: root# Confirm the system distribution identifier (tl3 or tl4)cat /etc/rpm/macros.dist 2>/dev/null || rpm --eval '%{dist}'# Expected output: .tl3 or .tl4# Confirm the /boot partition space (at least 300 MB)df -h /boot# Expected output: The Avail column is no less than 300M.# Back up the GRUB configuration (perform this step before modifying the default boot kernel)cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak.$(date +%Y%m%d)
uname -r). Keep at least one backup kernel so that you can roll back if the system fails to boot.--force --nodeps to force-install a downgraded kernel may cause dependency issues. Make sure you have a backup boot plan, such as a GRUB menu entry that can roll back to the old kernel.System Version | Kernel Series | Base Kernel Version |
TencentOS Server 3 | Linux 5.4 LTS | 5.4.x |
TencentOS Server 4 | Linux 6.6 LTS | 6.6.x |
Package name | Description | Applicable Versions |
kernel-<version> | Main package | All versions |
kernel-<version>-core | Core module package | All versions |
kernel-<version>-modules | Driver module package | All versions |
Operation | Command | Description |
Install (keep the old kernel). | rpm -ivh | Recommended method. You can roll back to the previous kernel from the GRUB menu. |
Upgrade (replace the old kernel). | rpm -Uvh | Deletes the old kernel. Not recommended for production use. |
Force install (downgrade). | rpm -ivh --force --nodeps | Used to roll back to an earlier version. May cause dependency issues. |
# View the running kernel versionuname -r# Expected output example: 5.4.241-24.0017.14.tl3.x86_64# View all installed kernelsrpm -qa | grep kernel | sort# Expected output: List all installed kernel RPM packages# View distribution information (determine whether it is .tl3 or .tl4)cat /etc/rpm/macros.dist 2>/dev/null || rpm --eval '%{dist}'# Expected output: %dist .tl3 or %dist .tl4 (tl4 can be replaced by rpm --eval)
# View available kernel versionsdnf list kernel* --showduplicates | head -20# Expected output: List all available kernel version packages# Upgrade to the latest kerneldnf update kernel -y# Expected output: The installation/upgrade process is displayed, and "Complete!" is prompted at the end.# Or install a specific version (replace <version_number> with the actual version)dnf install kernel-<version_number> -y# Restart after the upgrade is complete (a restart will cause service interruption, so make sure a maintenance window has been scheduled before proceeding)reboot
# View the distribution identifier (tl3 or tl4)cat /etc/rpm/macros.dist 2>/dev/null | grep dist || rpm --eval '%{dist}'# Expected output: %dist .tl3 or %dist .tl4 (tl4 can be replaced by rpm --eval)
.tl3 or .tl4.kernel-* (main package), kernel-*-core (core module package), and kernel-*-modules (driver module package). All three packages must be installed together. When you use dnf for installation, dependencies are handled automatically, so you do not need to specify the three packages manually.-ivh to keep the old kernel or -Uvh to replace it:# New installation (keeps the old kernel, recommended — allows rollback from the GRUB menu)rpm -ivh kernel-5.4.241-24.0017.14.tl3.x86_64.rpm \\kernel-core-5.4.241-24.0017.14.tl3.x86_64.rpm \\kernel-modules-5.4.241-24.0017.14.tl3.x86_64.rpm# Expected output: The three packages are installed one by one, and "##### [100%]" is displayed at the end.
# Restart the system (a restart will cause service interruption, so make sure a maintenance window has been scheduled before proceeding)reboot# Verify the kernel version after restartuname -r# Expected output: The newly installed kernel version is displayed, for example, 5.4.241-24.0017.14.tl3.x86_64.
grubby tool to set the default kernel version for GRUB boot.# View the current default kernel booted by GRUBgrubby --default-kernel# Expected output: /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64
# List all installed kernel imagesls /boot/vmlinuz-*# Expected output:# /boot/vmlinuz-5.4.119-19.0009.13.tl3.x86_64# /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64# Or view via rpmrpm -qa | grep kernel | sort
# Set the specified kernel as the default boot kernel (replace <kernel-path> with the actual kernel path)grubby --set-default /boot/vmlinuz-<kernel-version># Example: grubby --set-default /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64# Expected output: The default is set to a nonzero entry. Success!
# Restart the system (a restart will cause service interruption, so make sure a maintenance window has been scheduled before proceeding)reboot# After restart, confirm that the currently running kernel is the default kernel you setuname -r# Expected output: 5.4.241-24.0017.14.tl3.x86_64 (consistent with the default kernel you set)# Confirm the default boot kernel configuration againgrubby --default-kernel# Expected output: /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64
# Attempting a regular installation of a lower kernel version will result in an error:# "package xxx (which is newer than xxx) is already installed"# Use --force --nodeps to force the installationrpm -ivh --force --nodeps kernel-5.4.119-19.0009.13.tl3.x86_64.rpm# Expected output: The installation progress is displayed, and "##### [100%]" is shown at the end.
# View all installed kernelsrpm -qa | grep kernel | sort# Expected output: List all installed kernel RPM packages# Remove the specified old kernel (make sure not to remove the currently running kernel)rpm -e kernel-5.4.119-19.0009.13.tl3.x86_64# Expected output: A message indicating that the uninstallation is complete.# Check /boot usagedf -h /boot# Expected output: Available space has increased.
# 1. Confirm that the new kernel is running.uname -r# Expected output: 5.4.241-24.0017.14.tl3.x86_64 (consistent with the target installation version)# 2. Confirm that the system starts up normally.systemctl --failed# Expected output: 0 loaded units listed (no failed services)# 3. Confirm the kernel boot order.grubby --default-kernel# Expected output: /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64
Operation Steps | Expected Output | Verification Method |
Upgrade the kernel online | dnf update prompts Complete! | rpm -q kernel-$(uname -r) |
Install the kernel offline | rpm -ivh prompts 100%. | ls /boot/vmlinuz-* lists the new kernel. |
Set the default boot kernel | grubby prompts Success! | grubby --default-kernel displays the target kernel. |
Downgrade installation | rpm -ivh --force prompts 100%. | uname -r displays the version after downgrade. |
Remove the old kernel | rpm -e uninstallation completed. | rpm -qa | grep kernel no longer lists the kernel. |
# 1. Confirm that the new kernel is installed.rpm -qa | grep kernel | sort# 2. View the current default boot kernel.grubby --default-kernel# 3. Set the new kernel as the default boot kernel.grubby --set-default /boot/vmlinuz-<kernel-version># Example: grubby --set-default /boot/vmlinuz-5.4.241-24.0017.14.tl3.x86_64# 4. Restart and verify (a restart will cause service interruption, so perform this operation within a maintenance window)rebootuname -r
rpm -ivh does not allow the installation of a lower version. You need to carefully evaluate the risks before using a force command to install it.# To install a lower version (downgrade), use --force --nodeps to force the installation.rpm -ivh --force --nodeps kernel-<version>.tl3.x86_64.rpm# To upgrade or replace with a higher version, use the -U parameter.rpm -Uvh kernel-<version>.tl3.x86_64.rpm
--force --nodeps may cause dependency conflicts or system instability. Ensure that a fallback boot option is available (for example, a rollback entry in the GRUB menu).kernel-core and kernel-modules, abnormal errors will occur. For example, the NIC cannot be initialized (ip addr shows no network interface), storage drivers fail to load (disk devices cannot be identified), lsmod shows an incomplete module list, and driver loading error messages appear in dmesg.# Install all three packages (replace <version_number> with the actual version)rpm -ivh kernel-<version>.tl3.x86_64.rpm \\kernel-core-<version>.tl3.x86_64.rpm \\kernel-modules-<version>.tl3.x86_64.rpm# Or use dnf to handle dependencies automatically.dnf install kernel-<version_number> -y
/boot partition is less than 300 MB, which is insufficient to accommodate the new kernel image.# 1. Check the available space in /boot.df -h /boot# 2. Clean up old kernels (keep the latest 2)package-cleanup --oldkernels --count=2# 3. Or manually remove unused old kernels (first confirm the currently running kernel)uname -r # Record the current kernel. Do not delete it.rpm -e kernel-<old_version>.tl3.x86_64# 4. If space is still insufficient after cleanup, expand the partition containing /boot. Proceed with caution and back up data before the operation.# On a CVM, /boot is typically located in the root partition. You can first expand the system disk in the console, and then extend the partition and file system:growpart /dev/vda 1 # Expand the partition (assuming the root partition is /dev/vda1)xfs_growfs / # Expand the file system (xfs). For ext4, use resize2fs /dev/vda1.# 5. Reinstall the target kernel.rpm -ivh kernel-<version>.tl3.x86_64.rpm
Esc or Shift to enter the GRUB boot menu.# View the logs from the last failed boot.journalctl -b -1 | tail -50# Expected output: A panic or driver loading failure message is displayed.# Confirm the system startup status.systemctl --failed
<old_version> with the actual kernel version (which can be queried by running rpm -qa | grep kernel):grubby --set-default /boot/vmlinuz-<old_version>
피드백