删除sudo后无法访问grub

删除sudo后无法访问grub

我删除了 sudo,并且无法访问 grub 以便恢复它。我有一种不好的预感,我没有grub。有什么可能的方法来恢复它吗? apt-get 在我的电脑上也不起作用。

答案1

chroot您可以通过从任何其他 LiveCD 或 LiveUSB 发行版进入 Debian/Ubuntu 系统来解决此问题。假设您使用 Debian LiveCD 启动计算机:

# Mount your file systems as specified in your system's fstab
# e.g. into /mnt

# Mount the virtual filesystems before chrooting
for DIR in sys proc dev dev/pts; do mount -o bind $DIR /mnt/$DIR; done

# now chroot into your system
chroot /mnt /bin/bash

从那时起,只需运行命令,就像在初始系统上的终端中一样。完成后,运行sync并重新启动到已修复的系统。

注一思考如果您的系统使用 SELinux,这可能无法按预期工作。你必须先尝试一下。

相关内容