Kernel Panic on VFS: Unable to mount root fs on unknown-block(x,y) (转)

或许在Gentoo Linux系统上最烦人然而最常出现的问题是Unable to mount root fs on unknown-block(x,y) 错误。但是,如果 你知道你的系统里有什么硬件,多数都容易解决。

首先,让我们看一看你得到的错误:

  VFS: Cannot open root device "sda1" or unknown-block(8,1)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

这是Linux内核在反映它不能访问你在Linux启动引导程序定义的根分区。从错误已能够明白Linux对你选择的根分区有什么想法,即"/dev/sda1" (从第一行获知)。

如果这个根分区被错误设置那么这是你最可能的问题。说来遗憾,多数人都没犯这个错误 - 它内核配置的错误。让我们看看一个可能在Fujitsu Siemens Amilo PRO笔记本上配置不当的内核的例子。我能准确地告诉你它使用一个Intel ICH6M SATA控制器。我怎么知道的?唔,lspci 告诉我如此。

lspci 是所有人在配置他们内核的时候应该使用的工具之一,因为它几乎告诉你需要选择什么内核选项。而且这是当你得到我们之前讨论过的VFS-error时你需要做的。

难道我们不应该越过这些Fujitsu笔记本的例子吗?

  00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML 
Express Processor to DRAM Controller (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML
Express Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML
Express Graphics Controller (rev 03)

这已是更有趣。PCI桥接器允许CPU和PCI总线间通讯。PCI总线对于我们面临的访问问题是一个重要的成分因为控制器很可能在PCI总线上(如果不是,它是ISA总线但现在应该被废除)。

在VFS-problem中,这些东西我能独自留下因为它们与我们关注分区访问问题没多大关系。

  00:1c.0 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
PCI Express Port 1 (rev 04)
00:1c.1 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
PCI Express Port 2 (rev 04)

那么,在此我们一定需要什么?恩,PCI桥接器是PCI Express家庭的一员,而且这需要特定的内核配置去激活:

  Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
[x] PCI support
...
[x] PCI Express support

太好了,我们已经有了,所以那可以了。下面的条目能被跳过因为现在它们令人不感兴趣。提醒你一下,它们对于内核配置是十分重要的因为它帮助你决定你要选择的其他驱动!

  00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
USB UHCI #1 (rev 04)
00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #2 (rev 04)
00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #3 (rev 04)
00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #4 (rev 04)
00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB2 EHCI Controller (rev 04)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d4)
00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) AC'97 Audio Controller (rev 04)
00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
AC'97 Modem Controller (rev 04)
00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 04)
00:1f.1 IDE interface: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
IDE Controller (rev 04)

等一下!最后一行说我们有个IDE控制器。对,真的,这笔记本有一个IDE DVD-R/W设备。知道是好的,尽管这与我们的VFS-panic问题无关 ;-) 我们看到的下一行然而对问题 重要的:

  00:1f.2 SATA controller: Intel Corporation 82801FBM (ICH6M) SATA Controller (rev 04)

我们需要验证我们已建成Intel SATA控制器支持。欲找出内核设定的位置,当你在make menuconfig 菜单时你可以搜索选项: / SATA会给你一个SATA设置选项的列表。通过那列表,你能看见SATA支持(至少我能现在在内核使用)的位置。因此我检查下一个内核设置选项:

  Device Drivers --->
SCSI device support --->
...
<*> SCSI disk support
...
SCSI low-level drivers --->
<*> Serial ATA (SATA) support
...
<*>Intel PIIX/ICH SATA Support

那看起来也好。lspci 剩下的输出没有给出现在我们确切需要的任何其他设备。这样我们的问题是什么?

嗯,其实上面的我们可以全部跳过(但是如果我做了,这对一个解释不算多对吗?)因为错误在unknown-block(8,1)开始。因为数字不是 (0,0)所以我能确信内核支持分区的驱动因为数字识别设备分区的数目(SCSI硬盘,第一分区)。如是或我没有一个那样的设备(别笑,我见许多人认为他们有 /dev/hda3事实上是/dev/sda3的时候)或在那设备上的文件系统不能被读取。

根设备上的文件系统是ext3,那么我们看内核配置说什么:

  File systems --->
Second extended fs support
...
Ext3 journalling file system support
...

你知道这里的问题吗?Ext3支持(还有ext2支持,兼容于ext3)并未建入内核但建成一个模块。但是模块处于那个分区上,内核不能访问分区因为它不知到上面的文件系统是什么。因此把这个改成:

  File systems --->
<*> Second extended fs support
...
<*> Ext3 journalling file system support
...

现在重编译内核,把它复制到/boot并重启。

现在初始ramdisks什麽情況?唔,一樣是真的,除外你能有大部分之前谈过的模块(置入initrd)但是你需要Initial Ramdisk支持和RomFS置入内核代替。

如果還有其他储存器有关的东西(像LVM,软件还有软RAID,等)?那么,在这里同样的逻辑是對的,尽管你很有可能需要一个不仅加载适当的内核模 块,而且还初始化存储器的initrd(LVM卷组,MD设备,萬一還有RAID) ,所以如果你选择这些技术为你的根设备,请务必读好文档!


Probably the most annoying yet most occurring issue on Gentoo Linux systems
is the Unable to mount root fs on unknown-block(x,y) error. However,
resolving it is most of the time simple if you know what hardware
you have in your system...

First of all, let's take a look at the error that you get:

  VFS: Cannot open root device "sda1" or unknown-block(8,1)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

This is the Linux kernel telling you that it cannot access the root device you
have selected in the Linux definition of your bootloader. From the error you
can already see what Linux thinks you have selected as root device, namely
the "/dev/sda1" (taken from the first line).

If this root device is wrongly set then this is most likely your issue. Sadly,
most people have this right - it is the kernel configuration that's wrong. Let
us take a look at an example run-down of possible mis-configuration in a kernel
for a Fujitsu Siemens Amilo PRO laptop. I can safely tell you that it uses an
Intel ICH6M SATA controller. How do I know this? Well, lspci told me so.

The lspci tool is one that everyone should use when configuring their
kernel as it almost tells you what kernel options you need to select. And this
is exactly what you should do when you get the VFS-error we talked about earlier.
Why? Because the most likely reason for the error is because the kernel doesn't
support the PCI controller, doesn't support the SATA/IDE controller, doesn't
support SCSI/IDE disks and/or doesn't support the file system that you use on
the root partition (mind you: support for that file system must be built-in in
the kernel).

Let's cross this with the example of the Fujitsu laptop shall we?

  00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML 
Express Processor to DRAM Controller (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML
Express Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML
Express Graphics Controller (rev 03)

These things I can leave alone for this VFS-problem as they are not related to
the partition access problem we are looking at.

  00:1c.0 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
PCI Express Port 1 (rev 04)
00:1c.1 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
PCI Express Port 2 (rev 04)

This is already more interesting. PCI bridges allow for communication between
the CPU and the PCI bus. The PCI bus is an important component for our access
problem we face because the controller will most likely reside on the PCI bus
(if not, its an ISA controller and those should be extinct by now).

So, what do we definitely need for this? Well, the PCI bridge is of the PCI
Express family, and this requires a specific kernel configuration to be activated:

  Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
[x] PCI support
...
[x] PCI Express support

Great, we had that, so that's okay. The next lines again can be skipped as they
are not of interest now. Mind you, they are quite important for kernel configuration
as it helps you decide what other drivers you need to select!

  00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
USB UHCI #1 (rev 04)
00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #2 (rev 04)
00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #3 (rev 04)
00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB UHCI #4 (rev 04)
00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
USB2 EHCI Controller (rev 04)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d4)
00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW
(ICH6 Family) AC'97 Audio Controller (rev 04)
00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
AC'97 Modem Controller (rev 04)
00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 04)
00:1f.1 IDE interface: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family)
IDE Controller (rev 04)

Wait a minute! The last line sais that we have an IDE controller. Right, true,
this laptop has an IDE DVD-R/W device. Good to know, even though this is not
related to our VFS-panic issue ;-) The next line we see however is
important for this:

  00:1f.2 SATA controller: Intel Corporation 82801FBM (ICH6M) SATA Controller (rev 04)

We need to verify that we have built in Intel SATA Controller support. To find
out where in the kernel this definition is set, you can use the search option
when you are inside the make menuconfig menu: / SATA will give
you a list of configuration options for SATA. From that list, you can see where
the SATA support (at least in the kernel I currently use) is at. So I verify
the next set of kernel options:

  Device Drivers --->
SCSI device support --->
...
<*> SCSI disk support
...
SCSI low-level drivers --->
<*> Serial ATA (SATA) support
...
<*>Intel PIIX/ICH SATA Support

That seems fine as well. The rest of the lspci output doesn't give any
other devices that we definitely need right now. So what is the problem then?

Well, actually we could skip all of the above (but if I did that, this wouldn't
be much of an explanation would it?) because the error stated
unknown-block(8,1). Because the numbers aren't (0,0) I could
actually identify that the kernel does support the drivers for the partition
because the numbers identify the major/minor number of the device (SCSI disk,
first partition). So either I don't have such a device (don't laugh, I see many
people thinking they had /dev/hda3 while in fact it was /dev/sda3)
or the file system on that device cannot be read.

The file system on the root device is ext3, so let see what the kernel configuration
sais:

  File systems --->
Second extended fs support
...
Ext3 journalling file system support
...

You see the problem here? Ext3 support (and ext2 support, which is compatible with
ext3) is not built in the kernel but built as a module. But the module resides
on the partition, which the kernel can't access because it doesn't know what
file system is on it. So change this to:

  File systems --->
<*> Second extended fs support
...
<*> Ext3 journalling file system support
...

Now rebuild the kernel, copy it to /boot and reboot.

Now what in case of initial ramdisks? Well, the same is true, except that you
can have most of the stuff talked about earlier as modules (which are built in
the initrd) but you need Initial Ramdisk support and RomFS built-in into the
kernel instead.

And in case of other storage related things (like LVM, software and pseudo-hardware
RAID, etc)? Well, the same logic is true here, although you will most likely need
an initrd which not only loads the appropriate kernel modules, but also initializes
the storage (volume groups in case of LVM, MD devices in case of RAID), so if you select
such technologies for your root device, be sure to read the documentation well!

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值