I need to restore GRUB bootloader on EFI partition:
As you can see, it’s on GPT partition table, is fat32 and has boot, esp flags. It doesn’t right mount yet, because I recreated it anew.
The weird problems I am facing is that when chrooting, I get error with mounting it (I got it right from the start, so even before recreating it):
sudo manjaro-chroot -a ✔ 14m 0s
grub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.
==> Mounting (ManjaroLinux) [/dev/sda2]
--> mount: [/mnt]
When I try restore EFI bootloader:
[manjaro /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
Installing for x86_64-efi platform.
grub-install: error: /boot/efi doesn't look like an EFI partition.
The check of this partition alone in Gparted results in error.
I found such old info:
I cannot do:
[manjaro /]# grub-mkdevicemap
bash: grub-mkdevicemap: command not found
The advice is to write my own map:
just write your own
/boot/grub/device.map
file. In your case, its contents could be just(hd0) /dev/sda
(Ideally, you would use an appropriate
/dev/disk/by-id/...
pathname in place of/dev/sda
, but that’s not mandatory.)
When I tried to create that file I got:
[manjaro /]# nano /boot/grub/device.map
Error in /root/.nanorc on line 1: Error expanding /usr/share/nano-syntax-highlighting/*.nanorc: No such file or directory
Remember, I’m still in Manjaro Live chrooted, but without proper mount.
So I tried exiting chroot and mounting manually:
sudo fdisk -l /dev/sda ✔
Disk /dev/sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: KINGSTON SM2280S
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: 642DAA87-4254-4F25-B10C-4D847C0C81ED
Device Start End Sectors Size Type
/dev/sda1 4096 208895 204800 100M EFI System
/dev/sda2 208896 234440703 234231808 111.7G Linux filesystem
~ sudo su ✔
[manjaro manjaro]# mount /dev/sda2 /mnt
[manjaro manjaro]# mount /dev/sda1 /mnt/boot/efi
[manjaro manjaro]# manjaro-chroot /mnt /bin/bash
[manjaro /]# pacman -Syu grub
:: Synchronizing package databases...
core is up to date
extra is up to date
multilib is up to date
DEB_Arch_Extra 7.3 KiB 39.1 KiB/s 00:00 [####################################] 100%
warning: grub-2.12-3 is up to date -- reinstalling
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
Packages (1) grub-2.12-3
Total Installed Size: 47.86 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [####################################] 100%
(1/1) checking package integrity [####################################] 100%
(1/1) loading package files [####################################] 100%
(1/1) checking for file conflicts [####################################] 100%
(1/1) checking available disk space [####################################] 100%
:: Running pre-transaction hooks...
(1/1) Create a backup list of all installed packages
/bin/sh: line 1: /home/michaldybczak/GoogleDrive/Backup/lista pakietów-home/2024-02-11_21:29_repozytoria.txt: No such file or directory
/bin/sh: line 1: /home/michaldybczak/GoogleDrive/Backup/lista pakietów-home/2024-02-11_21:29_AUR.txt: No such file or directory
error: command failed to execute correctly
:: Processing package changes...
(1/1) reinstalling grub [####################################] 100%
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Refreshing PackageKit...
Error connecting: Could not connect: No such file or directory
error: command failed to execute correctly
(3/4) pacnew-chaser notify
(4/4) Updating the info directory file...
[manjaro /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.
[manjaro /]# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.6-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.6-x86_64.img
Found initrd fallback image: /boot/initramfs-6.6-x86_64-fallback.img
Found linux image: /boot/vmlinuz-6.1-x86_64
Found initrd image: /boot/intel-ucode.img /boot/initramfs-6.1-x86_64.img
Found initrd fallback image: /boot/initramfs-6.1-x86_64-fallback.img
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.
ERROR: mkdir /var/lock/dmraid
grub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdd1. Check your device.map.
Adding boot menu entry for UEFI Firmware Settings ...
Looks, like there’s been errors, basically one main error from the beginning…
Checking further:
[manjaro /]# ls /sys/firmware/efi
config_table efivars esrt fw_platform_size fw_vendor runtime runtime-map systab
Is that OK? Looks all right.
Ok, next steps are:
[manjaro /]# exit
exit
[manjaro manjaro]# modprobe efivarfs
[manjaro manjaro]# manjaro-chroot /mnt /bin/bash
[manjaro /]# mount -t efivarfs efivarfs /sys/firmware/efi/efivars
[manjaro /]# ls /sys/firmware/efi
config_table efivars esrt fw_platform_size fw_vendor runtime runtime-map systab
No errors at this point. I’m afraid, the system still won’t boot correctly because of the:
cannot find a GRUB drive for /dev/sdd1.
I have no idea, what is GRUB driver? Isn’t it the whole EFI partition?
OK, going to reboot, as that is all I could do, following those instructions. Fingers crossed.