我正在尝试更新 CentOS 内核。我已经运行yum check-update
并sudo yum -y update
获取最新的软件包和内核。现在它列出了两个内核:
# yum list kernel
Installed Packages
kernel.x86_64 3.10.0-1062.9.1.el7 installed
kernel.x86_64 3.10.0-1160.15.2.el7 @updates
我已经尝试重新启动。但是,它仍然显示旧的 3.10.0-1062.9.1.el7 内核处于活动状态。
# uname -r
3.10.0-1062.9.1.el7.x86_64
我尝试查看 grub 但它仍然只列出旧的 3.10.0-1062
# cat /etc/grub2.cfg | grep 3.10
$linux ($root)//vmlinuz-3.10.0-1062.9.1.el7.x86_64 ${extra_cmdline} net.ifnames=0 biosdevname=0 quiet elevator=noop pti=off nomodeset nofb vga=normal console=tty1 console=ttyS0 console=hvc0 root=UUID=ddac8416-8037-4b93-a480-71c74b7ee6e7 rw
$initrd ($root)//initramfs-3.10.0-1062.9.1.el7.x86_64.img
$linux ($root)//vmlinuz-3.10.0-1062.9.1.el7.x86_64 ${extra_cmdline} net.ifnames=0 biosdevname=0 quiet elevator=noop pti=off nomodeset nofb vga=normal console=tty1 console=ttyS0 console=hvc0 root=UUID=ddac8416-8037-4b93-a480-71c74b7ee6e7 rw ide=nodma apm=off noresume edd=off nomodeset 3
$initrd ($root)//initramfs-3.10.0-1062.9.1.el7.x86_64.img
我尝试删除“旧”内核但没有成功
package-cleanup --oldkernels --count=1
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Not removing kernel 3.10.0-1062.9.1.el7 because it is the running kernel
No old kernels to remove
如何安装/使用这个新内核?
编辑(更多输出):
# rpm -q kernel
kernel-3.10.0-1062.9.1.el7.x86_64
kernel-3.10.0-1160.15.2.el7.x86_64
# yum install kernel
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: d2lzkl7pfhq30w.cloudfront.net
Package kernel-3.10.0-1160.15.2.el7.x86_64 already installed and latest version
Nothing to do
# ls -l /etc/grub2.cfg
lrwxrwxrwx. 1 root root 22 Mar 2 10:49 /etc/grub2.cfg -> ../boot/grub2/grub.cfg
编辑 (使固定):我从头开始,更新时注意到以下错误。
grubby fatal error: unable to find a suitable template
以下命令和重新启动应用了新内核
grub2-mkconfig -o /boot/grub2/grub.cfg
归功于https://serverfault.com/questions/673486/grubby-fatal-error-unable-to-find-a-suitable-template