Reinstalling GRUB
From ArchWiki
| Summary |
|---|
| This guide will show you how to reinstall GRUB with an Arch Installation CD if you lose GRUB somehow. |
| Languages |
| English |
| Español |
| Français |
| Česky |
| Italiano |
| Русский |
| Ελληνικά |
| 简体中文 |
This article duplicates GRUB#Bootloader installation.
This guide will show you how to reinstall GRUB with an Arch Installation CD.
Contents |
Notes
- In this guide, sda will be used as a root device reference.
- Also, be aware that this guide is aimed at people using libata, so substitute sda with hda if you have IDE devices and you are not using libata.
Booting the Install CD
The first thing you will need is an install CD. Any install CD should work; however, using the latest CD will be easier than using an older CD.
Boot the CD as if you were doing an installation. Do not use the root=option, and move on to the next step.
Mount and Chroot into Your Current Installation
Now, you need to mount your current installation. The general process for this is as follows:
You need to know what the proper partitions and file-system types are. This example will use sda1 as the root partition and ext3 as the file-system -- change as appropriate:
cd / mount -t ext3 /dev/sda1 /mnt mount -t proc proc /mnt/proc mount -t sysfs sys /mnt/sys mount -o bind /dev /mnt/dev chroot /mnt /bin/bash
Now you should be logged in as root, and into your current installation as if you had just booted it and logged in as root.
If your /boot directory is on the same partition as your /, move on to the next step. On the other hand, if it is on a separate partition (for example, /dev/sda2), then you need to mount that partition now to /boot so that grub can find the files it needs:
mount -t ext2 /dev/sda2 /boot
Before running grub-install you have to update your mtab, to do this run:
cp /proc/mounts /etc/mtab
Reinstalling GRUB
Edit /boot/grub/menu.lst and make sure that everything is in order. Once you are completely sure that menu.lst is correct, run the following command:
grub-install /dev/sda
This command should complete successfully if you have followed all the steps. (If not, take a look at the notes below.) Exit chroot and reboot:
cd / umount -a exit cd / umount -a reboot
Errors
- If you get an error that says The file /boot/grub/stage1 not read correctly, it probably means that your fstab/mtab is incorrect for some reason and needs to be fixed. These files are /etc/mtab and /etc/fstab. Edit them and make sure they point to the correct partitions, then rerun grub-install.
- If this still does not fix the error message and you are using ext2/3 as filesystem for your boot partition, use "tune2fs -l /dev/sda1" to check for the Inode size of your root/boot partition. Anything else than 128 will make grub unable to read the partition. The only solution for this problem is to recreate your root file-system with the correct options (fix /etc/mke2fs.conf and set inode_size to 128).
- If you get an error that says sed: can not read /boot/grub/device.map: No such file or directory, it means that you need to use the --recheck option with grub-install:
grub-install --recheck /dev/sda