gem5 full system Linux boot fails with “Kernel panic - not syncing: VFS: Unable to mount root fs”

旧巷老猫 提交于 2021-01-28 22:52:31

问题


I want to run arm's linux system in gem5's fs mode,I download related files from this address: http://www.gem5.org/documentation/general_docs/fullsystem/guest_binaries

I was able to configure the correct file path, but finally got this output in the terminal2:

[    0.661620] No filesystem could mount root, tried: 
[    0.661621]  ext3
[    0.661650]  ext4`enter code here`
[    0.661663]  ext2
[    0.661676]  vfat
[    0.661690]  fuseblk
[    0.661703] 
[    0.661728] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,0)

And got this terrible output in the terminal1:

warn: Tried to read RealView I/O at offset 0x60 that doesn't exist
warn: Tried to write RVIO at offset 0xa8 (data 0) that doesn't exist
warn: Kernel panic in simulated kernel

I can provide my command line input, but simply adjusting the configuration inside will only lead to the same result:

./build/ARM/gem5.opt configs/example/arm/starter_fs.py --cpu="minor" --num-cores=4 --disk-image=/home/ad/GEM5/ARM_GEM5/gem5/my_image/disks/aarch64-ubuntu-trusty-headless.img --dtb=/home/ad/GEM5/ARM_GEM5/gem5/my_image/binaries/armv7_gem5_v1_4cpu.dtb --kernel=/home/ad/GEM5/ARM_GEM5/gem5/my_image/binaries/vmlinux

How can I solve this? Regards,


回答1:


Here is a full diagnostic procedure for this kind of problem: https://askubuntu.com/questions/41930/kernel-panic-not-syncing-vfs-unable-to-mount-root-fs-on-unknown-block0-0/1048477#1048477

In summary, you have to ensure that:

  • the kernel has the config to read the disk type, for emulation usually:

    CONFIG_VIRTIO_PCI=y
    CONFIG_VIRTIO_BLK=y
    

    This seems to be the problem since there was no list of partitions given above? Please confirm. If not, the kernel can't read bytes from the disk it seems.

  • the kernel has the config to read the filesystem type. You kernel mentions ext2,3,4 though, so likely that's not the problem.

  • you are pointing the root= kernel CLI to the right partition

See also: https://cirosantilli.com/linux-kernel-module-cheat/#not-syncing That also contains a Buildroot setup that just works.

I also highly recommend that you first get it working on QEMU which boots much faster.




回答2:


I had a similar problem. Trying to run a full-system emulation of both Ubuntu and Linaro minimal (from the gem5 website) under a 64-bit kernel, with the original starter_fs.py script, gives me this kernel panic:

[    0.224367] List of all partitions:
[    0.224394] fe00         1048320 vda 
[    0.224397]  driver: virtio_blk
[    0.224440]   fe01         1048288 vda1 00000000-01
[    0.224441] 
[    0.224480] No filesystem could mount root, tried: 
[    0.224481]  ext3
[    0.224510]  ext4
[    0.224524]  ext2
[    0.224537]  squashfs
[    0.224551]  vfat
[    0.224566]  fuseblk
[    0.224579] 
[    0.224606] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,0)
[    0.224656] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0+ #1
[    0.224692] Hardware name: V2P-CA15 (DT)
[    0.224717] Call trace:
[    0.224741]  dump_backtrace+0x0/0x1c0
[    0.224765]  show_stack+0x14/0x20
[    0.224790]  dump_stack+0x8c/0xac
[    0.224812]  panic+0x130/0x288
[    0.224836]  mount_block_root+0x22c/0x294
[    0.224861]  mount_root+0x140/0x174
[    0.224884]  prepare_namespace+0x138/0x180
[    0.224910]  kernel_init_freeable+0x1c0/0x1e0
[    0.224939]  kernel_init+0x10/0x108
[    0.224961]  ret_from_fork+0x10/0x18
[    0.224987] Kernel Offset: disabled
[    0.225009] CPU features: 0x21c06492
[    0.225032] Memory Limit: 2048 MB
[    0.225056] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,0) ]---

Weird thing is that, few weeks ago, it worked like a charm. The problem lying into the specification of the root partition, on the kernel command line. In the starter_fs.py, change this line:

"root=/dev/vda",

By this:

"root=/dev/vda1",

You can see that before, the VirtIO block device was specified. The kernel wants a partition, not a block device. Then, you can run gem5:

build/ARM/gem5.opt -configs/example/arm/starter_fs.py --cpu="hpi" --num-cores=1 --disk-image="linaro-minimal-aarch64.img" --kernel="vmlinux.arm64"

And for me, the kernel panic is gone and I am able to boot my system again:

[    0.228847] EXT4-fs (vda1): mounted filesystem without journal. Opts: (null)
[    0.228906] VFS: Mounted root (ext4 filesystem) on device 254:1.
[    0.229539] devtmpfs: mounted
[    0.229792] Freeing unused kernel memory: 448K
INIT: version 2.88 booting
[    0.234168] random: fast init done
Starting udev
[    0.277039] udevd[715]: starting version 182
[    0.411534] EXT4-fs (vda1): re-mounted. Opts: block_validity,delalloc,barrier,user_xattr
Starting Bootlog daemon: bootlogd.
[    0.426573] random: dd: uninitialized urandom read (512 bytes read)
Populating dev cache
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
hwclock: can't open '/dev/misc/rtc': No such file or directory
Mon Jan 27 08:00:00 UTC 2014
hwclock: can't open '/dev/misc/rtc': No such file or directory
INIT: Entering runlevel: 5
Configuring network interfaces... ifconfig: SIOCGIFFLAGS: No such device
Starting rpcbind daemon...rpcbind: cannot create socket for udp6
rpcbind: cannot create socket for tcp6
done.
rpcbind: cannot get uid of '': Success
creating NFS state directory: done
starting statd: done
Starting auto-serial-console: done
Stopping Bootlog daemon: 
bootlogd.
Last login: Mon Jan 27 08:00:00 UTC 2014 on tty1
INIT: no more processes left in this runlevel
root@genericarmv8:~# id
id
uid=0(root) gid=0(root) groups=0(root)
root@genericarmv8:~#


来源:https://stackoverflow.com/questions/63277677/gem5-full-system-linux-boot-fails-with-kernel-panic-not-syncing-vfs-unable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!