RestoreGrub2

From PCLinuxOSHelp Knowledge Base
Revision as of 02:45, 7 May 2020 by Terryn (talk | contribs) (Add a link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • Relevant to All editions of PCLinuxOS.


YOU ARE HERE :: Main Page > Table of contents > Advanced > RestoreGrub2

This page describes ways to restore your PCLinuxOS GRUB2 bootloader.

Introduction

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 favourite 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.png

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 as you did when the system was installed.

Using 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