Centos7 升级内核后启动引导无内核选项

Centos7 升级内核后启动引导无内核选项

centos7 rpm 安装新内核后系统重启无新内核选项

[root@centos7ext4 ~]# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-3.10.0-1062.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/centos-root
initrd=/boot/initramfs-3.10.0-1062.el7.x86_64.img
title=CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)
index=1
kernel=/boot/vmlinuz-0-rescue-60994e9db5384fc29d09f5f727ad3d66
args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
root=/dev/mapper/centos-root
initrd=/boot/initramfs-0-rescue-60994e9db5384fc29d09f5f727ad3d66.img
title=CentOS Linux (0-rescue-60994e9db5384fc29d09f5f727ad3d66) 7 (Core)
index=2
non linux entry

查看启动内核信息,新内核都未被追加启动选项,rpm -ivh 新内核问题依旧

[root@centos7ext4 ~]# ll /boot
总用量 129036
-rw-r--r--. 1 root root   152976 88 2019 config-3.10.0-1062.el7.x86_64
-rw-r--r--. 1 root root   153619 54 23:25 config-3.10.0-1160.90.1.el7.x86_64
drwxr-xr-x. 3 root root     4096 65 17:19 efi
drwxr-xr-x. 2 root root     4096 65 17:20 grub
drwx------. 5 root root     4096 614 12:27 grub2
-rw-------. 1 root root 61475778 65 17:25 initramfs-0-rescue-60994e9db5384fc29d09f5f727ad3d66.img
-rw-------. 1 root root 21182999 65 17:29 initramfs-3.10.0-1062.el7.x86_64.img
-rw-------. 1 root root 20736499 614 11:48 initramfs-3.10.0-1160.90.1.el7.x86_64.img  ###新内核信息
drwx------. 2 root root    16384 65 17:18 lost+found
-rw-r--r--. 1 root root   318717 88 2019 symvers-3.10.0-1062.el7.x86_64.gz
-rw-r--r--. 1 root root   320760 54 23:25 symvers-3.10.0-1160.90.1.el7.x86_64.gz
-rw-------. 1 root root  3594971 88 2019 System.map-3.10.0-1062.el7.x86_64
-rw-------. 1 root root  3623956 54 23:25 System.map-3.10.0-1160.90.1.el7.x86_64
-rwxr-xr-x. 1 root root  6734016 65 17:25 vmlinuz-0-rescue-60994e9db5384fc29d09f5f727ad3d66
-rwxr-xr-x. 1 root root  6734016 88 2019 vmlinuz-3.10.0-1062.el7.x86_64
-rwxr-xr-x. 1 root root  7051880 54 23:25 vmlinuz-3.10.0-1160.90.1.el7.x86_64  ###新内核信息
[root@centos7ext4 ~]# 

查看boot目录已存在1160新内核文件

参照grubby --info=ALL旧内核信息编写新内核引导

grubby --add-kernel=/boot/vmlinuz-3.10.0-1160.90.1.el7.x86_64  \
--args="root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8"    \
--initrd=/boot/initramfs-3.10.0-1160.90.1.el7.x86_64.img \
--title="3.10.0-1160.90.1.el7.x86_64"
查看系统内的启动内核
[root@centos7ext4 ~]# sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : 3.10.0-1160.90.1.el7.x86_64
1 : CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-60994e9db5384fc29d09f5f727ad3d66) 7 (Core)


更改启动内核
sudo grub2-set-default (0~N)

[root@centos7ext4 ~]# grub2-editenv list
saved_entry=0


[root@centos7ext4 ~]# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-3.10.0-1160.90.1.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/centos-root
initrd=/boot/initramfs-3.10.0-1160.90.1.el7.x86_64.img
title=3.10.0-1160.90.1.el7.x86_64
index=1
kernel=/boot/vmlinuz-3.10.0-1062.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/centos-root
initrd=/boot/initramfs-3.10.0-1062.el7.x86_64.img
title=CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)
index=2
kernel=/boot/vmlinuz-0-rescue-60994e9db5384fc29d09f5f727ad3d66
args="ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
root=/dev/mapper/centos-root
initrd=/boot/initramfs-0-rescue-60994e9db5384fc29d09f5f727ad3d66.img
title=CentOS Linux (0-rescue-60994e9db5384fc29d09f5f727ad3d66) 7 (Core)
index=3
non linux entry
[root@centos7ext4 ~]# 

重启OK

你可能感兴趣的:(linux,服务器,运维,centos)