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 開機故障兩大經典案例:LILO 損壞與 root 密碼遺忘完整解決方案

編輯:Linux 教學

針對 LILO 引導載入器損壞、root 密碼遺忘兩類高頻開機故障,提供多種復原路徑,涵蓋軟碟、光碟、DOS、重裝等場景。

一、LILO 損壞五大復原法

#前提條件核心步驟適用場景
1有開機軟碟軟碟啟動 → lilo → 重啟最簡單、最快
2安裝光碟 (Red Flag 等)光碟啟動 → Ctrl+Alt+F2 進控制台 → mount -t ext2 /dev/hda3 /tmp → chroot /tmp /sbin/lilo無軟碟、有光碟
3Windows 啟動軟碟 + loadlinDOS 下 loadlin vmlinuz root=/dev/hda3 → 進 Linux → /sbin/lilo雙系統、有 DOS 環境
4升級式重裝選「升級」、不勾選任何套件、不格式化 → 完成後 LILO 自動修復保留數據、修復引導
5Red Hat 7.1 光碟同法 4,記住重裝時設定的 root 密碼Red Hat 專用

關鍵提示:chroot 環境下同步執行 passwd 可順便重設 root 密碼。

二、root 密碼遺忘三大破解法

1. LILO 提示符下進入單用戶模式

boot: linux 1
# 或 linux single
# 或 linux init=/bin/sh rw
bash# passwd
bash# exit
login: root (新密碼)

2. 結合 LILO 修復流程 (法 2、3、5)

在 chroot 或 loadlin 進入的 Shell 中直接執行 passwd,修復 LILO 後同步生效。

3. 通用單用戶模式參數

  • 1 / single / S:SysV init 單用戶模式
  • init=/bin/sh rw:直接掛載根分區可讀寫進 Shell,繞過 init

附錄:恢復 Windows 啟動項

若安裝 Linux 後 Windows 消失:

# vi /etc/lilo.conf
other=/dev/hda1
label=dos
# lilo

總結

備份 /boot、製作啟動軟碟/USB、記錄分區對照表 —— 三大習慣讓開機故障從「災難」變「小插曲」。

Copyright © Windows教程網 All Rights Reserved