Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Debian 開機修復實錄:根檔案系統損壞與 ehci-orion not found in modules.dep

同事前來求救:重啟了一次 Debian,系統直接起不來了,畫面停在如下訊息:

loading, please wait...
/dev/mapper/debian--vg-root contains a file system with errors, check the file system.
/dev/mapper/debian-vg-root:
Inodes that were part of a corrupted orphan linked list found.
/dev/mapper/debian--vg-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
...
fsck exited with status code 4
The root filesystem on /dev/dm-0 requires a manual fsck
modprobe: module ehci-orion not found in modules.dep
BusyBox v1.22.1 (Debian 1:1.22.0-9+deb8u1) built-in shell (ash)
Enter 'help' for a list of built-in commands.
/bin/sh: can't access tty: job control turned off
(initramfs)_

訊息的核心含義是:根節點上的檔案系統出現錯誤,需要修復。系統於是自動嘗試修復 /dev/mapper/debian--vg-root,但修復失敗,同時報出內核中找不到 ehci-orion 模塊,最終系統被拋進了 initramfs。

為什麼會掉進 initramfs

initramfs 可以視為 tmpfs 的一種改良應用。Linux 開機時會把內核與 initramfs 一起載入記憶體執行;內核完成初始化後切換到使用者態,執行 initramfs 中的程式與腳本,載入必要的驅動模塊與設定,接著掛載真正的 rootfs 並切換過去,繼續後續的 init 流程(例如啟動桌面)。

關鍵點在這裡:修復時針對的是 /dev/mapper/debian--vg-root,但它其實只是一個連結。由於真正的根節點根本沒掛載成功,這個連結是無效的,修復自然註定失敗。而真正的根節點,是掛在 /dev/dm-0 上的。

修復步驟

在 initramfs 提示符下直接對真實設備執行 fsck:

fsck.ext4 -y /dev/dm-0

回車後就會自動完成修復。同事的檔案系統是 ext4,如果你的環境是 ext3,把指令換成 fsck.ext3 即可。

修復完成後重新開機,就能正常完成引導並掛載根檔案系統。

另外,可以在 initramfs 中執行以下指令,確認開機時使用的 image 與根設備:

cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.16.0-4-amd64 root=/dev/mapper/debian--vg-root ro quiet

小結:看到 root filesystem requires a manual fsck 時,不要急著重灌。先弄清楚真正的根設備是 /dev/dm-0 還是 LVM 映射路徑,對正確的設備執行 fsck,多數情況下都能救回來。至于 ehci-orion 的報錯,通常是 initramfs 中缺少對應模塊造成的伴隨現象,根檔案系統修好後一般不再影響開機。

Copyright © Linux教程網 All Rights Reserved