You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将CentOS 6内核升级至最新版本?升级后重启仍无法使用最新内核

Hey there, let's tackle this CentOS 6 kernel upgrade issue where the system isn't booting into the new kernel after restart. I've seen this pop up a lot, so let's break it down step by step.

Step 1: Confirm installed kernels and current running kernel

First, let's verify that the new kernel was actually installed successfully, and check which kernel your system is currently using:

  • List all installed kernels with:
    rpm -qa | grep kernel
    
  • Check the currently running kernel:
    uname -r
    

Compare the output—you should see the newer kernel version in the installed list, but it won't match the running one if the issue persists.

Step 2: Inspect the GRUB configuration (CentOS 6 uses GRUB Legacy)

CentOS 6 relies on GRUB Legacy, and its config file lives at /boot/grub/grub.conf. This file controls which kernel the system boots into by default.

  • View the config with:
    cat /boot/grub/grub.conf
    

Look for two key parts:

  1. The default line (e.g., default=0)—this is the index of the boot entry GRUB uses (count starts at 0).
  2. The title entries below—each corresponds to a kernel version. Find the title line for your new, upgraded kernel.

For example, if your new kernel is the second title entry in the list, its index is 1. If the default value is set to 0 (the old kernel), that's exactly why your system isn't booting into the new one.

Step 3: Set the default kernel to the new version

Now let's update the GRUB config to prioritize the new kernel:

  1. Open the config file with a text editor (like vi):
    vi /boot/grub/grub.conf
    
  2. Find the default line and change its value to the index of your new kernel's title entry.
  3. Save and exit the editor (in vi, type :wq and press Enter).

Alternatively, you can use the grub-set-default command to set the index directly, like:

grub-set-default 1

Just replace 1 with the correct index for your new kernel.

Step 4: Verify and reboot

Double-check that the default value is correct by re-running cat /boot/grub/grub.conf, then reboot your system:

reboot

Once it's back up, run uname -r again—you should see the new kernel version listed now.

Troubleshooting note

If this still doesn't work, it's possible the new kernel's initramfs wasn't generated properly during installation. You can regenerate it manually with:

mkinitrd -f /boot/initramfs-<new-kernel-version>.img <new-kernel-version>

Replace <new-kernel-version> with the full version string of your upgraded kernel (from the rpm -qa output), then repeat the GRUB config check and reboot.


内容的提问来源于stack exchange,提问作者Chloe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:41:33