错误信息:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
......
? rest_init +0x80/0x8
内核错误,修复内核
通过安装盘修复系统内核
2.开机后通过Linux rescue模式启动系统
CentOS Linux, with Linux 3.10.0-123.el7.x86_64
CentOS Linux, with Linux 0-rescue-2a2dbea94635410da853224798f0f17e
3.将安装盘挂载到/mnt/cdrom
[root@localhost ~]# mount -t auto /dev/cdrom /mnt/cdrom
4.修复系统内核
[root@localhost ~]# cd /mnt/cdrom/Packages
[root@localhost ~]# ls | grep kernel
#显示如下:
.....
kernel-3.10.0-123.el7.x86_64.rpm
......
#修复内核
[root@localhost ~]# rpm -ivh kernel-3.10.0-123.el7.x86_64.rpm --for
5.修复grub.cfg文件
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
6.重新启动,即可成功
[root@localhost ~]# reboot
其他命令:
1.查看系统可用内核
[root@localhost ~]# cat /boot/grub2/grub.cfg | grep menuentry
......
menuentry 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64'
......
menuentry 'CentOS Linux, with Linux 0-rescue-2a2dbea94635410da853224798f0f17e'
......
2.查看当前内核
[root@localhost ~]# uname -r
3.10.0-123.el7.x86_64
3.修改开机时默认使用的内核
[root@localhost ~]# grub2-set-default 'CentOS Linux, with Linux 3.10.0-123.el7.x86_64'
4.查看开机时默认内核
[root@localhost ~]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-123.el7.x86_64) 7 (Core)
5.查看系统安装了哪些内核包
[root@localhost ~]# rpm -qa | grep kernel
kernel-tools-libs-3.10.0-123.el7.x86_64
abrt-addon-kerneloops-2.1.11-12.el7.centos.x86_64
kernel-tools-3.10.0-123.el7.x86_64
kernel-devel-3.10.0-123.el7.x86_64
kernel-headers-3.10.0-123.el7.x86_64
kernel-3.10.0-123.el7.x86_64
6.使用yum remove 或rpm -e 删除无用内核,无法删除当前使用的内核
yum remove kernel-x.xx.x-xxx.xxx.x86_64