CentOS/RHEL/OEL 6 无法启动,报错 VFS: Cannot open root device
之路教程 https://onitr oad .com

解决方案

安装的最新内核版本没有更新 /etc/grub.conf 文件中的 initrd 行

# grep -v "^#" /boot/grub/grub.conf | egrep 'Oracle Linux Server|initrd'
title Oracle Linux Server Unbreakable Enterprise Kernel (2.6.39-400.325.1.el6uek.x86_64)
<..initrd line missing ..>
title Oracle Linux Server Red Hat Compatible Kernel (2.6.32-754.35.1.el6.x86_64)
initrd /initramfs-2.6.32-754.35.1.el6.x86_64.img
title Oracle Linux Server Unbreakable Enterprise Kernel (2.6.39-400.298.2.el6uek.x86_64)
initrd /initramfs-2.6.39-400.298.2.el6uek.x86_64.img

initrd 文件是为最新内核创建的

# ls -l /boot/initramfs-2.6.39-400.325.1.el6uek.x86_64.img
-rw-r--r-- 1 root root 23940723 Dec 2 06:07 /boot/initramfs-2.6.39-400.325.1.el6uek.x86_64.img
# du -hs /boot/initramfs-2.6.39-400.325.1.el6uek.x86_64.img
23M /boot/initramfs-2.6.39-400.325.1.el6uek.x86_64.img
  1. 备份当前配置 /etc/grub.conf 文件。

  2. 编辑 /etc/grub.conf 文件并添加缺少的行。
    例如:

initrd /initramfs-2.6.39-400.325.1.el6uek.x86_64.img
  1. 用最新的内核重启。

  2. 如果上述操作失败,则启动到旧内核并重新安装最新内核,以正确更新 grub.conf。
    例如:

# yum reinstall kernel-uek-2.6.39-400.325.1.el6uek.x86_6

问题

服务器无法使用最新内核启动,控制台日志中出现以下错误:

Initializing network drop monitor service
md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
VFS: Cannot open root device "UUID=[UUID]" or unknown-block(0,0)  《----------
VFS: 无法打开root设备
Please append a correct "root=" boot option; here are the available partitions: 《----------
请附加正确的“root=”引导选项; 以下是可用分区:

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Pid: 1, comm: swapper Not tainted 2.6.39-400.325.1.el6uek.x86_64 #1
Call Trace:
 [] panic+0xa6/0x1bd
 [] ? printk+0x41/0x47
 [] mount_block_root+0x1ea/0x29e
 [] mount_root+0x56/0x5a
 [] prepare_namespace+0x170/0x1a9
 [] kernel_init+0x2aa/0x2c0
 [] kernel_thread_helper+0x4/0x10
 [] ? parse_early_options+0x20/0x20
 [] ? gs_change+0x13/0x13

服务器使用旧内核成功启动。

日期:2020-09-17 00:12:22 来源:oir作者:oir