Linux 系統(tǒng)修復(fù),無(wú)需重裝

故事的開(kāi)始:
前幾天,我的Xubuntu系統(tǒng)無(wú)法重起,開(kāi)機(jī)進(jìn)入 emergency mode

emergency mode

You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" or "exit" to boot into default mode.

system logs 顯示:

A TPM error (6) occurred attempting to read a pcr value.
......
1-1-port3: unable to enumerate USB device
......
error: read a pcr value

logs

就試著修復(fù)系統(tǒng),在網(wǎng)上搜到一個(gè)辦法,但是沒(méi)有成功,也記在這里:

開(kāi)機(jī)按ThinkVantag鍵,進(jìn)入BIOSsecurity chip里面,選擇activatedisable

我是這樣修復(fù)的:

制作一個(gè) USB LiveCD啟動(dòng)盤,用啟動(dòng)盤中的 Ubuntu系統(tǒng)啟動(dòng),然后依次操作:

  • 在外部存儲(chǔ)器備份自己的重要數(shù)據(jù),以防這個(gè)辦法失敗后,重要數(shù)據(jù)丟失。
  • 依次輸入以下命令:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
sudo apt clean
sudo apt-get update --fix-missing
sudo apt install -f
sudo dpkg --configure -a
sudo apt-get upgrade
  • 然后, sudo reboot 重啟。
    Eenjoy it!

update1: 2019-2-12
今天,我又把我的Ubuntu弄崩潰了,按上述的辦法沒(méi)有成功。最后我是這樣修復(fù)的:

  • 用 Ubuntu 的 USB LiveCD 啟動(dòng)機(jī)器。
  • 進(jìn)入終端:

我的 Ubuntu 安裝在 /dev/sda2

sudo umount /dev/sda2    #把系統(tǒng)分區(qū)卸載
sudo fsck -n /dev/sda2
sudo fsck -n /dev/sda5
sudo fsck -n /dev/sda6    #最后在這個(gè)分區(qū)發(fā)現(xiàn)錯(cuò)誤,修復(fù)

重要:fsck不可作用于正在掛載的 Linux 分區(qū),不可作用于 Windows 分區(qū)

還是那句話,修復(fù)前請(qǐng)備份重要文件。

重啟,成功。

update2: 2019-2-20
今天,我又把我的Ubuntu弄崩潰了,我現(xiàn)在回想,原因應(yīng)該是這樣的:我的系統(tǒng)是64位的,我做的LiveCD是32位的。我用fsck修復(fù)文件系統(tǒng)后,產(chǎn)生了錯(cuò)誤。

現(xiàn)象如下:

xubuntu@xubuntu:~$ sudo fsck -n /dev/sda6
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix? no

Inode 139463 was part of the orphaned inode list. IGNORED.
Deleted inode 139499 has zero dtime. Fix? no
......

反正按update1沒(méi)有成功。最后我是這樣修復(fù)的:

sudo e2fsck /dev/sda6

然后,一路yes下去,就行了。
例如:

xubuntu@xubuntu:~$ sudo e2fsck /dev/sda6
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix<y>? yes
Inode 139463 was part of the orphaned inode list. FIXED.
Deleted inode 139499 has zero dtime. Fix<y>? yes
Inode 139507 was part of the orphaned inode list. FIXED.
Inode 271729 was part of the orphaned inode list. FIXED.
Inode 289882 was part of the orphaned inode list. FIXED.
Inode 289887 was part of the orphaned inode list. FIXED.
Inode 395014 was part of the orphaned inode list. FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(899591--899593) -(1484144--1484152) -1585470 -(1662466--1662468) -(1668096--1669119) -1704896
Fix<y>? yes
Free blocks count wrong for group #27 (26627, counted=26630).
Fix<y>? yes
Free blocks count wrong for group #45 (21699, counted=21708).
Fix<y>? yes
Free blocks count wrong for group #48 (15683, counted=15684).
Fix<y>? yes
Free blocks count wrong for group #50 (12965, counted=13992).
Fix<y>? yes
Free blocks count wrong for group #52 (32736, counted=32737).
Fix<y>? yes
Free blocks count wrong (15264240, counted=15265281).
Fix<y>? yes
Inode bitmap differences: -139463 -139499 -139507 -271729 -289882 -289887 -395014
Fix<y>? yes
Free inodes count wrong for group #17 (7947, counted=7950).
Fix<y>? yes
Free inodes count wrong for group #33 (13, counted=14).
Fix<y>? yes
Free inodes count wrong for group #35 (1468, counted=1470).
Fix<y>? yes
Free inodes count wrong for group #48 (3542, counted=3543).
Fix<y>? yes
Directories count wrong for group #48 (1251, counted=1250).
Fix<y>? yes
Free inodes count wrong (5845477, counted=5845484).
Fix<y>? yes

/dev/sda6: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda6: 257556/6103040 files (0.8% non-contiguous), 9136639/24401920 blocks
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
禁止轉(zhuǎn)載,如需轉(zhuǎn)載請(qǐng)通過(guò)簡(jiǎn)信或評(píng)論聯(lián)系作者。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容