# Fail to reinstall grub in dual boot system after crash

**URL:** <https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842>\
**Category:** Rocky Linux Help & Support\
**Created:** [May 9, 2023, 8:46am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842 "2023-05-09T08:46:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rommel](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@rommel](https://forums.rockylinux.org/u/rommel)\
**Post date:** [May 9, 2023, 8:46am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/1 "2023-05-09T08:46:32Z")

</div>

The grub boot menu is lost after crash and cannot locate RL 9.1 to boot in.  
In BIOS, it didn’t show the RL (on the same disk different partition as Window that was shown before crash.).

 ![BIOS](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/b/baf154894c252c79309e7edd954bba20ab652a16.png)  
After boot in by USB and lsblk, it looks like  
 ![lsblk](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/b/baed7b85a188b994ba06e5012a9e90cd450e0ee2.jpeg)  
fdisk like below (the /dev/sda is data disk)  
 ![fdisk_sdx](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/c/c07b2fb4631f24046e8d09656c2c1efd18749c26.png)  
 ![fdisk_mapper](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/2X/1/14bf740d5962e613e55984d946be2c313e967219.jpeg)

I tried below to reinstall grub:

```auto
mount /dev/mapper/live-rw /mnt #also tried mount /dev/mappe/rl_localhost--live-root /mnt
mount /dev/sdb2 /mnt/boot
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
mount -o bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
mount -o bind /run /mnt/run

chroot /mnt/
dnf reinstall shim-* grub2-efi-* grub2-common
grub2-mkconfig -o /boot/EFI/rocky/grub.cfg

```

The error msg is  
/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/live-rw’

I’d tried to mount /dev/sdb6; /dev/mapper/live-base (this mount become read only) to /mnt respectively and doesn’t help.

After exit chroot, tried to deactiveate Volume group  
vgchange -an rl\_localhost-live  
Logical volumen rl\_localhost-live/swap in use  
Can’t deactive volume group “rl\_localhost-live” with 1 open logical volume  
Then  
lvchange -an /dev/rl\_localhost-live/swap  
Logical volume /dev/rl\_localhost-live/swap in use.

Hope that someone can provide hints on how to restore the RL instead of reinstall it from scratch. Thank you.

---

<div class="post-metadata">

**Author:** ![jbkt23](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jbkt23](https://forums.rockylinux.org/u/jbkt23)\
**Post date:** [May 9, 2023, 11:19am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/2 "2023-05-09T11:19:40Z")

</div>

> [@rommel](#):
>
> `grub2-mkconfig -o /boot/EFI/rocky/grub.cfg`

That is incorrect path for RL9. The correct path is:

```auto
grub2-mkconfig -o /boot/grub2/grub.cfg

```

The grub.cfg in …/EFI/rocky/ is a stub file that points to your boot partition UUID.  
Here is mine:

```auto
search --no-floppy --fs-uuid --set=dev 7277c17d-6897-497b-9390-1153c9bff018
set prefix=($dev)/boot/grub2
export $prefix
configfile $prefix/grub.cfg

```

So you’ll have to delete rocky/grub.cfg and recreate it with the above contents substituting your /boot UUID for the one after “–set=dev” then run grub2-mkconfig with the correct path again.

---

<div class="post-metadata">

**Author:** ![rommel](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@rommel](https://forums.rockylinux.org/u/rommel)\
**Post date:** [May 10, 2023, 5:04am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/3 "2023-05-10T05:04:17Z")

</div>

Thank you for the hint. Unfortunately, the same error  
/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/live-rw’  
block the update to grub file.

In my /boot/EFI/rocky/grub.cfg file, cannot find the line with “search … -set=dev …” just plenty lines of “search … --set=root…”

---

<div class="post-metadata">

**Author:** ![jbkt23](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@jbkt23](https://forums.rockylinux.org/u/jbkt23)\
**Post date:** [May 10, 2023, 11:58am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/4 "2023-05-10T11:58:14Z")

</div>

> [@rommel](#):
>
> In my /boot/EFI/rocky/grub.cfg file, cannot find the line with “search … -set=dev …” just plenty lines of “search … --set=root…”

That’s because you over wrote it with your prior grub2-mkconfig command. What I posted above are the entire contents of the EFI/rocky/grub.cfg stub file. It needs to point to the /boot partition UUID. The error message, which I am not familiar with may be related to it not finding /boot when you are trying to fix this. I didn’t see that you mounted that partition in the initial post. I don’t know how to mount volumes, someone else will have to show the way.

---

<div class="post-metadata">

**Author:** ![rommel](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@rommel](https://forums.rockylinux.org/u/rommel)\
**Post date:** [May 11, 2023, 3:43am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/5 "2023-05-11T03:43:30Z")

</div>

Thank you! You had help me on the correct location of the grub.cfg.  
I’m still fighting with the error message which looks like relate to LVM problem.  
Looks like reinstalling the RL is the only way out.

---

<div class="post-metadata">

**Author:** ![brian](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/brian/32/5777_2.png) [@brian](https://forums.rockylinux.org/u/brian)\
**Post date:** [August 25, 2023, 3:15am UTC](https://forums.rockylinux.org/t/fail-to-reinstall-grub-in-dual-boot-system-after-crash/9842/6 "2023-08-25T03:15:00Z")

</div>

Closed on August 25, 2023, 3:15am UTC


