Featured image of post 修復 Kernel Panic - VFS: Unable to mount root fs on unknown-block(0,0)

修復 Kernel Panic - VFS: Unable to mount root fs on unknown-block(0,0)

VM 啟動時卡住,畫面出現:

Kernel Panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

這個錯誤代表核心找不到根目錄所在的磁碟分割區,通常是 initramfs 損毀或 /boot 空間不足所致。

Step.1 透過舊核心進入系統

先讓系統能開機,才能進行後續診斷:

  1. 重新啟動,在 GRUB 選單停住
  2. 選擇 Advanced options for Ubuntu
  3. 選一個非 Recovery Mode 的舊版核心啟動

如果舊核心也失敗,改選舊核心的 Recovery Mode。如果全都不行,只能用 Live CD 掛載磁碟修復。

Step.2 確認 /boot 空間

進入系統後,先排除 /boot 空間滿了的可能性:

1
df -h
1
2
3
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       232G  5.0G  215G   3% /
/dev/sda3       976M  145M  765M  16% /boot

/boot 還有空間的話,問題不在這裡。

Step.3 確認核心版本

查看 /boot 目錄下的核心檔案:

1
ll /boot
1
2
3
4
5
6
-rw-r--r--  1 root root 213K config-4.15.0-96-generic
-rw-r--r--  1 root root 213K config-4.15.0-99-generic
-rw-r--r--  1 root root  56M initrd.img-4.15.0-96-generic
-rw-r--r--  1 root root  56M initrd.img-4.15.0-99-generic
-rw-r--r--  1 root root 8.0M vmlinuz-4.15.0-96-generic
-rw-r--r--  1 root root 8.0M vmlinuz-4.15.0-99-generic

預設核心(4.15.0-99)更新過程中,initramfs 可能因為各種原因產生損毀,重新產生通常可以修復。

Step.4 重新產生 initramfs

對損毀的核心執行 update-initramfs

1
sudo update-initramfs -u -k 4.15.0-99-generic

如果輸出出現 UUID 相關提示:

1
2
3
4
update-initramfs: Generating /boot/initrd.img-4.15.0-99-generic
I: The initramfs will attempt to resume from /dev/sda4
I: (UUID=bbee099f-de44-4f26-9b5d-5d8bd947051c)
I: Set the RESUME variable to override this.

這代表 swap 分割區的 UUID 有變動。不處理的話,每次開機都會觸發恢復程序,影響開機速度。將 UUID 帶入 RESUME 變數重新執行:

1
sudo RESUME=UUID=bbee099f-de44-4f26-9b5d-5d8bd947051c update-initramfs -u -k 4.15.0-99-generic

沒有其他錯誤訊息就完成了。

Step.5 重新啟動並確認

1
sudo reboot

重開後,確認是否已使用修復後的核心啟動:

1
grep "Linux version" /var/log/kern.log
1
May 25 10:59:19 ubuntu-server kernel: [    0.000000] Linux version 4.15.0-99-generic ...

出現最新核心版本號即代表修復成功。


References

Licensed under CC BY-NC-SA 3.0 TW
最後更新 2026-05-06
comments powered by Disqus