Need help reinstall grub

My computer crashed during an update which caused Garuda to be missing from the boot options. I booted from a live usb to try and fix the issue using Garuda Boot Repair, but aftering running the fix option Windows also disappeared from the boot options.

I tried following this Reinstalling GRUB - #15 but get the follow error

sudo mount /dev/sda2 /mnt
─garuda@garuda in ~ as 🧙 took 25ms
╰─λ cd /mnt/@
╭─garuda@garuda in /mnt/@🔒 as 🧙 took 87ms
╰─λ sudo mount /dev/sda1 /boot/efi

╭─garuda@garuda in /mnt/@🔒 as 🧙 took 36ms
╰─λ sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=garuda --recheck
Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `overlay'.

here is my fdisk output

╭─garuda@garuda in /mnt/@🔒 as 🧙 took 3ms
╰─λ sudo fdisk -l
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 870
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D5B18F49-EAF4-A047-BEB6-9F33B5B5526D

Device      Start        End    Sectors   Size Type
/dev/sda1    4096     618495     614400   300M EFI System
/dev/sda2  618496 1953520064 1952901569 931.2G Linux filesystem


Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: Sabrent
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1812AB88-983C-48EE-9030-C07162AFA8EF

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1333247    1331200   650M EFI System
/dev/nvme0n1p2    1333248    1595391     262144   128M Microsoft reserved
/dev/nvme0n1p3    1595392 1966018559 1964423168 936.7G Microsoft basic data
/dev/nvme0n1p4 1966018560 1968046079    2027520   990M Windows recovery environment
/dev/nvme0n1p5 1968046080 1998034943   29988864  14.3G Windows recovery environment
/dev/nvme0n1p6 1998034944 2000408575    2373632   1.1G Windows recovery environment


Disk /dev/sdb: 14.94 GiB, 16039018496 bytes, 31326208 sectors
Disk model: USB DISK 2.0
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 5122467 5122404  2.4G  0 Empty
/dev/sdb2       5122468 5130659    8192    4M ef EFI (FAT-12/16/32)


Disk /dev/loop0: 18.94 MiB, 19857408 bytes, 38784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 430 MiB, 450883584 bytes, 880632 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 1.25 GiB, 1337995264 bytes, 2613272 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 680.74 MiB, 713805824 bytes, 1394152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/zram0: 31.21 GiB, 33516683264 bytes, 8182784 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Does anyone know how I can repair this?

Hi there, welcome to the forum.
This tutorial is more complete and precise.

From the live USB:

sudo mkdir -p /mnt/broken
sudo mount /dev/sda2 /mnt/broken
sudo garuda-chroot /mnt/broken/@

From inside the chroot:

mount /dev/sda1 /boot/efi
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=garuda --recheck
update-grub
exit

update-grub should launch the os-prober, which should find the Windows installation.

1 Like

So i ran all those commands and got no errors, but when i boot i dont have get give an option to choose the OS to boot from. I would sent a picture but it won’t let me because im a new user.

Enter in a terminal efibootmgr and provide the output, to see what you’re booting by default.
It could be that everything was/is in /dev/nvme0n1p1, which is an EFI System Partition as well.
So you could try to switch to that, or repeat the procedure with /dev/nvme0n1p1 instead of /dev/sda1.

Here is the output from efibootmgr

BootCurrent: 0004
Timeout: 0 seconds
BootOrder: 0002,0001,0003,0004
Boot0000* Windows Boot Manager	HD(1,GPT,ef9c2eeb-725a-46e9-abb5-3db1636cec24,0x800,0x145000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d0000005f000100000010000000040000007fff0400
Boot0001* UEFI: Sabrent, Partition 1	HD(1,GPT,23fb5d92-9662-4a5d-b730-c10ef99ab09a,0x800,0x145000)/File(EFI\Microsoft\Boot\bootmgfw.efi)0000424f
Boot0002* garuda	HD(1,GPT,65429e5f-6f53-304e-b10b-a68cf8025aa4,0x1000,0x96000)/File(\EFI\garuda\grubx64.efi)
Boot0003* UEFI: Samsung SSD 870 QVO 1TB, Partition 1	HD(1,GPT,65429e5f-6f53-304e-b10b-a68cf8025aa4,0x1000,0x96000)/File(EFI\boot\bootx64.efi)0000424f
Boot0004* UEFI:  USB DISK 2.0 PMAP, Partition 1	PciRoot(0x0)/Pci(0x14,0x0)/USB(1,0)/HD(1,MBR,0x0,0x4e29a4,0x2000)0000424f

I’m not quite sure how to modify the commands to use /dev/nvme0n1p1 instead, I tried and it didn’t have the @ directory.

The strange thing for me is that 0000 is missing in the BootOrder.
Can you check if you can boot Windows using the Function Key for your boot loader selection (e.g. F12)?
If you can boot Windows, disable the “fast startup” feature in Windows. What Is “Fast Startup” Mode and How to Enable or Disable It? - MiniTool, login back to Garuda and try again:

sudo update-grub

Also make sure (but this should be the default) that you see GRUB_DISABLE_OS_PROBER=false (uncommented) in /etc/default/grub

You have to change only

mount /dev/sda1 /boot/efi

with

mount /dev/nvme0n1p1 /boot/efi
1 Like

Ok, I did that and still not luck. Here is the output of running update-grub if it helps

Generating grub configuration file ...
Found theme: /usr/share/grub/themes/garuda-dr460nized/theme.txt
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2024-06-06 10:04:17 | @/.snapshots/247/snapshot | pre  | pacman -Su                           |
Found snapshot: 2024-04-22 09:38:16 | @/.snapshots/246/snapshot | post | aalib accountsservice alsa-card-profiles attica baloo beautyline bind bi |
Found snapshot: 2024-04-22 09:31:02 | @/.snapshots/245/snapshot | pre  | pacman -Su                           |
Found snapshot: 2024-04-13 11:31:02 | @/.snapshots/244/snapshot | post | alsa-card-profiles ark aspnet-runtime-6.0 aspnet-runtime-7.0 baloo-widge |
Found snapshot: 2024-04-13 11:27:00 | @/.snapshots/243/snapshot | pre  | pacman -Su --config /tmp/tmp.EQ9gQtAm4g                                  |
Found snapshot: 2024-04-11 21:42:30 | @/.snapshots/242/snapshot | pre  | pacman -Su                           |
Found snapshot: 2024-04-03 11:49:57 | @/.snapshots/241/snapshot | pre  | pacman -S scanner-support printer-support --needed                       |
Found snapshot: 2024-04-01 20:28:23 | @/.snapshots/238/snapshot | post | nmap                                 |
Found snapshot: 2024-04-01 20:28:21 | @/.snapshots/237/snapshot | pre  | pacman -S --config /etc/pacman.conf -- extra/nmap                        |
Found snapshot: 2024-03-30 21:18:47 | @/.snapshots/236/snapshot | post | postman-bin                          |
Found snapshot: 2024-03-30 21:18:38 | @/.snapshots/235/snapshot | pre  | pacman -S --config /etc/pacman.conf -- chaotic-aur/postman-bin           |
Found 11 snapshot(s)
Unmount /tmp/grub-btrfs.dG3usCpxVm .. Success
Found memtest86+ image: /boot/memtest86+/memtest.bin
done

And this is what is looks like when I boot Imgur: The magic of the Internet

Just in case… I edited my post above when you maybe already started working…
Have you been able to boot Windows with the Function Key for boot order selection (at least this would be a workaround) and remove “fast startup”?

Yes, I can boot to windows, just not Garuda. And I disabled fast startup. I didn’t do the GRUB_DISABLE_OS_PROBER=false part, so I will try that now

Not needed. The os-prober works

:frowning:
Try again the procedure changing only

mount /dev/sda1 /boot/efi

with

mount /dev/nvme0n1p1 /boot/efi

And recheck in efibootmgr it is shown as first in the order.
You can use sudo efibootmgr -o to change the order, if necessary. See e.g.

1 Like

Pretty much the exact same output :confused:, I did change the boot order to start with 0000 tho. Is it possible to reinstall and not lose my files and settings?

No, you have to backup your home folder from the live USB.
But hold on a little bit more.
There might be something stupid i’m missing.
I’ve stopped dual booting since quite some time now.
Maybe someone else will jump in with other suggestions.

2 Likes

Ok, thanks for your help so far. I’ll hold off making anymore changes.

1 Like

A crash during an update may need a more aggressive intervention than just reinstalling the bootloader. See this article here: https://wiki.archlinux.org/title/Pacman#Pacman_crashes_during_an_upgrade

A good place to start is to try successfully completing the upgrade. Set up a chroot again from the live environment.

garuda-chroot -a

Then try running an update.

garuda-update

Paste the output into the thread if it fails or there are any errors so we can see what is happening. If the update succeeds, exit the chroot and see if you are able to boot back into the installation again.

3 Likes

:exploding_head:
I’m just blind or dumb…
:wink:

1 Like

Maybe i did something wrong, here is the output.


╭─garuda@garuda in ~ as 🧙 took 81ms
[🔍] × sudo garuda-chroot -a /mnt/broken/@/
==> ERROR: No Linux partitions detected!

╭─garuda@garuda in ~ as 🧙 took 4s
[⚡] × sudo garuda-chroot /mnt/broken/@/
sh-5.2# garuda-chroot -a
sh: garuda-chroot: command not found
sh-5.2# garuda-update
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)

--> Refreshing mirrorlists using rate-mirrors, please be patient..🍵
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)
spawn pacman -Su -yy
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)
sh-5.2#

It looks like the database is still locked from the update that crashed. Go ahead and remove the lock file, then try again.

rm /var/lib/pacman/db.lck

Ok, this is what i got next. https://termbin.com/ag96

Some of those errors are normal when you are running an update inside the chroot.

Did you chmod 777 anything while you were troubleshooting? That is almost always a dangerous move, because it can be difficult or impossible to undo.

Anyway, before getting out of the chroot try reinstalling the kernel. That will ensure you have a good kernel and will regenerate the initramfs as well.

pacman -S linux-zen
1 Like

I didnt change any file permissons. Should i reinstall now, or wait?