Difference between revisions of "RestoreGrub2"

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search
m (optimize)
(Standardising format & categorisation)
Line 1: Line 1:
To fix or restore the GRUB2 bootloader on your PCLinuxOS system:
+
 
 +
<div style="-moz-border-radius:10px; color:#204A87; font-style:normal; font-size:90%; font-weight:bold; border:1px solid #AAAAAA; background:#E7F4FC; padding:5px; margin:6px;">
 +
 
 +
* Relevant to ALL editions of PCLinuxOS.
 +
 
 +
</div>
 +
 
 +
<div style="float:right;margin-left:5px;">__TOC__</div>
 +
 
 +
'''YOU ARE HERE :: [[Main Page]] > [[Main Page#Table of contents|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 please follow these steps outlined below:
 +
 
 +
== Boot from good media ==
  
 
Boot a recent PCLinuxOS LiveOS and open a '''root''' terminal to execute the commands given below:
 
Boot a recent PCLinuxOS LiveOS and open a '''root''' terminal to execute the commands given below:
 +
 +
== Mount partitions ==
  
 
Mount your PCLinuxOS root partition  
 
Mount your PCLinuxOS root partition  
Line 15: Line 36:
  
 
(replace sdaY with whatever '''your''' ESP is)
 
(replace sdaY with whatever '''your''' ESP is)
 +
 +
== GRUB2 re-install ==
  
 
Run the following commands to re-install the grub bootloader code
 
Run the following commands to re-install the grub bootloader code
Line 21: Line 44:
 
   chroot /mnt
 
   chroot /mnt
 
   /boot/grub2/install.sh
 
   /boot/grub2/install.sh
 +
 +
== Check result ==
  
 
If all goes well you will see:
 
If all goes well you will see:
  
 
   Installation finished. No error reported.
 
   Installation finished. No error reported.
 +
 +
== Followup procedures ==
  
 
Exit the chroot environment with CTRL-D  
 
Exit the chroot environment with CTRL-D  
Line 34: Line 61:
 
   umount /mnt
 
   umount /mnt
 
   reboot
 
   reboot
 +
 +
[[category:Advanced]]

Revision as of 11:30, 19 April 2020

  • 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 please follow these steps outlined below:

Boot from good media

Boot a recent PCLinuxOS LiveOS and open a root terminal to execute the commands given below:

Mount partitions

Mount your PCLinuxOS root partition

 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)

GRUB2 re-install

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

Check result

If all goes well you will see:

 Installation finished. No error reported.

Followup procedures

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