本文最后更新于:2024年11月29日 上午
Ubuntu 系统加载遇到错误无法进入操作系统,魂儿都吓没了,本文记录解决过程。
问题复现
我的 Ubuntu 22 在一次正常关机之后开机报错:
1 2 3 4 [FAILED] Failed to start file system check on /dev/disk/by-uuid/6a982e39-9594-43e5-9328-d95a092945f8 [DEPEND] Dependency failed for /home [DEPEND] Dependency failed for Local File Systems You are in emergency mode.
太吓人了
问题原因
可能由于磁盘老化,系统磁盘有坏道之类的问题,或系统在磁盘读写时强行关机导致磁盘加载错误。
解决方案
可以查看当前 uuid 的磁盘还在不在,我在 emergency mode 中运行命令的结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS loop0 squashfs 4.0 0 100 % /snap/ bare/5 loop1 squashfs 4.0 0 100 % /snap/ core18/2846 loop2 squashfs 4.0 0 100 % /snap/ core20/2379 loop3 squashfs 4.0 0 100 % /snap/ core20/2434 loop4 squashfs 4.0 0 100 % /snap/ core22/1663 loop5 squashfs 4.0 0 100 % /snap/ core24/490 loop6 squashfs 4.0 0 100 % /snap/ core22/1621 loop7 squashfs 4.0 0 100 % /snap/ core24/609 loop8 squashfs 4.0 0 100 % /snap/ firefox/5273 loop9 squashfs 4.0 0 100 % /snap/ firefox/5361 loop10 squashfs 4.0 0 100 % /snap/g nome-3 -28 -1804 /198 loop11 squashfs 4.0 0 100 % /snap/g nome-42 -2204 /141 loop12 squashfs 4.0 0 100 % /snap/g nome-42 -2204 /176 loop13 squashfs 4.0 0 100 % /snap/g nome-46 -2404 /48 loop14 squashfs 4.0 0 100 % /snap/g tk-common-themes/1535 loop15 squashfs 4.0 0 100 % /snap/i rfanview/53 loop16 squashfs 4.0 0 100 % /snap/m esa-2404 /143 loop17 squashfs 4.0 0 100 % /snap/my sql-workbench-community/13 loop18 squashfs 4.0 0 100 % /snap/my sql-workbench-community/15 loop19 squashfs 4.0 0 100 % /snap/ notepad-plus -plus /411 loop20 squashfs 4.0 0 100 % /snap/ snap-store/1113 loop21 squashfs 4.0 0 100 % /snap/ notepad-plus -plus /410 loop22 squashfs 4.0 0 100 % /snap/ snap-store/1216 loop23 squashfs 4.0 0 100 % /snap/ snapd/21759 loop24 squashfs 4.0 0 100 % /snap/ snapd/23258 loop25 squashfs 4.0 0 100 % /snap/ snapd-desktop-integration/247 loop26 squashfs 4.0 0 100 % /snap/ snapd-desktop-integration/253 loop27 squashfs 4.0 0 100 % /snap/ wine-platform-6 -stable/19 loop28 squashfs 4.0 0 100 % /snap/ wine-platform-9 -devel-core22/30 loop29 squashfs 4.0 0 100 % /snap/ wine-platform-9 -devel-core22/31 loop31 squashfs 4.0 0 100 % /snap/ wine-platform-runtime /393 loop32 squashfs 4.0 0 100 % /snap/ wine-platform-runtime -core22/91 loop33 squashfs 4.0 0 100 % /snap/ wine-platform-runtime -core22/92 loop34 squashfs 4.0 0 100 % /run/ wine loop35 0 100 % /snap/ wine-platform-runtime /394 nvme0n1 ├─nvme0n1p1 vfat FAT32 ESP 5 CC4-0 CC4 944.5 M 5 % /boot/ efi ├─nvme0n1p2 ntfs OS F2ACC4C2ACC48299 ├─nvme0n1p3 ntfs software 5 C4A914E4A9125B4 ├─nvme0n1p4 ntfs workspace 14 FE6913FE68EF04 ├─nvme0n1p5 vfat FAT32 F4AE-36 B7 ├─nvme0n1p6 swap 1 a1b4abe7-bc5d-4 e8b-80 d1-85 be1d4f4d3c [SWAP] ├─nvme0n1p7 ext4 1.0 3644 dc53-fc22-4192 -a85e-fe54987dae2d 50.2 G 52 % /var/ snap/firefox/ common/host-hunspell │ / ├─nvme0n1p8 ext4 1.0 6 a982e39-9594 -43 e5-9328 -d95a092945f8 └─nvme0n1p9 ntfs FA2E08952E084D57
发现 6a982e39 磁盘还在,对应设备 nvme0n1p8,只是加载不上来,这种情况下可以运行命令尝试修复:
1 e2 fsck -y /dev/nvme0 n1 p8
之后重启可以正常进入系统。
参考资料
文章链接:
https://www.zywvvd.com/notes/system/linux/ubuntu-home-crash/ubuntu-home-crash/