SUSE Support

Here When You Need Us

Reinstalling GRUB Bootloader from the Rescue System

This document (000019909) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 12

Situation

GRUB boot loader is damaged for some reason and needs to be reinstalled.

Resolution

In order to fix this problem, GRUB2 bootloader need to be reinstalled. 
 

Requirements


You are inside the chrooted root filesystem of the system in question. Ensure all needed filesystems are mounted, especially one holding /boot/grub2/<grub_cpu>-<grub_platform> (eg. /boot/grub2/x86_64-efi or /etc/grub2/i386-pc,...). If using an UEFI/EFI system, ensure /boot/efi filesystem is mounted. Inside chroot you can test with `mount -a -t nonfs,nonfs4,nocifs,noocfs2' for example (it mounts all but not NFS, CIFS, OCFS2 filesystems).

See How to Chroot in Rescue Mode for more details.

 

GRUB2 bootloader reinstallation

 

i386 / x86_64 UEFI/EFI systems


If you use an UEFI/EFI system, the bootloader is not installed into the beginning of a disk as in case of BIOS system (MBR, GPT), but into EFI system partition (with partition GUID 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B'; visible for example with `sfdisk -d <disk>'). Thus, the specific command for that is:
 
shim-install --config-file=/boot/grub2/grub.cfg
 

Note that `shim-install' will call `grub2-install' command itself.
 

i386 BIOS systems


On i386 (here 'i386' does not refer to a specific processor but to the whole platform/architecture) the bootloader is installed into the beginning of a disk (MBR, GPT), thus disk device must be defined as paramenter.

From grub2-install(8) man page:
INSTALL_DEVICE must be system device filename.  grub-install copies
GRUB images into boot/grub2.  On some platforms, it may also install
GRUB into the boot sector.
 
The commands themselves:
 
grub2-install -v <root disk>
grub2-mkconfig -o /boot/grub2/grub.cfg
 
Note: in case the root disk is part of LVM, then this is the physical volume (PV) holding root filesystem. E.g. /dev/sda.
 

POWER systems


On POWER systems, the destination of the bootloader is PReP partition, which must be the first one on the root disk. Note, if LVM is used for the root filesystem and the volume group (VG) consists of multiple physical volume (PV) located on multiple disks, all these disks must have PReP partition. Thus, always ensure the disk(s) holding root filesystem have PReP partition, otherwise the system may not boot. In contrast to BIOS systems, on a POWER system, the destination is the PReP partition.
 
grub2-install -v <PReP partition on root disk>
grub2-mkconfig -o /boot/grub2/grub.cfg
 

Using YaST bootloader module

 

YaST bootloader module calls 'grub2-install' in the background, more precisely:
grub2-install --target=<grub_cpu>-<grub_platform> --force --skip-fs-probe <root_disk>

Using the `yast2 bootloader' module can help resolve grub issues by running the command list above and by allowing other selections.

If there was a bootloader update error during patching or otherwise, it should be logged in /var/log/pbl.log.

Additional Information

Other TIDs


Other documentation

 

Tips


How to query root disk


`lsblk -s' could be used, search a line with '/' and up to first occurrence of 'disk'. An example:
# lsblk -s
NAME                                                      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
...snipped...
system-root                                               254:2    0    50G  0 lvm   /var
│                                                                                    /usr/local
│                                                                                    /tmp
│                                                                                    /srv
│                                                                                    /root
│                                                                                    /opt
│                                                                                    /boot/grub2/x86_64-efi
│                                                                                    /boot/grub2/i386-pc
│                                                                                    /.snapshots
│                                                                                    /
└─cr_nvme-SAMSUNG_MZALQ512HALU-000L1_S4YCNF0NC31508-part2 254:0    0 476.4G  0 crypt 
  └─nvme0n1p2                                             259:2    0 476.5G  0 part  
    └─nvme0n1                                             259:0    0 476.9G  0 disk  
system-home                                               254:3    0 347.7G  0 lvm   /home
...snipped...

# lsblk -s | sed -nr '/[[:blank:]]+\/$/,/disk[[:blank:]]*$/p'
│                                                                                    /
└─cr_nvme-SAMSUNG_MZALQ512HALU-000L1_S4YCNF0NC31508-part2 254:0    0 476.4G  0 crypt 
  └─nvme0n1p2                                             259:2    0 476.5G  0 part  
    └─nvme0n1                                             259:0    0 476.9G  0 disk 
 

Man pages

  • https://manpages.opensuse.org/Tumbleweed/grub2/grub2-install.8.en.html
  • https://manpages.opensuse.org/Tumbleweed/grub2/grub2-mkconfig.8.en.html

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000019909
  • Creation Date: 16-Mar-2021
  • Modified Date:15-Dec-2022
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.