[SOLVED] How to properly restore GRUB with EFI boot?

I was trying to restore the GRUB after installing Manjaro GNOME Illyria to an external drive. I found the the wiki guide seems outdated now Restore the GRUB Bootloader.

What I tried is:

sudo mount /dev/sdXY /mnt
sudo mount /dev/sdXY /mnt/boot/efi
manjaro-chroot /mnt
sudo grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --bootloader-id=manjaro --recheck

But I got an error:

grub-install: error: failed to get canonical path of 'union'.

What’s the best way to install GRUB in EFI system?

If you were in the chroot when you ran that command it would just be /boot/efi not /mnt/boot/efi

2 Likes

use this , add --removable if external disk

manjaro-chroot -a ( select 1 if only one line )
fdisk -l ( check for /boot/efi)
grub-install --target=x86_64-efi --efi-directory=/install/boot/efi --bootloader-id=manjaro --boot-directory=/install/boot --recheck --debug 
exit ( quit chroot )
1 Like

Use this [Simple First Start] here to boot into manjaro external OS.
Since it is an external disk and you may occasionally remove it, do the ‘grub-install’ command with a “–removable”

sudo grub-install --removable

No need to chroot.

3 Likes

@dalto is correct, --efi-directory should be in /boot/efi after chroot.

But after reboot there’s no GRUB menu screen, it boots directly to Manjaro? I also have Windows 10 installed. How can I fix this?

can your report

inxi -Fxxxz
sudo fdisk -l
sudo efibootmgr -v
1 Like

EDIT inxi -Fxxxz command result:

System:    Host: Manjaro Kernel: 4.19.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.2.1 Desktop: Gnome 3.30.2 
           wm: gnome-shell dm: GDM 3.30.2 Distro: Manjaro Linux 
Machine:   Type: Laptop System: ASUSTeK product: X455LF v: 1.0 serial: <filter> 
           Mobo: ASUSTeK model: X455LF v: 1.0 serial: <filter> UEFI: American Megatrends v: X455LF.205 date: 08/03/2015 
Battery:   ID-1: BAT0 charge: 10.3 Wh condition: 24.2/37.3 Wh (65%) volts: 7.6/7.6 model: ASUSTeK ASUS Battery type: Li-ion 
           serial: <filter> status: Discharging cycles: 992 
CPU:       Topology: Dual Core model: Intel Core i3-5005U bits: 64 type: MT MCP arch: Broadwell rev: 4 L2 cache: 3072 KiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 15968 
           Speed: 798 MHz min/max: 500/1900 MHz Core speeds (MHz): 1: 799 2: 798 3: 798 4: 798 
Graphics:  Device-1: Intel HD Graphics 5500 vendor: ASUSTeK driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:1616 
           Device-2: NVIDIA GM108M [GeForce 930M] vendor: ASUSTeK driver: nouveau v: kernel bus ID: 04:00.0 chip ID: 10de:1346 
           Display: x11 server: X.org 1.20.3 driver: nouveau compositor: gnome-shell resolution: <xdpyinfo missing> 
           OpenGL: renderer: Mesa DRI Intel HD Graphics 5500 (Broadwell GT2) v: 4.5 Mesa 18.3.2 compat-v: 3.0 
           direct render: Yes 
Audio:     Device-1: Intel Broadwell-U Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:03.0 
           chip ID: 8086:160c 
           Device-2: Intel Wildcat Point-LP High Definition Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel 
           bus ID: 00:1b.0 chip ID: 8086:9ca0 
           Sound Server: ALSA v: k4.19.16-1-MANJARO 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8168 v: 8.045.08-NAPI 
           port: e000 bus ID: 02:00.0 chip ID: 10ec:8168 
           IF: enp2s0 state: down mac: <filter> 
           Device-2: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter vendor: AzureWave driver: ath9k v: kernel 
           port: e000 bus ID: 03:00.0 chip ID: 168c:0036 
           IF: wlp3s0 state: up mac: <filter> 
Drives:    Local Storage: total: 931.51 GiB used: 49.98 GiB (5.4%) 
           ID-1: /dev/sda vendor: Toshiba model: MQ01ABD100 size: 931.51 GiB speed: 6.0 Gb/s rotation: 5400 rpm 
           serial: <filter> rev: 2J scheme: GPT 
Partition: ID-1: / size: 56.84 GiB used: 49.96 GiB (87.9%) fs: ext4 dev: /dev/sda6 
           ID-2: swap-1 size: 6.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda7 
Sensors:   System Temperatures: cpu: 48.0 C mobo: 27.8 C 
           Fan Speeds (RPM): cpu: 2300 
Info:      Processes: 228 Uptime: 7m Memory: 3.75 GiB used: 1.01 GiB (27.0%) Init: systemd v: 239 Compilers: gcc: 8.2.1 
           Shell: bash v: 5.0.0 running in: gnome-terminal inxi: 3.0.30

Result for sudo fdisk -l command:

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA MQ01ABD1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3217804A-8CE7-4F23-B3D3-CF33DADC18B9

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     534527     532480   260M EFI System
/dev/sda2      534528     567295      32768    16M Microsoft reserved
/dev/sda3      567296  780388351  779821056 371.9G Microsoft basic data
/dev/sda4   780388352  781410303    1021952   499M Windows recovery environment
/dev/sda5   781410304 1819303935 1037893632 494.9G Microsoft basic data
/dev/sda6  1819303936 1940938751  121634816    58G Linux filesystem
/dev/sda7  1940938752 1953525134   12586383     6G Linux swap

And for sudo efibootmgr command:

BootCurrent: 0001
Timeout: 2 seconds
BootOrder: 0001,0000,0003,0004
Boot0000* Windows Boot Manager
Boot0001* manjaro
Boot0003* CD/DVD Drive
Boot0004* Hard Drive

Hmm, I guess I should just re-install Manjaro then…

If it boots directly to Manjaro, then do sudo update-grub from your Manjaro and reboot. In most cases it will fix both menu and Windows detection.
Or you can reinstall, of course, of you prefer more time-consuming ways of solving problems :grinning:

2 Likes

EDIT

I actually tried to run sudo update-grub first before re-installing GRUB, through “detect EFI bootloaders” with live media (perhaps that caused GRUB menu’s disappearance?).

But I also found a way around to restore it in Windows without any live media (sir @AgentS 's tutorial) (just in case someone with dual booting installation found it here):

bcdedit /set {bootmgr} path \EFI\Manjaro\grubx64.efi
bcdedit /set {bootmgr} description "Manjaro"

The optional bcdedit /set {bootmgr} description "Manjaro" command will just change the boot entry name. This is just in case the name changed to something else to avoid confusion.

Anyway, @openminded is also correct, executing sudo update-grub after re-install fixed it. So to summarize everything, the proper way to restore GRUB bootloader on EFI system is:

From live media:

sudo mount /dev/sdXY /mnt
sudo mount /dev/sdXY /mnt/boot/efi
sudo manjaro-chroot /mnt
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Manjaro --recheck
sudo update-grub
reboot

And to make sure everything is back to normal (after reboot):

sudo update-grub

Thank you everyone for responding here. I appreciate every single reply here :hugs: This is the best community IMHO! I’ll never leave Manjaro because of you guys :yum: Please, keep everything up :grin:

Good job searching!
We had this in a tutorial (or two…)

2 Likes

@AgentS My bad, I completely forgot to refer the link to your tutorial. I actually found the tutorial first, but was left with a new tab of It’s Foss article. Thank you sir :grin: (I’ll include the link in the previous post).

@AgentS Your tutorial was actually the reason why I flagged my OP for deletion.

Thank you everyone once again :grin:

CASE CLOSED

There was no need anyway.

Be well!

2 Likes

Nope, it’s before @dalto even replied (the second post) (edit: :rofl:)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.