Search code examples
armgem5

Gem5 ARM FS - Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)


I'm trying to run my first full-system simulation in Gem5, but I got the following error

[    5.703750] VFS: Cannot open root device "sda1" or unknown-block(8,1): error -6
[    5.704398] Please append a correct "root=" boot option; here are the available partitions:
[    5.706209] 0800             252 sda 
[    5.706370]  driver: sd
[    5.707223] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
[    5.708000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0+ #1
[    5.708570] Hardware name: V2P-CA15 (DT)
[    5.709020] Call trace:
[    5.709601]  dump_backtrace+0x0/0x1c0
[    5.710230]  show_stack+0x14/0x20
[    5.710844]  dump_stack+0x8c/0xac
[    5.711375]  panic+0x130/0x288
[    5.711980]  mount_block_root+0x1a8/0x294
[    5.712617]  mount_root+0x140/0x174
[    5.713243]  prepare_namespace+0x138/0x180
[    5.713891]  kernel_init_freeable+0x1c0/0x1e0
[    5.714489]  kernel_init+0x10/0x108
[    5.715069]  ret_from_fork+0x10/0x18
[    5.715584] Kernel Offset: disabled
[    5.716051] CPU features: 0x21c0649a
[    5.716509] Memory Limit: 512 MB
[    5.717254] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1) ]---

And the output from the gem5 command is

warn: Tried to write RVIO at offset 0xa8 (data 0) that doesn't exist
warn: Tried to read RealView I/O at offset 0x8 that doesn't exist
warn: Tried to read RealView I/O at offset 0x48 that doesn't exist
warn: EnergyCtrl: Disabled handler, ignoring read from reg 0
info: Dumping kernel dmesg buffer to system.workload.dmesg...
warn: Kernel panic in simulated kernel

I am using

  • Gem5 20.1.0.2 (stable branch)
  • cmd: ./build/ARM/gem5.opt configs/example/fs.py --cpu-type=TimingSimpleCPU --cpu-clock=1GHz --kernel=binaries/vmlinux.arm64 --disk-image=disks/m5_exit.squashfs.arm64 --bootloader=binaries/boot.arm64

The kernel and disk image is taken from gem5 guest binary page, I took the first link (Latest Linux Kernel Image / Bootloader)

I notice this question but the error is slightly different, and the running command line, kernel, image is different.

How can I solve this issue?


Solution

  • This answer to the question you mentioned points to: https://askubuntu.com/questions/41930/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block0-0/1048477#1048477 which contains a detailed diagnosis procedure for this error.

    For that and from the kernel message, we see clearly that root= kernel CLI parameter is incorrect: the default sda1 was used instead of the required sda.

    On fs.py, the correct root= can be set with:

    --command-line 'earlyprintk=pl011,0x1c090000 lpj=19988480 rw loglevel=8 mem=256MB root=/dev/sda console_msg_format=syslog nokaslr norandmaps panic=-1 printk.devkmsg=on printk.time=y rw console=ttyAMA0 - lkmc_home=/lkmc'
    

    I think there isn't a way to set just root= in fs.py , so all the other options were copied from the default fs.py kernel CLI, and just --root was modified. This can also be seen here.