Related Items  

Linux and Windows IT Support  

dedicated-technology-experts

Windows, Apple and Linux IT support and services.

For Software and Web Development.

Restoring Grub2

PrintE-mail

If for some reason your grub has gotten corrupted, here are the steps to restore it.

Boot into a rescue CD (either Ubuntu or System Rescue CD, which you can download freely).

Mount the drive, where sdXY is the partition (eg: /dev/sda1)

sudo mount /dev/sdXY /mnt

Map all of system partitions (/dev, sys and proc):

sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

Then "chroot" to the new directory:

sudo chroot /mnt

Note: if you are using System Rescue CD, you may get this error:
chroot: failed to run command `/bin/zsh` : No such file or directory

In that case you have to specify the shell:

chroot /mnt /bin/bash

Once chrooted, run the following to install grub (where sdX is your drive where grub will be installed. You have to use the drive, not a partition. ie: /dev/sda, not /dev/sda1)

grub-install /dev/sdX
update-grub

Finally, unmount everything:

exit
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/dev
sudo umount /mnt

and reboot.

Original article is posted on the ALT Technical site.

 

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2024 Virtual Helpme | Business IT Support | Original Template: Allrounder