Boot loader recovering
From ArchWiki
This article aims to lead one through the steps involved to re-install the boot loader if it ever stops working correctly.
For the purposes of this article, we shall assume that /dev/sda3 is the ArchLinux root partition and /dev/sda1 is the boot partition.
This article will show the steps used for the GRUB and LILO bootloaders. You should read the GRUB and LILO wiki pages to ensure that you know what you are doing. Remember, a boot loader recovery is nothing more than re-installing the program in the hard-drives MBR (Master Boot Record).
Contents |
[edit] Basics
[edit] Getting the Arch Linux bootable CD
Download or use a Arch Linux Base CD
ArchLinux Download
[edit] Booting with the Arch Linux CD
boot system with arch linux cd
-> at boot prompt do:
arch root=/dev/sda3
This means that the install/rescue cd will load its own kernel, but use '/dev/sda3' as the root directory. You will, essentially, be running the system that is on your hard-drive.
[edit] Fixing grub/lilo
Now do as root:
to fix grub: grub-install /dev/sda
to fix lilo: /sbin/lilo -v
[edit] Complicated
Sometimes, recovering your MBR wouldn't be a simple matter of re-installing the bootloader. It is possible that there was something wrong with the way the system was configured, and this led to the boot-loader failing. In this case, you might not even be able to use your install/rescue cd to boot into your root partition. You might just have to start the install-rescue cd normally (without passing the root= option) and then manually mounting your root partition.
arch
And then, mount the hard-drive partitions manually
mount /dev/sda3 /mnt mount /dev/sda1 /mnt/boot
You might even want to mount the 'special' directories. You will have to do this if you want to re-install your kernel, for example.
mount --bind /dev/ /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys
You might also want to consider copying the '/etc/mtab/' file, if you want to do a chroot into your newly mounted root partition
cp /etc/mtab /mnt/etc chroot /mnt
And then you run the 'install-grub', 'grub-install', or 'lilo' commands to install the bootloader to the MBR.