Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux GRUB 2 開機失敗救援完整教學:從 grub> 提示符修復開機

編輯:關於 Linux

GRUB 2 開機卡在 grub> 或 grub rescue> 提示符,代表找不到 grub.cfg 或核心模組 normal.mod。常見原因:硬碟序號變更、分區調整、新增作業系統覆寫 MBR。透過 GRUB 2 命令列可手動定位開機檔案並修復。

兩種提示符差異

  • grub>:已載入 normal.mod,功能完整 (Tab 補全、歷史、檔案系統瀏覽)。
  • grub rescue>:未載入 normal.mod,僅支援 set、ls、insmod 等基本指令。

核心救援流程

  1. 設定分頁器 避免長輸出截斷:
    set pager=1
  2. 列出所有分區:
    ls
    # (hd0) (hd0,msdos2) (hd0,msdos1) ...
  3. 尋找根檔案系統 (含 /boot/grub 或 /boot):
    ls (hd0,1)/
    # 看到 lost+found/ bin/ boot/ ... 即為根分區
  4. 確認作業系統:
    cat (hd0,1)/etc/issue
    # Ubuntu 14.04 LTS ...
  5. 手動載入核心與 initrd 開機:
    set root=(hd0,1)
    linux /boot/vmlinuz-3.13.0-24-generic root=/dev/sda1 ro
    initrd /boot/initrd.img-3.13.0-24-generic
    boot
  6. 進入系統後永久修復:
    sudo update-grub
    sudo grub-install /dev/sda

GRUB 2 救援

關鍵提醒: GRUB 2 裝置命名 (hd0,1) 對應 Linux /dev/sda1 (磁碟從 0 起算、分區從 1 起算)。使用 Tab 鍵自動補全核心/ initrd 檔名避免拼字錯誤。若為 UEFI 系統,需掛載 EFI 分區並指向 grubx64.efi。
Copyright © Windows教程網 All Rights Reserved