# UEFI on MSI laptop ?



## Hakaba (Dec 1, 2019)

I'm trying ro install freebsd (12.0) on my MSI laptop with uefi.
I'm facing a strange issue. I can boot on a UFS usb stick, but after install on ssd (using ZFS), my ssd is not bootable.
I try the installation with and without 4k sectors options and with different partition scheme (bios+uefi/uefi)
How can I know if the issue is due to bsdinstall or UEFI config ?
May I have more chance with freebsd 12.1 on this part ?
Thanks in advance.


----------



## Emrion (Dec 1, 2019)

What's happen when you try to boot on your ssd? Do you see any message?
Also, can you post the result of `gpart show` after the install?


----------



## Hakaba (Dec 1, 2019)

When I boot in UEFI on ssd, the bios menu show up on info panel without information. It is like there is no efi partition on ssd.
gpart show :

```
=>        40  1000215136  nvd0  GPT  (477G)
          40      409600     1  efi  (200M)
      409640        1024     2  freebsd-boot  (512K)
      410664         984        - free -  (492K)
      411648     4194304     3  freebsd-swap  (2.0G)
     4605952   995608576     4  freebsd-zfs  (475G)
  1000214528         648        - free -  (324K)

=>      3  2955503  da0  GPT  (7.2G) [CORRUPT]
        3       29    2  freebsd-boot  (15K)
       32       48       - free -  (24K)
       80     1600    1  efi  (800K)
     1680  2953826       - free -  (1.4G)

=>      3  2955503  iso9660/FURYBSD  GPT  (7.2G) [CORRUPT]
        3       29                2  freebsd-boot  (15K)
       32       48                   - free -  (24K)
       80     1600                1  efi  (800K)
     1680  2953826                   - free -  (1.4G)
```


----------



## Hakaba (Dec 2, 2019)

With freebsd 12.1, same issue.
I have no freebsd-boot partition.
I have tryed furybsd (to copy/paste gpart show below), freebsd 12.0 and freebsd 12.1 and all combinaisons in bios...
The laptop is a MSI p65.


----------



## SirDice (Dec 2, 2019)

Your SSD is probably nvd0 and it does contain both efi and freebsd-boot partitions.


----------



## Hakaba (Dec 2, 2019)

Yes, but after a freeBSD 12.1 installation, the freebsd-boot is not here. This is the only difference between FreeBSD 12 and 12.1
I probably will use my laptop with Legacy mode, but I don't know what mistake I made.


----------



## Sevendogsbsd (Dec 2, 2019)

Last time I installed FreeBSD on my MSI motherboard PC, I did not need a freebsd-boot partition, only an efi partition. I also followed the UEFI instructions from the wiki but I have never used ZFS on my desktop, only UFS so not sure if those instructions would work. UEFI


----------



## SirDice (Dec 2, 2019)

You probably forgot to set the partitioning to GPT/BIOS+EFI.


----------



## Hakaba (Dec 2, 2019)

SirDice said:


> You probably forgot to set the partitioning to GPT/BIOS+EFI.



I try both option (GPT/EFI and GPT/BIOS+EFI)
The second choice works only with the Boot mode "Legacy".
So I am not able to start my computer with UEFI on a nvme ssd with freebsd installed (zfs)

I disabled / enabled security boot, Fast boot, Trusted Computing. I try to change the SATA Mode Selection from AHCI to Intel RS


----------



## Hakaba (Dec 2, 2019)

Sevendogsbsd said:


> Last time I installed FreeBSD on my MSI motherboard PC, I did not need a freebsd-boot partition, only an efi partition. I also followed the UEFI instructions from the wiki but I have never used ZFS on my desktop, only UFS so not sure if those instructions would work. UEFI


I will test it next weekend...
Thanks, I left a comment if it works or not.


----------



## Hakaba (Dec 6, 2019)

Sevendogsbsd said:


> Last time I installed FreeBSD on my MSI motherboard PC, I did not need a freebsd-boot partition, only an efi partition. I also followed the UEFI instructions from the wiki but I have never used ZFS on my desktop, only UFS so not sure if those instructions would work. UEFI


First test : FAT32 : Fail.
Second test FAT16 : Fail.

I continue to test a lot of config ...


----------



## SirDice (Dec 6, 2019)

Hakaba said:


> The second choice works only with the Boot mode "Legacy".


"Legacy" BIOS boot, which is now known as CSM, requires the freebsd-boot partition on GPT. 

CSM booting MBR: uses the master boot record (first sector on the disk) to boot
CSM booting GPT: boots by loading the code from the freebsd-boot partition
UEFI booting: boots by loading and executing /EFI/BOOT/BOOTX64.EFI from the efi partition (which is in fact just FAT12/16/32)

Because UEFI booting is problematic on your system I would recommend using the GPT(BIOS+EFI) combination. This will provide all the required stuff to boot the system in EFI mode _and_ CSM mode. Which means you can switch between the two boot types by simply changing the setting in the BIOS/UEFI. No changes would be needed on FreeBSD.


----------



## Hakaba (Dec 6, 2019)

So, I use the legacy mode to boot my laptop after a GPT(BIOS+EFI) installation.
UEFI doesn't work for a mysterious reason.

But as I can install a Linux in the nvme disk and boot in EFI mode, what part is different ?
The reason is probably a wrong partition type for efi, no ?

Is it useless to try UEFI with secure-boot ? see :





						FreeBSD UEFI Secure Boot | FreeBSD Foundation
					

1. Introduction Secure boot provides a way to ensure that only authorized EFI binaries are loaded by a computer's firmware. This ensures that no malicious code can run before the operating system is loaded. This document describes one method of securing FreeBSD's boot process. FreeBSD's regular...




					www.freebsdfoundation.org
				




It is time to install a WM now 

PS : I let the post unresolved, if I find how boot a MSI laptop in UEFI mode with freeBSD, I will complete here.


----------



## SirDice (Dec 6, 2019)

Hakaba said:


> But as I can install a Linux in the nvme disk and boot in EFI mode, what part is different ?
> The reason is probably a wrong partition type for efi, no ?


No, the partition type is correct. As far as I understood things some manufacturers go the cheap route and use a 32 bit UEFI. Booting a 64 bit FreeBSD with a 32 bit EFI doesn't work. Linux does seem to be able to do this. I have a few machines with UEFI and none of them are able to EFI boot FreeBSD.


----------



## Hakaba (Dec 8, 2019)

On the MSI, I have the choice between :
Legacy / UEFI / UEFI with SCM. Only Legacy work (SCM is a Legacy mode, but failed... Strange, non ?)

And if I try to boot on a 32Gb USB stick, it... fails !
(retry in progress)

Is there a simple way to know if UEFI is 32 or 64 bits ?


----------



## Hakaba (Dec 29, 2019)

I find a solution.
rEFInd is able to boot freebsd...
I let the topic open as the solution is more how to don't use freebsd efi instead of fix the issue.

Added : with rEFInd, I can add the freebsd efi path in boot option with efi shell... I will test this...


----------

