banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Wiki Pick: Restore Grub2


by The PCLinuxOS Community

Relevant to all editions of PCLinuxOS.


Your bootloader may end up corrupt or overwritten by another operating system due to many factors such as user error, power loss or malware etc. In such situations, you may find yourself in search of a way to restore your bootloader to a state in which it will normally load your favorite PCLinuxOS.

To fix or restore the GRUB2 bootloader on your PCLinuxOS system you will need to boot a recent PCLinuxOS LiveOS then you can choose one of the 2 methods below depending on whether you prefer using the command-line or graphical user interface.


Using redo-bootloader graphical tool

You will find the redo-bootloader application in the Configuration section of the main menu. If it is missing, then install the redo-bootloader package using the Synaptic package manager.


redo-bootloader

The window shows the Linux partitions available on your system. Select the correct root partition and then click FixBoot. The tool will then mount that partition and enable you to re-install the bootloader.


Using the command-line interface

If you prefer to use the command line, then open a root terminal and enter the following commands:

mkdir -p /mnt
mount /dev/sdaX /mnt
(replace sdaX with whatever your root partition is)

If this is a UEFI system mount the EFI System Partition (ignore this step for a BIOS/legacy system).

mount /dev/sdaY /mnt/boot/EFI (replace sdaY with whatever your ESP is)

Run the following commands to re-install the grub bootloader code:

for i in /sys /proc /dev; do mount -B $i /mnt$i; done
chroot /mnt /boot/grub2/install.sh

If all goes well, you will see:

Installation finished. No error reported. Exit the chroot environment with CTRL-D.

Undo the mounts and then reboot.

for i in /sys /proc /dev; do umount /mnt$i; done
umount /mnt/boot/EFI # if necessary
umount /mnt reboot

Reboot again and that should do it.



Previous Page              Top              Next Page