首页 > 系统相关 >linux kernel mount rootfs失败问题

linux kernel mount rootfs失败问题

时间:2023-09-04 16:22:05浏览次数:41  
标签:kernel Kernel panic mount 0x24 linux root

linux kernel在初始化末尾会mount rootfs。有时会mount失败,出现类似下面的log:

[    0.623289] /dev/root: Can't open blockdev
[    0.624045] VFS: Cannot open root device "" or unknown-block(0,0): error -6
[    0.625312] Please append a correct "root=" boot option; here are the available partitions:
[    0.626789] fe00        20971520 vda
[    0.626793]  driver: virtio_blk
[    0.628031]   fe01          524288 vda1 dfb03d22-39d2-8546-8d5d-04de64008a17
[    0.628035]
[    0.629595]   fe02        20446191 vda2 83a251ae-6507-824a-b614-5e9619f1dded
[    0.629598]
[    0.631120] fe10             366 vdb
[    0.631123]  driver: virtio_blk
[    0.632356] 1f00          131072 mtdblock0
[    0.632359]  (driver?)
[    0.633561] List of all bdev filesystems:
[    0.634278]  ext3
[    0.634280]  ext4
[    0.634636]  ext2
[    0.634992]  squashfs
[    0.635357]  vfat
[    0.635773]
[    0.636409] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.637919] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-g708283abf896 #187
[    0.639271] Hardware name: linux,dummy-virt (DT)
[    0.640144] Call trace:
[    0.640616]  dump_backtrace+0x90/0xe8
[    0.641325]  show_stack+0x18/0x24
[    0.641959]  dump_stack_lvl+0x48/0x60
[    0.642691]  dump_stack+0x18/0x24
[    0.643333]  panic+0x314/0x370
[    0.643919]  mount_root_generic+0x240/0x31c
[    0.644775]  mount_root+0x164/0x2d4
[    0.645438]  prepare_namespace+0x6c/0x298
[    0.646196]  kernel_init_freeable+0x240/0x280
[    0.647020]  kernel_init+0x24/0x1e0
[    0.647696]  ret_from_fork+0x10/0x20
[    0.648377] SMP: stopping secondary CPUs
[    0.649149] Kernel Offset: 0x51b71a800000 from 0xffff800080000000
[    0.650290] PHYS_OFFSET: 0xffffdef400000000
[    0.651082] CPU features: 0x00800000,8a0100a1,08004203
[    0.652054] Memory Limit: none
[    0.652639] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

这个kernel提示比较明显,让你加"root="的kernel参数。这个错误一般检查一下root的参数即可解决。

也有时候出现下面的log

[    0.625071] List of all partitions:
[    0.625723] fe00        20971520 vda
[    0.625727]  driver: virtio_blk
[    0.626963]   fe01          524288 vda1 dfb03d22-39d2-8546-8d5d-04de64008a17
[    0.626966]
[    0.628489]   fe02        20446191 vda2 83a251ae-6507-824a-b614-5e9619f1dded
[    0.628492]
[    0.630118] fe10             366 vdb
[    0.630121]  driver: virtio_blk
[    0.631351] 1f00          131072 mtdblock0
[    0.631354]  (driver?)
[    0.632524] No filesystem could mount root, tried:
[    0.632526]  ext3
[    0.633451]  ext4
[    0.633809]  ext2
[    0.634163]  squashfs
[    0.634517]  vfat
[    0.634941]
[    0.635575] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,16)
[    0.637096] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-g708283abf896 #187
[    0.638444] Hardware name: linux,dummy-virt (DT)
[    0.639325] Call trace:
[    0.639798]  dump_backtrace+0x90/0xe8
[    0.640500]  show_stack+0x18/0x24
[    0.641136]  dump_stack_lvl+0x48/0x60
[    0.641872]  dump_stack+0x18/0x24
[    0.642506]  panic+0x314/0x370
[    0.643103]  mount_root_generic+0x304/0x31c
[    0.643941]  mount_root+0x164/0x2d4
[    0.644606]  prepare_namespace+0x6c/0x298
[    0.645364]  kernel_init_freeable+0x240/0x280
[    0.646186]  kernel_init+0x24/0x1e0
[    0.646867]  ret_from_fork+0x10/0x20
[    0.647551] SMP: stopping secondary CPUs
[    0.648311] Kernel Offset: 0x2b04a7400000 from 0xffff800080000000
[    0.649453] PHYS_OFFSET: 0xffffa1f300000000
[    0.650243] CPU features: 0x00800000,8a0100a1,08004203
[    0.651218] Memory Limit: none
[    0.651805] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,16) ]---

这个并没有说明是什么问题,只是说尝试了几种文件系统去mount,但是都失败了,然后列举了所有blk的分区。这种情况大概率也是root设置的问题,应该是root设置错误造成的,重新设置root即可解决。

[    0.544225] VFS: Cannot open root device "/dev/vda2" or unknown-block(0,0): error -6
[    0.545590] Please append a correct "root=" boot option; here are the available partitions:
[    0.547094] 1f00          131072 mtdblock0
[    0.547098]  (driver?)
[    0.548267] List of all bdev filesystems:
[    0.548981]  ext3
[    0.548983]  ext4
[    0.549346]  ext2
[    0.549700]  squashfs
[    0.550053]  vfat
[    0.550466]
[    0.551135] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.552576] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.5.0-g708283abf896 #188
[    0.553848] Hardware name: linux,dummy-virt (DT)
[    0.554672] Call trace:
[    0.555147]  dump_backtrace+0x90/0xe8
[    0.555850]  show_stack+0x18/0x24
[    0.556483]  dump_stack_lvl+0x48/0x60
[    0.557254]  dump_stack+0x18/0x24
[    0.557887]  panic+0x314/0x370
[    0.558472]  mount_root_generic+0x240/0x31c
[    0.559331]  mount_root+0x164/0x2d4
[    0.559994]  prepare_namespace+0x6c/0x298
[    0.560752]  kernel_init_freeable+0x240/0x280
[    0.561581]  kernel_init+0x24/0x1e0
[    0.562248]  ret_from_fork+0x10/0x20
[    0.562928] SMP: stopping secondary CPUs
[    0.563694] Kernel Offset: 0x342273c00000 from 0xffff800080000000
[    0.564833] PHYS_OFFSET: 0xffffd14880000000
[    0.565629] CPU features: 0x00800000,8a0100a1,08004203
[    0.566592] Memory Limit: none
[    0.567176] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

  虽然log提示是root设置不对,但是其实是blk驱动缺失造成的,因为他没有列出各个blk dev的分区。这种可以检查kernel是不是缺少了blk驱动,enable and build then try again。

[    0.657479] /dev/root: Can't open blockdev
[    0.658218] VFS: Cannot open root device "/dev/vda2" or unknown-block(254,2): error -6
[    0.659650] Please append a correct "root=" boot option; here are the available partitions:
[    0.661117] fe00        20971520 vda
[    0.661121]  driver: virtio_blk
[    0.662299]   fe01        20971519 vda1 00000000-01
[    0.662302]
[    0.663437] fe10             366 vdb
[    0.663439]  driver: virtio_blk
[    0.664629] List of all bdev filesystems:
[    0.665325]  ext3
[    0.665327]  ext4
[    0.665664]  ext2
[    0.666001]  squashfs
[    0.666340]  vfat
[    0.666737]
[    0.667352] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,2)
[    0.668821] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.5.0-g708283abf896 #189
[    0.670077] Hardware name: QEMU KVM Virtual Machine, BIOS unknown 2/2/2022
[    0.671297] Call trace:
[    0.671752]  dump_backtrace+0x90/0xe8
[    0.672442]  show_stack+0x18/0x24
[    0.673060]  dump_stack_lvl+0x48/0x60
[    0.673741]  dump_stack+0x18/0x24
[    0.674358]  panic+0x314/0x370
[    0.674927]  mount_root_generic+0x240/0x31c
[    0.675704]  mount_root+0x164/0x2d4
[    0.676360]  prepare_namespace+0x6c/0x298
[    0.677099]  kernel_init_freeable+0x240/0x280
[    0.677902]  kernel_init+0x24/0x1e0
[    0.678548]  ret_from_fork+0x10/0x20
[    0.679208] SMP: stopping secondary CPUs
[    0.679951] Kernel Offset: 0x120000 from 0xffff800080000000
[    0.680994] PHYS_OFFSET: 0x40000000
[    0.681645] CPU features: 0x00800000,0a0100a1,08004203
[    0.682598] Memory Limit: none
[    2.643124] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(254,2) ]---

  在这个log中vda的俩分区没有全部识别出来,vda1的guid看起来也不对。这是由于系统是从uefi启动,缺少CONFIG_EFI_PARTITION。enable这个config,build再试。

标签:kernel,Kernel,panic,mount,0x24,linux,root
From: https://www.cnblogs.com/banshanjushi/p/17677402.html

相关文章

  • 分享实用工具源码--实现Windows IDE中查看Linux下编译信息
    作者:fbysss关键字:实用工具源码 Windows下查看Linux编译信息一、背景:本人写C程序不多,更不用说Linux下了。偶然一个机会,接了个这样的活,vi我用的还马马虎虎,但程序超过一千行,看起来就有些眼花了。于是只好在VC下编写代码,ftp传到Linux服务器,再用gcc编译,出错了再到VC下修改,再上传,如......
  • Linux下非阻塞getch实现示例
    作者:fbysss关键字:getch问题1:标准c中没有getch函数,等待键盘输入之后,总是需要按下回车才能得到值,如何解决?问题2:在等待键盘输入的时候,程序被阻塞了,下面的代码必须在输入处理之后才能执行。如果不使用线程,如何实现非阻塞模式?解决办法:#include<curses.h>#include......
  • linux学习 Centos 7(二)
    linux学习Centos7(二)常用的基本命令目录管理绝对路径、相对路径绝对路径路径的全称:C:\ProgramData\360safe\xxx.xx在360safe目录下,xxx.xx的相对路径就是\xxx.xxcd切换目录绝对路径:/开头相对路径:../homecd:切换目录命令cd./:当前目录cd..:返回上一级目录ls......
  • Linux 服务器下C++开发找不到mysql.h
    问题背景腾讯云服务器,linuxcentOS7内核,mysql版本5.5为宝塔腾讯云版自动安装C++用cmake编译时找不到mysql.h解决1.首先尝试yum安装mysql-devel包,但是yum让我直接下载了mariadb相关的包,下载时它,与原有包冲突bt-mysql55-5.5.62-1.el7.x86_64,但是删除原有包后mysql启动有问......
  • Linux安装IDEA
    下载idea.tar.gz(具体版本号就不写了)解压:sudotar-zxvfidea.tar.gz直接运行bin目录下的idea.sh即可:cdbinsudo./idea.sh如果有可视化界面,可以创建一个桌面图标,在桌面新建文件idea.desktop,然后输入以下内容[DesktopEntry]Version=2021.1Type=Application......
  • Linux 常用命令(持续更新)
    博客地址:https://www.cnblogs.com/zylyehuo/查看Linux命令的帮助信息1.用man手册,linux提供的帮助文档manlsmancpmanmkdir2.命令加上--help参数,查看简短帮助信息mkdir--helprm--help3.在线的搜索一些命令查询网站http://linux.51yip.com/vim编辑器的用......
  • Linux 干货整理(持续更新)
    博客地址:https://www.cnblogs.com/zylyehuo/如果虚拟机开机没有ip怎么办1.vim编辑网卡配置文件,修改如下参数[root@s25linuxtmp]#cd/etc/sysconfig/network-scripts/vim修改此文件,找到如下参数,改为yesONBOOT="yes"2.确保vmware正确选择了桥接或是NAT,且已经连接上......
  • linux宏offset_of学习随笔
    offset_of宏定义:include/linux/stddfx.h功能:给出两个参数:结构体和它的成员,获取其成员关于结构体首地址的偏移:#defineoffset_of(type,member)(unsignedlong)&((type*)0)->member这个想法挺精巧的,逐层拆开,首先看里面的(type*)0 ,这是将0地址强行转换为了一个type结构......
  • Linux下启动 jar 包的几种常见方式
    Linux下通过java命令启动jar包的几种常见方式方法一:直接启动jar包java-jarXXX.jar1缺点:当前ssh窗口会被锁定,不能再操作其他命令,如果需要执行其他命令,则需要打断进程,可按CTRL+C打断程序运行,或直接关闭窗口,程序也会退出。方法二:后台启动jar包java-jarXXX.jar&1&代表......
  • Linux日志管理经验总结(crontab+logrotate)
    Linux系统-部署-运维系列导航 日志管理目标日志的管理,一般包括两大部分日志内容,合理的日志内容(日志锚点,内容格式,等)可以为应用服务的执行记录、问题排查提供最有力的帮助日志存档规则,包括日志分割方式(按日期、按文件大小,等),日志存档数量,如只保存最近一个月,等对于自行开发的......