You are not logged in.

#1 2017-08-03 13:43:21

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

[SOLVED] Unable to boot to GRUB on UEFI

Hello everyone. I'm here because I need your help about booting GRUB on an UEFI motherboard.

I wanted to set up Arch on my computer but I am unable to boot it as GRUB won't show on my motherboard's boot menu.

This is my partition scheme :

# fdisk -l /dev/sda

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
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: 34D3D64C-B4F0-4021-B040-302B0EAFD2EB

Device       Start        End    Sectors  Size Type
/dev/sda1     2048    1050623    1048576  512M EFI System
/dev/sda2  1050624 1953523711 1952473088  931G Linux filesystem

After following the installation guide, I format the ESP and mount it :

# mkfs.vfat /dev/sda1
# mount -t vfat /dev/sda1 /boot/efi

Then I install GRUB :

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch-grub

Installing for x86_64-efi platform.
Installation finished. No error reported.

Then I generate the GRUB configuration file.

This is what efibootmgr gives me after the GRUB installation :

# efibootmgr

BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0000,0003,0004,0001,0002
Boot0000* arch-grub
Boot0001  Hard Drive
Boot0002  USB KEY
Boot0003* UEFI: SMI USB DISK 1100
Boot0004* UEFI: SMI USB DISK 1100, Partition 2

arch-grub is there, but when I reboot I don't see it in my boot menu.

This is what efibootmgr gives me after rebooting:

# efibootmgr

BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0004,0001,0002
Boot0001  Hard Drive
Boot0002  USB KEY
Boot0003* UEFI: SMI USB DISK 1100
Boot0004* UEFI: SMI USB DISK 1100, Partition 2

arch-grub has gone hmm

I feel so stupid because I have already set up Archlinux with GRUB months ago on my computer and it worked fine.

My motherboard is an MSI Z270 Gaming M5.

I have no "Secure Boot" options but a "Windows 7 Installation" option. I tought this was something about secure boot so I have tried installing GRUB with both this option enabled and disabled.

I have also tried rEFInd, installed without errors, but no luck.

Thank you in advance smile

Last edited by Qwoak (2017-08-03 18:46:28)

Offline

#2 2017-08-03 14:43:08

ShinyShinx
Member
Registered: 2017-08-03
Posts: 13

Re: [SOLVED] Unable to boot to GRUB on UEFI

I had the same issue a while ago.
My and a few friends on Discord were trying to figure out why my Arch wouldnt boot. (It was because I accidentally deleted the /boot folder, but thats for another story)

I can tell you from that experience that all of your commands are correct. Although you should be able to just mount the ESP without using -t vfat.

Is this a fresh install? I don't see why else you would format the ESP.
Also, I do have to ask, did you mount /dev/sda2 ? It doesn't show anywhere in your post that you did. (That's sort of important)

This is what it looks like to me:
It looks like you might have installed GRUB to the ESP without the Arch partition mounted, causing it to have no destination when booting. This would have taken you to the GRUB terminal upon booting. Is this what it does?


Meow :3

Offline

#3 2017-08-03 14:55:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Unable to boot to GRUB on UEFI

You might have to check in your UEFI firmware if you have an option to add an EFI entry there. My laptop also disallowed adding an entry with efibootmngr but I had a "add boot entry" option within the firmware that allowed me to select the grub binary (well technically I used systemd-boot but the principle should be the same regardless), which has since remained there.

Offline

#4 2017-08-03 15:04:20

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

Thank you for your replies.

@ShinyShinx

Yes, This is a fresh install.

Sorry, I have omited the steps where I mount the Arch partition (because I said that I have followed the installation guide).

This is what I've done after the first attempt :

# mount /dev/sda2 /mnt
# arch-chroot /mnt
# mount /dev/sda1 /boot/efi
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch-grub
Installing for x86_64-efi platform.
Installation finished. No error reported.

# grub-mkconfig -o /boot/grub/grub.conf

I don't understand. I tought I've made a bad setting so i've cleared the CMOS, but it still doesn't work hmm

@V1del

I'll recheck if I can do this.

Last edited by Qwoak (2017-08-03 15:06:36)

Offline

#5 2017-08-03 15:18:23

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

V1del wrote:

You might have to check in your UEFI firmware if you have an option to add an EFI entry there. My laptop also disallowed adding an entry with efibootmngr but I had a "add boot entry" option within the firmware that allowed me to select the grub binary (well technically I used systemd-boot but the principle should be the same regardless), which has since remained there.

I have checked my UEFI firmware and unfortunately I don't see such options hmm

MSI_Snap_Shot_00.jpg
MSI_Snap_Shot_01.jpg

Usually I should have something like "UEFI Hard Drive BBS Priorities" but as GRUB is not detected and as I haven't any other bootloaders, I don't have this option.

Last edited by Qwoak (2017-08-03 15:42:54)

Offline

#6 2017-08-03 15:43:48

ShinyShinx
Member
Registered: 2017-08-03
Posts: 13

Re: [SOLVED] Unable to boot to GRUB on UEFI

First off, nice BIOS wink
(Don't judge, I just call all the UEFI/BIOS firmware BIOS)

You can try installing it outside of chroot. Thats the only thing that really stands out to me.

Also, what boot menu is appearing? You mentioned there was a boot menu. Is it the one for the BIOS or is it GRUB? Because if its GRUB, you can try to force boot Arch and fix it in the system. I find it alot easier from the system than from the installation media.

When you mount the ESP and ls into /boot/efi, what shows up?


Meow :3

Offline

#7 2017-08-03 15:50:48

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

@ShinyShinx

By boot menu, I mean the one from the BIOS.

This is what's inside my ESP:

# ls /boot/efi/
EFI
# ls /boot/efi/EFI/arch-grub/
grubx64.efi

Last edited by Qwoak (2017-08-03 15:58:11)

Offline

#8 2017-08-03 16:22:47

ShinyShinx
Member
Registered: 2017-08-03
Posts: 13

Re: [SOLVED] Unable to boot to GRUB on UEFI

Okay thats what I thought.

In the boot options (F9 on start up for me) it will give you an option to select what drive/partition to boot. Usually theres an option to boot an efi file. If thats the case, you can simply direct it to the grub.efi file there and boot up grub (hopefully)

If that doesnt work, I would recommend reinstalling Arch.
(follow the arch install guide till about where you would install grub, but do not mount the esp until then)

cfdisk might have gotten confused and showed you the wrong drive. If thats the case, it would have installed grub to the esp on the usb and not the system.


Meow :3

Offline

#9 2017-08-03 16:51:26

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

@ShinyShinx

My motherboard doesn't allow me to do this hmm But I've found a Live USB of Manjaro in my stuff that have an "Autodetect EFI Bootloaders" option at boot that detect GRUB on my ESP and loads it perfectely.

I have tried 3 times to reinstall Arch (and many times before this on various machines without any problems), so I guess the problem comes from elsewhere.

I must find a way to make the GRUB EFI entry persistent.

I saw a video on Youtube of someone who has the same UEFI Firmware as mine and fix the problem by using EasyUEFI under Windows,
So I'll try installing Windows on another drive and I'll keep you informed if EasyUEFI fixes the problem wink

Last edited by Qwoak (2017-08-03 16:54:42)

Offline

#10 2017-08-03 17:02:23

loqs
Member
Registered: 2014-03-06
Posts: 17,321

Re: [SOLVED] Unable to boot to GRUB on UEFI

Have you tried using a fallback filename?

Offline

#11 2017-08-03 17:51:43

ShinyShinx
Member
Registered: 2017-08-03
Posts: 13

Re: [SOLVED] Unable to boot to GRUB on UEFI

It is really weird that your motherboard isnt detecting the OS.
Like, unnaturally weird. The EasyUEFI software on Windows acts very similar to the efibootmgr in Arch. However, it looks like your motherboard isnt recognizing these entries as it should. I would try using the Manjaro live boot you have to fix this.

It might also be that the ESP isnt flagged as bootable. Thats a simple fix with either cfdisk or Gparted.


Meow :3

Offline

#12 2017-08-03 17:58:42

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

Okay, I made an entry for GRUB with EasyUEFI and ...

MSI_Snap_Shot_03.jpg

It stills there and it works !

So I guess efibootmgr was the problem ?

Thank you all for your time.

loqs wrote:

Have you tried using a fallback filename?

Ah yes, I did not think of trying this.

Last edited by Qwoak (2017-08-03 18:20:35)

Offline

#13 2017-08-03 18:03:23

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

ShinyShinx wrote:

It is really weird that your motherboard isnt detecting the OS.
Like, unnaturally weird. The EasyUEFI software on Windows acts very similar to the efibootmgr in Arch. However, it looks like your motherboard isnt recognizing these entries as it should. I would try using the Manjaro live boot you have to fix this.

It might also be that the ESP isnt flagged as bootable. Thats a simple fix with either cfdisk or Gparted.

ESP have the 'boot' and 'esp' flags already wink

Screenshot_20170803_180150.png

Last edited by Qwoak (2017-08-03 18:06:38)

Offline

#14 2017-08-03 18:26:59

ShinyShinx
Member
Registered: 2017-08-03
Posts: 13

Re: [SOLVED] Unable to boot to GRUB on UEFI

Oh.

Well umm...
Good job xD


Meow :3

Offline

#15 2017-08-03 18:29:28

Qwoak
Member
From: France
Registered: 2017-08-03
Posts: 10

Re: [SOLVED] Unable to boot to GRUB on UEFI

ShinyShinx wrote:

Oh.

Well umm...
Good job xD

Thanks ^_^

Offline

#16 2017-08-05 18:04:31

Blasphemist
Member
From: Colorado
Registered: 2013-01-17
Posts: 160

Re: [SOLVED] Unable to boot to GRUB on UEFI

I have a few recommendations and information that may be helpful. First, I recommend that you start simple and work step by step. At least when I run into issues with scripted boot loader installation and configuration, I go manual, step by step and simple.

The simple choice for the mount point of the ESP is to use /boot not /boot/efi. UEFI can only launch kernels, boot managers or boot loaders (efi executable files *.efi) at boot that are on the ESP. That means that the kernel, boot loader or boot manager to be launched directly must be on the ESP. If you use /boot as the ESP mount point, the kernel is installed to the ESP because that is where the ESP is mounted. This is why you must tell the install script for grub, rEFInd, systemd's bootctl, whatever, where the ESP is mounted. They must put the file that UEFI will launch on the ESP.

The kernel is the only thing that UEFI can launch that is always going to install to /boot no matter what. If you use /boot/efi as the mount point for the ESP and want to mount the kernel directly (EFISTUB) you have to set up a process that will copy the kernel (after install and updates) to the ESP at your mount point, /boot/efi. You may not ever want to use direct boot of the kernel but it is the fastest, simplest and a good thing to be able to do if your boot loader or manager should ever fail for some reason. So keep in mind the complication it could cause you later if you instead use /boot/efi as the mount point.

The simplest boot option is to launch the kernel itself directly (using the built in EFISTUB capability of the arch kernel). If you rely on grub or rEFInd those programs must provide drivers to allow them to access the kernel if it isn't on the ESP.  Systemd's bootctl doesn't have these drivers for access to other partitions so you really should use the /boot mount point for the ESP. When you use /boot/efi as the ESP mount point, the kernel is installed to and updated on the root partition because that is where /boot is in that configuration. If the ESP is mounted to a subdirectory of /boot, the kernel is not on the same partition as the program that UEFI launches.

Enough about the mount point but I wanted to be clear to everyone, not just the experienced. When you install a boot loader or boot manager the first step is to install the program package. Using the kernel's EFISTUB capability or using bootctl doesn't require this step. Bootctl is installed automatically with systemd. The next step for grub or rEFInd is to install the needed parts to the ESP. For that step you just have to be sure to reference the right mount point for the ESP and not type anything wrong. All that's left at that point is to configure boot.

They main thing to do now is to create the entry in the UEFI boot variables. We use efibootmgr to do this and so do the scripts used by grub and other boot loaders or managers. The efibootmgr man page is pretty clear and provides examples of it's use. For me to create an entry to launch my kernel directly I just tell efibootmgr to create a new entry (-c), it defaults to /dev/sda and partition 1 so you only use those options if you need something different (-d and -p), the loader file name (-l), the boot entry label name (-L) and the kernel paramters (-u). These same things get provided and used when you use grub, etc. but you aren't always aware that you are being asked for them.

If and when you have trouble with a boot loader, KISS. Do what you manually instead of blindly through scripts that hide the details from you. I've had the exact problem you had to begin this post. I'd think everything was right and in UEFI and reboot, magically it's gone. On the same machine with the same UEFI that never happens now that I do things myself instead of using the scripts. I usually have all of the boot loaders and managers installed and I use efibootmgr to switch between them when I want to test something to learn or to troubleshoot for others.

Last edited by Blasphemist (2017-08-06 01:19:45)


Simple and Open

Offline

#17 2017-12-04 20:59:31

j_heimbach
Member
Registered: 2017-12-04
Posts: 1

Re: [SOLVED] Unable to boot to GRUB on UEFI

If anyone comes across this post and is searching for an answer in the arch universe:

This will help you:
https://wiki.archlinux.org/index.php/GRUB#EFI_path

Offline

#18 2017-12-08 21:26:41

Walton
Member
Registered: 2014-01-09
Posts: 23

Re: [SOLVED] Unable to boot to GRUB on UEFI

As an addition to j_heimbach's comment, I was able to avoid this problem all together by mounting the EFI system to `/boot` instead of `/boot/efi`

Offline

#19 2018-09-21 09:25:47

yting
Member
Registered: 2018-09-21
Posts: 1

Re: [SOLVED] Unable to boot to GRUB on UEFI

Hi, Recently I faced this problem myself, and I figure out what's the point, is just set the bootable flag to the boot partition.
You can simple set this use parted use 'set 1 boot on'
Then may be you need do 'grub-install' and 'grub-mkconfig' again, i am not sure about this, may be its unnecessary smile

Offline

#20 2018-09-21 19:23:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Unable to boot to GRUB on UEFI

Please read the Code of Conduct and don't necrobump, particularly solved threads: https://wiki.archlinux.org/index.php/Co … bumping.22



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB