本文分析了ubuntu 启动错误:filesystem check or mount failed.并试着解决此错误。
ubuntu 启动错误:filesystem check or mount failed.
硬件环境: Dell 服务器 PowerEdge R720
操作系统: ubuntu 14.04 LTS
根据提示,错误原因应该是文件系统检查失败或者挂载失败。
错误提示:
Filesystem check or mount failed.
A maintenance shell will now be started. CONTROL-D will terminate this shell and continue booting
after re-trying filesystems. Any further errors will be ignored.
Give root password for maintenance
(or type ctrl-D to continue)
参考网页 1 解决思路是重新挂载根目录。
mount -o remount,rw /
dpkg --configure -a
mount -o remount,ro /
sync
reboot
参考网页 2、3 解决思路是检查、修复文件系统。
#fsck -f -c
#fsck.ext4 -f /dev/sda2
上面两种方法自己都试过了,无效。
参考网页 4 中出现问题的原因为 /etc/fstab
文件中UUID信息与 blkid 获得信息不一致。
参考网页 5 中问题未解决。自己仔细看过论坛记录后也没发现是什么问题。
参考网页 6 也没解决问题。但是建议:
Have a look at /var/log/dmesg, /var/log/boot.log and see if its having problems with mounting, rather than corruption.
参考网页 7 问题得到解决。提到了2种解决方法。
第1种是 running GParted from the Ubuntu live cd to check filesystem。
第2种:
The /dev/sda2 and /dev/sda5 were being mounted in the wrong place.
Instead of being mounted in /home and /boot as per /etc/fstab, they were being mounted in new directories in /media
called /media/usbhd-sda2 and /media/usbhd-sda5. Upon deleting those folders, everything has gone back to normal.
I have no idea how those new folders got created...but problem solved now.
有人解释了上面问题产生的原因:
The problem in udev that do automount to filesystems that he find.
The config laying in /etc/udev/rules.d <--- there is some file with extention *.rules
The first string in the file is "KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
Mostly main fs mounted from device /dev/sda... to make udev ignore /dev/sda just change the string to:
"KERNEL!="sd[b-z][0-9]", GOTO="media_by_label_auto_mount_end
If you have more that two physical hdds sdb\sdc\sdd make the changes in config.
That help me to solve the same problem that samson had.
这个错误其他可能的原因:
- 磁盘已满
- non-root file systems的错误。
参考网页:
- Ubuntu 13.04 to 13.10: Filesystem check or mount failed
- Filesystem check or mount failed
- Ubuntu:mount of filesystem failed解决办法
- [SOLVED] File System Check or Mount Failed
- Filesystem check or mount failed. fsck not helping
- Filesystem check or mount failed. fsck not helping
- Filesystem check failed (SOLVED)
自己的解决方法
进展 1
我按了 ctrl-D
之后,出现如下信息:
mountall start/starting
Filesystem check or mount failed.
A maintenance shell will now be started. CONTROL-D will terminate this shell and continue booting
after re-trying filesystems. Any further errors will be ignored.
Give root password for maintenance
(or type ctrl-D to continue)
注意到错误信息第一行多了一句 mountall start/starting
那么,可以从启动日志 /var/log/dmeg
中查看挂载情况:
cat /var/log/dmeg | grep mountall
得到结果如下:
root@stackcontroller:/home/ubuntu# cat /var/log/dmesg |grep mountall
[ 8.153842] init: mountall main process (293) terminated with status 2
[ 262.179491] init: mountall main process (322) terminated with status 2
从启动日志 /var/log/dmeg
中查看硬盘情况:
cat /var/log/dmeg | grep sda
得到结果如下:
root@stackcontroller:/home/ubuntu# cat /var/log/dmesg |grep sda
[ 2.573476] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[ 2.573479] sd 0:0:0:0: [sda] 4096-byte physical blocks
[ 2.573546] sd 0:0:0:0: [sda] Write Protect is off
[ 2.573550] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[ 2.573573] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 2.616699] sda: sda1 sda2 sda3
[ 2.617036] sd 0:0:0:0: [sda] Attached SCSI disk
[ 3.599357] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[ 430.011487] Adding 8340476k swap on /dev/sda3. Priority:-1 extents:1 across:8340476k FS
[ 432.501675] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro
仔细查看日志 /var/log/dmesg ,与正常启动的服务器的日志对比。
[ 8.153842] init: mountall main process (293) terminated with status 2
在这一行前面,日志都是一样的,突然出现了这个信息。
既然 ctrl-D
的 mountall 不行,那么试着登陆 maintenance shell ,root 执行 mountall ,得到如下结果:
这时系统已经可以远程登录了,或者按 Ctrl + alt + F2
开启另一个控制台登录。说明系统可以启动了,这样可以猜出问题出在文件系统的挂载上。
进展 2
于是接下来修改google 关键词为: "mountall start/starting" Filesystem check or mount failed
. 重新检索。
下面参考网页 1 中方法进入 recovery 后只有一个选项,与描述不符。
下面参考网页 2 中方法自己试过了,无效。
Managed to FSCK it enough to run:
'mount -o rw,remount /'
Followed by:
'sudo mountall'
Which allowed me to load Ubuntu 13.10 (but pretty badly damaged).
Then summoned a Terminal window (Ctrl-Alt-T) and ran:
'sudo dpkg --configure -a'
which fixed the broken install, then ran:
'sudo apt-get install -f'
which fixed the broken packages.
自己尝试过在单用户模式下 fsck 修复文件系统,重启后无效。
进展 3
自己也猜测是 swap 分区的问题,这个分区不能挂载。重新修复了 swap 分区,结果还是不行。
计划:打开 /var/log/messages
日志,查看更详细日志。
打开后,重启,没有内容。
进展 4
在上面的尝试都无效之后,只能自己分析问题所在了。
猜测由于 /sbin/init 进程发出 startup 时间之后,启动 mountall 工作。但是 mountall 工作由于某种原因终止了。
根据如下 df -h
的提示信息,猜测是由于 swap 分区出现问题。
!
mountall其实分为很多步骤。仔细执行其中各个步骤,看卡在哪一个地方了。
但是,自己试过了 mount /dev/sda2
, swapon -f /dev/sda3
都不行。
看来这种思路行不通。
执行 initctl status
发现只有 mountall-shell
在运行。
查看 /etc/init/mountall-shell.conf 内容,根据错误提示,判断其运行原因是 mountall exit status 2 。
看来要解决问题还是要弄清楚 mountall 退出的原因。
根据 mountall.conf 内容,自己在根目录下创建了 forcefsck 文件,修改了 /etc/default/rcS 中 FSCKFIX=yes 。
重启后还是不行。
mmp,真难搞定。
进展 5
[下载了 mountall 源码](https://github.com/hokein/Wiki/wiki/ubuntu%E8%8E%B7%E5%8F%96%E6%BA%90%E7%A0%81%E6%96%B9%E6%B3%95
),查看源码,没什么突破。
按照下面网页上更新内核之后,重启还是相同错误,但是出现这个错误之后就卡着不动了。按 ctrl + D 没反应,也进不了 maintenance shell 。 只能强制关机,问题越来越严重了。。。
https://forum.linode.com/viewtopic.php?p=28115
哎,放弃了,弄不好。
参考网页:
- “Filesystem check or mount failed” error.
- Ubuntu 13.10 update crashed out (on Dell Inspiron 15r), won’t boot into shell…
附件浏览: