You are not logged in.

#1 2023-02-21 06:28:43

klugja
Member
Registered: 2023-02-20
Posts: 19

[SOLVED]Cannot get UEFI/grub to work with MSI motherboard

I have secure boot turned off in my UEFI setup in the firmware. If I copy Ubuntu's EFI partition to the disk I am trying to set up for ArchLinux, that drive shows up in the UEFI boot list.

I am doing the ArchLinux install from Ubuntu onto another raid following the Linux to ArchLinux install.  I have the GPT EFI partition not set up as a raid for now, since the commands recommended don't seem to like it.

This is what I did:

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
Installing for x86_64-efi platform.
Installation finished. No error reported.

# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  initramfs-linux-fallback.img
Adding boot menu entry for UEFI Firmware Settings ...
done
# efibootmgr -u
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0000,0001,0002,0003,0004,0005
Boot0000* GRUB  HD(1,GPT,9e43bc70-f285-429e-a719-d8935ed0c613,0x800,0x79800)/File(\EFI\GRUB\grubx64.efi)
Boot0001* ubuntu        HD(1,GPT,a021cbc7-81f6-4f6a-8dc3-d44d0fea07d4,0x800,0x79800)/File(\EFI\ubuntu\shimx64.efi) File(.)
Boot0002* ubuntu        HD(1,GPT,2b38e1cf-b5bd-4f8a-81d1-e784353b4dfb,0x800,0x79800)/File(\EFI\ubuntu\shimx64.efi) File(.)
Boot0003* UEFI:CD/DVD Drive     BBS(129,,0x0)
Boot0004* UEFI:Removable Device BBS(130,,0x0)
Boot0005* UEFI:Network Device   BBS(131,,0x0)

It shows up immediately after setting up grub, but is not in the UEFI at boot, and is gone by the time I get to a prompt in Ubuntu.

Here is the after:

efibootmgr -u
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,0002,0003,0004,0005
Boot0001* ubuntu        HD(1,GPT,a021cbc7-81f6-4f6a-8dc3-d44d0fea07d4,0x800,0x79800)/File(\EFI\ubuntu\shimx64.efi) File(.)
Boot0002* ubuntu        HD(1,GPT,2b38e1cf-b5bd-4f8a-81d1-e784353b4dfb,0x800,0x79800)/File(\EFI\ubuntu\shimx64.efi) File(.)
Boot0003* UEFI:CD/DVD Drive     BBS(129,,0x0)
Boot0004* UEFI:Removable Device BBS(130,,0x0)
Boot0005* UEFI:Network Device   BBS(131,,0x0)

Also, how does one create the grub.cfg file under EFI to find the 2nd grub.cfg file in the root file system /boot directory?  That file is missing after setting this up, and I don't see how the /boot/grub/grub.cfg file could ever be found if I did get a boot entry.

Last edited by klugja (2023-02-23 12:22:39)

Offline

#2 2023-02-21 08:51:03

klugja
Member
Registered: 2023-02-20
Posts: 19

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

I see now that in the instructions the kernel, grub and EFI all are in the same file system.  That eliminates my confusion about the missing grub.cfg.

I created a USB thumb drive with the install image, and that boots in UEFI just fine.  I followed the instructions for that image, but it still is not creating a UEFI bootable image.

This is what is in EFI:

find EFI
EFI
EFI/GRUB
EFI/GRUB/grubx64.efi

So grubx64.efi must be incompatible with my mother board?

I just tried copying the Ubuntu EFI to yet another drive, and once again it shows up in UEFI on the new drive.  No installation from efibootmgr was required.

Offline

#3 2023-02-21 09:21:04

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,923

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

You need to add --removable to the grub-install invocation to have the fallback location populated if your UEFI does not have a proper/working NVRAM implementation/you actually intend to move drives in and out of the system. https://wiki.archlinux.org/title/Unifie … ble_drives

Alternatively check your EFI whether it has a custom interface to add entries if efibootmgr generated ones don't stick. You aren't trying to create multiple ESPs on the same disk do you? If that's what you are trying to do the UEFI spec only specifies a single ESP per disk so there might be MBs that confuse this.

Maybe also post

lsblk -f

with the partitions mounted like you think them to be correct so we have an overview.

Last edited by V1del (2023-02-21 09:24:18)

Offline

#4 2023-02-21 14:39:27

klugja
Member
Registered: 2023-02-20
Posts: 19

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

I have a relatively modern MSI board, and I see no interface to add a drive in the UI.  I can change boot order, but when I copy the EFI from Ubuntu's boot drive to the one I am using for Arch, it shows up automatically in the UEFI UI without doing any efi install.  I just copy the EFI directory, and it just shows up. I can change the boot order and get it to boot Ubuntu. There is a UEFI shell, but I am not familiar with UEFI syntax.

All boot partitions are in the first partition of the drive.

I was planning on removing Ubuntu when Arch Linux worked.  I have six hard drives. I have no removable plans, but as far as I can tell, outside of the EFI installed by grub in Arch, everything works, including a USB thumb drive with the Arch installation on it.

The drive/partitions I have tried are both /dev/sda1 and /dev/nvme0n1p1.  I turned the raid off on /dev/sda1 when I tried to do the grub install.

After arch-chroot

[root@tvscribe /]# lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                   7:0    0  55.6M  1 loop  
loop1                   7:1    0 116.7M  1 loop  
loop2                   7:2    0  55.6M  1 loop  
loop3                   7:3    0 240.6M  1 loop  
loop4                   7:4    0  63.3M  1 loop  
loop5                   7:5    0 116.8M  1 loop  
loop6                   7:6    0     4K  1 loop  
loop7                   7:7    0  63.3M  1 loop  
loop8                   7:8    0  22.3M  1 loop  
loop9                   7:9    0 164.8M  1 loop  
loop10                  7:10   0  91.7M  1 loop  
loop11                  7:11   0 346.3M  1 loop  
sda                     8:0    0   3.6T  0 disk  
├─sda1                  8:1    0   243M  0 part  
└─sda2                  8:2    0   3.6T  0 part  
  └─md1                 9:1    0   3.6T  0 raid1 
sdb                     8:16   0   3.6T  0 disk  
├─sdb1                  8:17   0   243M  0 part  
│ └─md125               9:125  0 242.9M  0 raid1 
└─sdb2                  8:18   0   3.6T  0 part  
  └─md1                 9:1    0   3.6T  0 raid1 
sdc                     8:32   0   5.5T  0 disk  
├─sdc1                  8:33   0   243M  0 part  
│ └─md0                 9:0    0 242.9M  0 raid1 
├─sdc2                  8:34   0     3T  0 part  
│ └─md3                 9:3    0     3T  0 raid1 
│   ├─tvscrib2-VAR2   253:5    0    40G  0 lvm   
│   ├─tvscrib2-TMP2   253:6    0    40G  0 lvm   
│   ├─tvscrib2-SWAP2  253:7    0    16G  0 lvm   [SWAP]
│   ├─tvscrib2-HOME2  253:8    0    50G  0 lvm   
│   ├─tvscrib2-ROOT2  253:9    0    80G  0 lvm   
│   └─tvscrib2-BIGR02 253:10   0   5.2T  0 lvm   
└─sdc3                  8:35   0   2.5T  0 part  
  └─md5                 9:5    0   2.5T  0 raid1 
    └─tvscrib2-BIGR02 253:10   0   5.2T  0 lvm   
sdd                     8:48   0   5.5T  0 disk  
├─sdd1                  8:49   0   243M  0 part  
│ └─md0                 9:0    0 242.9M  0 raid1 
├─sdd2                  8:50   0     3T  0 part  
│ └─md3                 9:3    0     3T  0 raid1 
│   ├─tvscrib2-VAR2   253:5    0    40G  0 lvm   
│   ├─tvscrib2-TMP2   253:6    0    40G  0 lvm   
│   ├─tvscrib2-SWAP2  253:7    0    16G  0 lvm   [SWAP]
│   ├─tvscrib2-HOME2  253:8    0    50G  0 lvm   
│   ├─tvscrib2-ROOT2  253:9    0    80G  0 lvm   
│   └─tvscrib2-BIGR02 253:10   0   5.2T  0 lvm   
└─sdd3                  8:51   0   2.5T  0 part  
  └─md5                 9:5    0   2.5T  0 raid1 
    └─tvscrib2-BIGR02 253:10   0   5.2T  0 lvm   
sr0                    11:0    1  1024M  0 rom   
nvme0n1               259:0    0 931.5G  0 disk  
├─nvme0n1p1           259:4    0   243M  0 part  /boot
└─nvme0n1p2           259:5    0 931.3G  0 part  
  └─md126               9:126  0 931.1G  0 raid1 
    ├─ArchLinux-tmp   253:0    0   120G  0 lvm   /tmp
    ├─ArchLinux-root  253:1    0   160G  0 lvm   /
    ├─ArchLinux-var   253:2    0   100G  0 lvm   /var
    ├─ArchLinux-swap  253:3    0    64G  0 lvm   
    └─ArchLinux-home  253:4    0   100G  0 lvm   /home
nvme1n1               259:1    0 931.5G  0 disk  
├─nvme1n1p1           259:2    0   243M  0 part  
└─nvme1n1p2           259:3    0 931.3G  0 part  
  └─md126               9:126  0 931.1G  0 raid1 
    ├─ArchLinux-tmp   253:0    0   120G  0 lvm   /tmp
    ├─ArchLinux-root  253:1    0   160G  0 lvm   /
    ├─ArchLinux-var   253:2    0   100G  0 lvm   /var
    ├─ArchLinux-swap  253:3    0    64G  0 lvm   
    └─ArchLinux-home  253:4    0   100G  0 lvm   /home

Offline

#5 2023-02-22 01:34:53

jonno2002
Member
Registered: 2016-11-21
Posts: 834

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

All boot partitions are in the first partition of the drive.

why do you have multiple boot EFI partitions if you dont plan on removing drives, just have one that boots all your os's.

if the ubuntu efi "just works" like you say then try renaming the arch one to match just to see if that works:
so change:

\EFI\GRUB\grubx64.efi

to

\EFI\GRUB\shimx64.efi

or

\EFI\ubuntu\shimx64.efi

(i had to do a similar thing on a toshiba laptop that would ONLY boot a windows efi file so i just renamed my grub efi entry to match a windows one and it worked)

but really you should just do what videl said and add the removable option to grub

Last edited by jonno2002 (2023-02-22 03:23:50)

Offline

#6 2023-02-22 10:23:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,923

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

MSI are notorious for a broken EFI implementation the fact that ubuntu "seems" to work is somewhat surprising to me, but using the fallback path/the --removable flag will generally work.

Also since you are booting shims on Ubuntu, is secure boot enabled? I'm surprised the Arch install booted at all if that is the case, but not surprised that normally generated entries would not stick if that is the case. Or MSI does a pseudo  secure boot mode and boots fallback entries, but only retains entries signed with the Microsoft key in NVRAM. Which would be dumb, but hey it's MSI.

Last edited by V1del (2023-02-22 10:27:02)

Offline

#7 2023-02-23 05:08:57

klugja
Member
Registered: 2023-02-20
Posts: 19

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

Arch's grub is definitely the issue.   Secure boot is disabled in the UEFI.  I don't think the install disk for Arch would work if secure boot was enabled.

I did "bootctl install" and I now get a systemd-boot UEFI entry on my Arch disk that sticks.

All it does right now is give me the option to boot UEFI. The menu has only one entry, "Boot into Firmware Interface", but at least my foot is in the door.

So I just have to figure out how to get systemd-boot to load a kernel, put in the update hooks in, etc.  So I think grub in Arch has a compatibility issue, since Ubuntu is using grub as well (though in a much more complex fashion).

I don't know if I should mark this solved or not.  It's more of a work-around.

Offline

#8 2023-02-23 09:49:21

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,923

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

It does not have a compatibility issue. As mentioned, run the grub-install command and use --removable in addition to the other flags or manually place the GRUB EFI file to the fallback location: https://wiki.archlinux.org/title/Unifie … ble_drives which is something bootctl willl do by default anyway. This issue is entirely and only on MSI and their broken EFI implementation.

Offline

#9 2023-02-23 12:20:10

klugja
Member
Registered: 2023-02-20
Posts: 19

Re: [SOLVED]Cannot get UEFI/grub to work with MSI motherboard

So this does indeed fix my grub issue:

grub-install --removable --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

Thanks so much.

Offline

Board footer

Powered by FluxBB