Grub: Difference between revisions
(New page: There are two methods two reinstall grub: Note: the grub bootloader is always 32-bit code, so you don't have to ensure you get an amd64 livecd just because you have an amd64 system. == M...) |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
There are two methods two reinstall grub. These can be used to fix the dreaded <code>GRUB error 15</code> on boot. These will not help you if you simply get dropped to the grub shell instead of seeing a menu. |
|||
There are two methods two reinstall grub: |
|||
Note: the grub bootloader is always 32-bit code, so you don't have to ensure you get an amd64 livecd just because you have an amd64 system. |
|||
== Method 1 == |
== Method 1 == |
||
This method will install the grub bootloader from the live cd onto your hard drive. |
This method will install the grub bootloader from the live cd onto your hard drive. |
||
NOTE: You can use a 32-bit live cd with a 64-bit installation of linux. |
|||
1. Acquire a live cd with grub on it. |
1. Acquire a live cd with grub on it. |
||
Line 28: | Line 28: | ||
cd /pub; more beer |
cd /pub; more beer |
||
9. Run the grub installation command (If this command isn't found then switch to Method 2, you can start with step 7. See the NOTE at the start of method 2 though) |
|||
grub-install --root-directory=/target /dev/sda |
grub-install --root-directory=/target /dev/sda |
||
Line 42: | Line 42: | ||
This method creates a fakeroot containing your actual installed linux distro and then installs the grub from that to your hard disk. |
This method creates a fakeroot containing your actual installed linux distro and then installs the grub from that to your hard disk. |
||
NOTE: If your linux install is 64-bit, then you <b>must</b> use a 64-bit live cd! |
|||
1. Acquire a live cd |
1. Acquire a live cd |
Latest revision as of 00:27, 25 November 2009
There are two methods two reinstall grub. These can be used to fix the dreaded GRUB error 15
on boot. These will not help you if you simply get dropped to the grub shell instead of seeing a menu.
Method 1
This method will install the grub bootloader from the live cd onto your hard drive.
NOTE: You can use a 32-bit live cd with a 64-bit installation of linux.
1. Acquire a live cd with grub on it.
2. Boot the live cd.
3. Open a terminal
4. Become root (from now on being root is implied for this guide)
sudo -i
5. Create a temporary working area. I like to use /target, its a debian habit.
mkdir /target
6. Mount your root partition. I'll be assuming its the first partition on sda for my examples
mount /dev/sda1 /target
7. If you have a seperate boot partition (the 2nd partition on sda in my example) then you have to mount that as well. Skip this step otherwise.
mount /dev/sda2 /target/boot
8. I don't want to catch anyone not drinking
cd /pub; more beer
9. Run the grub installation command (If this command isn't found then switch to Method 2, you can start with step 7. See the NOTE at the start of method 2 though)
grub-install --root-directory=/target /dev/sda
10. Unmount your boot partition if you had one
umount /target/boot
11. Unmount your root partition
umount /target
12. Reboot (make sure to remove the livecd at some point)
Method 2
This method creates a fakeroot containing your actual installed linux distro and then installs the grub from that to your hard disk.
NOTE: If your linux install is 64-bit, then you must use a 64-bit live cd!
1. Acquire a live cd
2. Boot the live cd.
3. Open a terminal
4. Become root (from now on being root is implied for this guide)
sudo -i
5. Create a temporary working area. I like to use /target, its a debian habit.
mkdir /target
6. Mount your root partition. I'll be assuming its the first partition on sda for my examples
mount /dev/sda1 /target
7. If you have other partitions you'll want to mount them now at the appropriate places under /target. You must have atleast /usr and /boot mounted if they are seperate partitions:
mount /dev/sda2 /target/boot mount /dev/sda3 /target/usr
8. Now we need to mount some extra virtual partitions
mount -o bind /dev /target/dev mount -o bind /dev/shm /target/dev/shm mount -o bind /dev/pts /target/dev/pts mount -o bind /sys /target/sys mount -o bind /proc /target/proc mount -o bind /proc/bus/usb /target/proc/bus/usb
9. Enter the fakeroot
chroot /target
10. Run the grub installation command (If this command isn't found then see method 2)
grub-install /dev/sda
11. Exit the fakeroot
exit
12. Unmount the virtual partitions
umount /target/proc/bus/usb umount /target/proc umount /target/sys umount /target/dev/pts umount /target/dev/shm umount /target/dev
13. Unmount your other partitions if you have them
umount /target/usb umount /target/boot
14. Unmount your root partition
umount /target
15. Reboot (make sure to remove the livecd at some point)