kernelu-bootrootfs

Kernel panic when using usb device as rootfs


I formatted the usb drive and copied my rootfs files in. And modified the u-boot boot args : root=/dev/sda1. Then kernel panic:

[    5.910995] VFS: Cannot open root device "sda1" or unknown-block(0,0): error -6
[    5.918354] Please append a correct "root=" boot option; here are the available partitions:
[    5.926748] 0100          100000 ram0  (driver?)
[    5.931416] 1f00            2048 mtdblock0  (driver?)
[    5.936505] 1f01            2048 mtdblock1  (driver?)
[    5.941594] 1f02           12288 mtdblock2  (driver?)
[    5.946682] 1f03            2048 mtdblock3  (driver?)
[    5.951772] 1f04           13312 mtdblock4  (driver?)
[    5.956857] 1f05          507904 mtdblock5  (driver?)
[    5.961945] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

It seems like kernel hasn't loaded the usb drive when trying to mount the rootfs. How can I use the usb drive as the rootfs?


Solution

  • To explain whats going on a bit better, in a lot of cases (USB is common, other removable media too, but this can apply to anything really) require you to pass the argument rootwait to the kernel along with root=/dev/XXX. Sometimes this is a result of what's called deferred probing. In order for the device in question to be functional it in turn needs some other part of the system to be enabled (typically something related to power) so the first time the kernel tries, the subsystem says "try again later". In other cases it has to do with required probe delays (you need to wait a certain amount of wall clock time before devices are ready for use). In both of these cases, telling the kernel rootwait, the kernel will simply wait for forever for the specified root device to exist.