我正在尝试在我的机器上使用 Ubuntu(我的原始操作系统,在/dev/sda2
)、Kali Linux 和 Debian上设置多引导。然而,我在安装 Debian 的过程中被卡住了,由于 Ubuntu 需要很多时间来启动,我按照这篇文章的步骤来加快启动过程。但是当我重新启动我的机器时,Ubuntu 只会在紧急模式下启动......我唯一能注意到的是,在我/etc/fstab
的 Ubuntu 分区相关的行中已经消失了。
我很乐意在这里发布我的 fstab 的内容,但我不知道如何将它从紧急模式复制到这里(我正在使用我的 Kali Linux/dev/sda5
来写这篇文章)。也许有一种方法可以恢复我的 fstab,首先?
这是我的内容/etc/fstab
:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# /boot/efi was on /dev/sda1 during installation
UUID=95B2-5AED /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda3 during installation
UUID=69d6623e-0bcc-4cef-8b25-e46c98210d44 /home ext4 defaults 0 2
# swap was on /dev/sda4 during installation
UUID=a8ee0943-0cd9-4dba-b018-ca00fc450e5d none swap sw 0 0
Run Code Online (Sandbox Code Playgroud)
这是 thd 结果blkid | grep UUID
:
/dev/sda1: UUID="95B2-5AED" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="f3ead83c-a7ca-453b-8317-a854080d37fc"
/dev/sda2: UUID="7d4d2f18-146c-4d56-b5f3-0dc605eeb9e0" TYPE="ext4" PARTLABEL="Ubuntu" PARTUUID="94d6c9bd-30da-4abf-a784-41e20992fdd4"
/dev/sda3: UUID="69d6623e-0bcc-4cef-8b25-e46c98210d44" TYPE="ext4" PARTLABEL="Home" PARTUUID="dd1299b6-adb1-45c0-99a6-94e922f4964b"
/dev/sda4: UUID="a8ee0943-0cd9-4dba-b018-ca00fc450e5d" TYPE="swap" PARTUUID="228fa2d0-8b0c-4562-bb5a-ebb73bb00f04"
/dev/sda5: UUID="489b70a2-db82-4b0c-bebd-cf19a403ade1" TYPE="ext4" PARTUUID="48ba997c-e595-45c1-93c0-b97e4f7ffbf5"
/dev/sda6: UUID="9068da24-6073-45dc-a18e-29634daa3910" TYPE="ext4" PARTUUID="9033f352-349f-4cee-94bf-c686f462adea"
Run Code Online (Sandbox Code Playgroud)
我e2fsck
在我的 Ubuntu、home 和 Debian 分区上运行了命令,现在 Ubuntu 开始正常启动而不是启动到紧急模式,但在加载一段时间后冻结。
由于您的 Kali 安装正在运行,您可以使用它在 chroot 中访问您的 Ubuntu 安装。为此,请以 root 身份运行以下命令:
mkdir /ubunturoot
mount /dev/sda2 /ubunturoot
mount -o bind /dev /ubunturoot/dev
mount -o bind /dev/pts /ubunturoot/dev/pts
mount -o bind /proc /ubunturoot/proc
mount -o bind /sys /ubunturoot/sys
chroot /ubunturoot
Run Code Online (Sandbox Code Playgroud)
现在,您的命令提示符窗口(注意:仅此特定 shell!)应该可以访问您的 Ubuntu 根文件系统,就像您已登录 Ubuntu 并成为 Ubuntu 中的根一样。看一看并确保一切正常。
如果您的 Ubuntu/etc/fstab
出现错误,现在您可以对其进行编辑。
修复后,首先确保/boot/efi
文件系统已安装在您的 Ubuntu chroot 中:
mount /boot/efi
Run Code Online (Sandbox Code Playgroud)
然后运行ls /lib/modules
以查看一个或多个以内核版本号命名的目录。使用update-initramfs -u -k <kernel version number>
更新各自的Ubuntu内核的initramfs的文件。(由于您现在真的在运行 Kali 的内核,您必须明确指定 Ubuntu 内核的版本号:尝试更新默认内核会导致错误消息,因为 Ubuntu 和 Kali 的内核版本不太可能匹配。)
然后检查/etc/default/grub
提及文件系统 UUID 或其他可能在您的操作系统安装中发生更改的启动选项。根据需要进行修复,然后运行update-grub
以更新 Ubuntu 的 GRUB 引导加载程序的配置文件。
一旦您解决了您发现的所有问题,请手动撤消临时 chroot 环境:
umount /boot/efi
exit # out of the chroot environment, back to Kali native view of the filesystem
umount /ubunturoot/sys
umount /ubunturoot/proc
umount /ubunturoot/dev/pts
umount /ubunturoot/dev
umount /ubunturoot
rmdir /ubunturoot
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4424 次 |
最近记录: |