Linux新手指北

Linux 系统修复,无需重装

2019-01-31  本文已影响0人  imrdr

故事的开始:
前几天,我的Xubuntu系统无法重起,开机进入 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

就试着修复系统,在网上搜到一个办法,但是没有成功,也记在这里:

开机按ThinkVantag键,进入BIOSsecurity chip里面,选择activatedisable

我是这样修复的:

制作一个 USB LiveCD启动盘,用启动盘中的 Ubuntu系统启动,然后依次操作:

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

update1: 2019-2-12
今天,我又把我的Ubuntu弄崩溃了,按上述的办法没有成功。最后我是这样修复的:

我的 Ubuntu 安装在 /dev/sda2

sudo umount /dev/sda2    #把系统分区卸载
sudo fsck -n /dev/sda2
sudo fsck -n /dev/sda5
sudo fsck -n /dev/sda6    #最后在这个分区发现错误,修复

重要:fsck不可作用于正在挂载的 Linux 分区,不可作用于 Windows 分区

还是那句话,修复前请备份重要文件。

重启,成功。

update2: 2019-2-20
今天,我又把我的Ubuntu弄崩溃了,我现在回想,原因应该是这样的:我的系统是64位的,我做的LiveCD是32位的。我用fsck修复文件系统后,产生了错误。

现象如下:

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没有成功。最后我是这样修复的:

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
上一篇下一篇

猜你喜欢

热点阅读