遺忘 root 密碼或誤改關鍵設定檔(/etc/inittab、/etc/rc.d/rc.sysinit)導致無法開機,單用戶模式(Single User Mode)可掛載根檔案系統為可讀寫進行修復。本文示範 GRUB 下三種進入方式。
/boot/grub/grub.conf 內容:# grub.conf generated by anaconda
default=1
timeout=1000
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9-1.667)
root (hd0,2)
kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-1.667.img
title Windows 2000 Adv
rootnoverify (hd0,0)
chainloader +1
開機畫面顯示 Press any key to enter the menu,按任意鍵進入:
GNU GRUB version 0.95
Fedora Core (2.6.9-1.667)
Windows 2000 Adv
常用熱鍵:
single 或 1 或 init=/bin/bash single,Enter 確認,再按 b 啟動grub> root (hd0,2)
grub> kernel /vmlinuz-2.6.9-1.667 ro root=/dev/VolGroup00/LogVol00 single
grub> initrd /initrd-2.6.9-1.667.img
grub> boot
適用於 grub.conf 損壞或需臨時指定其他核心/參數情況。
passwd rootvi /etc/inittab、vi /etc/fstabfsck /dev/VolGroup00/LogVol00touch /.autorelabel 重啟自動恢復標籤修復完成 reboot 重啟即可正常進入系統。