挽救引导程序损坏的系统
From ArchWiki
| i18n |
|---|
| English |
| 中文(简体) |
[edit] Q: 我犯了一些错误导致我的引导程序损坏了。如何能恢复呢?
A1: 使用Arch安装光盘里面的内核来启动你的Arch Linux可能是最简单的。把安装光盘放到光驱里面并重启。当出现boot: 提示的时候,使用光盘中的内核启动,但是需要指定一下root分区:
vmlinuz root=/dev/hdxy
hdxy是root所在的分区。
A2: 如果 A1 没能解决你的问题,你可以使用Arch Linux安装光盘启动,然后手动mount/chroot你的系统,之后修复错误。在下面的指导中假设你使用的0.7.1(Noodle)安装光盘。同时也假设你的root分区是 /dev/hda3 ,你的 /boot 文件夹是在 /dev/hda1。在使用时,请调整这些设备名称以符合你的实际情况。
1. 使用安装光盘启动电脑,在出现boot提示的时候按Enter键。
2. 把你的系统挂载到/mnt,包括所有GRUB/LILO需要的假的文件系统。
# mount /dev/hda3 /mnt # mount /dev/hda1 /mnt/boot # mount -o bind /dev /mnt/dev # mount -t proc none /mnt/proc # mount -t sysfs none /mnt/sys
3. chroot到你的系统。
# chroot /mnt /bin/bash
4. 一旦到了新系统中,就好像你已经成功启动到你的系统一样,可以安装系统引导程序。
4a. 如果需要修复LILO,只需要使用vi或者nano编辑/etc/lilo.conf文件,然后运行/sbin/lilo命令。 4b. 如果需要修复GRUB,编辑/boot/grub/menu.lst 文件。如果需要彻底重新安装GRUB,请使用 install-grub 脚本:
# install-grub /dev/hda /dev/hda1
5. 使用exit命令退出chroot,重启电脑。
A3: 此外还可以使用Live CD(例如Knoppix,AMLUG,或者Arch安装光盘)来启动电脑。使用live CD启动,挂载包含lilo.conf或者grub设置的分区。然后运行 lilo -C /mnt/hdxy/etc/lilo.conf 来安装lilo,或者使用等价的grub命令(这里需要有人在查看了grub的帮助之后添上)来安装grub。
This will only work if the devices on the live CD and the lilo.conf are equivalent. If you have trouble, you may want to specify a temporary boot configuration that will reload your Arch Linux partition, then reboot, and install LiLo/Grub again from within Arch.(这只能在live CD和lilo.conf的设备相同的情况下使用。如果遇到了麻烦,你可能需要指定一个临时的启动配置来加载你的Arch Linux分区,之后重启,在Arch里重新安装Lilo/Grub。)
你或许想要看看 这里.