Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Booting from m2 ssd in uefi mode
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Fri Jul 27, 2018 2:28 pm    Post subject: [SOLVED] Booting from m2 ssd in uefi mode Reply with quote

My laptop recently broke, and now I'm trying to re-install gentoo on my new pc. However I ran into a little problem, I'm trying to boot from a samsung 970 pro ssd which is connected to a MSI z370-a pro motherboard.
I installed grub2 using:
Code:

grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg

and it completed without error. However upon reboot it refuses to load grub, it says I don't have any bootable media (that is if I remove the install CD).
I've got the first partion as an efi system partiton:
Code:

/dev/nvme0n1p1      2048     204799    202752    99M EFI System

I have set up this partition in fstab to be mounted at /boot and it contains the following files:
Code:

(chroot) livecd /boot # ls
config-4.17.10-gentoo  System.map-4.17.10-gentoo
EFI                    vmlinuz-4.17.10-gentoo
grub

Code:

(chroot) livecd /boot # ls EFI
gentoo
(chroot) livecd /boot # ls EFI/gentoo
grubx64.efi


When I look in the bios, I see an option to boot ssd/hdd in non-uefi and uefi mode. But only the non-uefi option contains the name of the ssd in brackets behind it. (at the moment this is the only hdd/sdd connected to the system)

Also, on my old laptop I had the eif partion mounted at /boot/efi, but the wiki page shows the efi partion on /boot so I just did it that way, could this be the problem here?

Is it not possible to boot a m2 ssd in uefi mode, or did I mess up again?
_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400


Last edited by AndrewAmmerlaan on Tue Jul 31, 2018 6:55 am; edited 1 time in total
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Fri Jul 27, 2018 2:30 pm    Post subject: Reply with quote

Efi partition and boot partition are 2 distinct things. therefor you should mount /dev/nvme0n1p2 on /boot and /dev/nvme0n1p1 on /boot/efi. and redo everything else.
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Fri Jul 27, 2018 3:07 pm    Post subject: Reply with quote

I know their not the same thing, usually I don't even use a boot partition. I did it this way cause it was on the wiki.

Anyway, I remounted the partition to /boot/efi, moved the kernel files and the grub directory on folder up. Reinstalled and reconfigured grub. Now it looks like this:
Code:

(chroot) livecd / # mount /dev/nvme0n1p1 /boot/efi
(chroot) livecd / # ls /boot
config-4.17.10-gentoo  System.map-4.17.10-gentoo efi vmlinuz-4.17.10-gentoo grub
(chroot) livecd / # ls /boot/efi
EFI
(chroot) livecd / # ls /boot/efi/EFI
gentoo
(chroot) livecd / # ls /boot/efi/EFI/gentoo
grubx64.efi
(chroot) livecd / #

But it still won't start grub, I suspect the problem is in the bios where the name of the ssd does not show up in the UEFI: HDD/SSD boot option (as if it weren't connected). Whereas legacy HDD/SDD option shows the vendor/size etc of the sdd.

Also, here's my full partition layout:
Code:

(parted) print
Model: Unknown (unknown)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size    File system     Name                  Flags
 1      1049kB  105MB  104MB   fat32           EFI System Partition  boot, esp
 2      105MB   495GB  495GB   ext4            Gentoo
 3      495GB   512GB  16.8GB  linux-swap(v1)  Swap


_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400


Last edited by AndrewAmmerlaan on Fri Jul 27, 2018 3:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Fri Jul 27, 2018 3:09 pm    Post subject: Reply with quote

grub-install --target=x86_64-efi --efi-directory=/boot/efi

what output did you get from this?

how about from this

grub-mkconfig -o /boot/grub/grub.conf ?
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Fri Jul 27, 2018 3:12 pm    Post subject: Reply with quote

I did that, that's what I meant when I said that I reinstalled and reconfigured grub.

Code:
(chroot) livecd / # grub-install --target=x86_64-efi --efi-directory=/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
(chroot) livecd / # grub-mkconfig -o /boot/grub/grub.conf
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.17.10-gentoo
done

_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7092
Location: Saint Amant, Acadiana

PostPosted: Fri Jul 27, 2018 3:14 pm    Post subject: Reply with quote

I'm not sure what grub-mkconfig does, for me it is no use in Gentoo (works great for Ubuntu's). Anyhow, you could use efibootmgr to activate your EFI Grub.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Fri Jul 27, 2018 3:14 pm    Post subject: Reply with quote

AndrewAmmerlaan wrote:
I did that, that's what I meant when I said that I reinstalled and reconfigured grub.

Code:
(chroot) livecd / # grub-install --target=x86_64-efi --efi-directory=/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
(chroot) livecd / # grub-mkconfig -o /boot/grub/grub.conf
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.17.10-gentoo
done


is partition nvme0n1p1 type ef00?

EDIT: looks to me you used parted to create the partition. while it is a fat filesystem it should be marked in the gpt partition table as efi which is type ef00. I don't think parted can do that. you should use gdisk. just gdisk /dev/nvme0n1, press t once, partition 1, type ef00, w for write and it's done. gdisk is in package gptfdisk. I am 99% sure this is it.


Last edited by axl on Fri Jul 27, 2018 3:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Fri Jul 27, 2018 3:18 pm    Post subject: Reply with quote

IF everything is set perfectly grub-install /dev/nvme0n1 should work without extra parameters. if it doesn't, maybe it will show us some extra error that we might be missing. so i suggest you try that as well.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Fri Jul 27, 2018 3:46 pm    Post subject: Reply with quote

what install media are you using?
please run
Code:
emerge wgetpaste
wgetpaste -t /boot/grub/grub.cfg
efibootmgr -v | wgetpaste -t
mount | wgetpaste -t
from the chroot and post the urls returned
_________________
Defund the FCC.
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Fri Jul 27, 2018 4:08 pm    Post subject: Reply with quote

axl wrote:
IF everything is set perfectly grub-install /dev/nvme0n1 should work without extra parameters. if it doesn't, maybe it will show us some extra error that we might be missing. so i suggest you try that as well.

This gives me the exact same output as with the parameters.


DONAHUE wrote:
what install media are you using?
please run
Code:
emerge wgetpaste
wgetpaste -t /boot/grub/grub.cfg
efibootmgr -v | wgetpaste -t
mount | wgetpaste -t
from the chroot and post the urls returned

I'm using the live-dvd, because I read somewhere the minimal cd does not support UEFI

grub.cfg: https://paste.pound-python.org/show/fnBmiCN7JjBDmilVCKdm/
efibootmgr: https://paste.pound-python.org/show/OvprDIr1356CVMngQroy/
mount: https://paste.pound-python.org/show/NVHCaiE3JoPn2HDl8j4N/


axl wrote:
AndrewAmmerlaan wrote:
I did that, that's what I meant when I said that I reinstalled and reconfigured grub.

Code:
(chroot) livecd / # grub-install --target=x86_64-efi --efi-directory=/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
(chroot) livecd / # grub-mkconfig -o /boot/grub/grub.conf
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.17.10-gentoo
done


is partition nvme0n1p1 type ef00?

EDIT: looks to me you used parted to create the partition. while it is a fat filesystem it should be marked in the gpt partition table as efi which is type ef00. I don't think parted can do that. you should use gdisk. just gdisk /dev/nvme0n1, press t once, partition 1, type ef00, w for write and it's done. gdisk is in package gptfdisk. I am 99% sure this is it.

Now that you mention it, the wiki doesn't use parted either. I thought it wouldn't matter and that all I had to was set the boot,esp flags on it. I'll try again, following the wiki page to the letter, and see what happens.

I'm actually going away for the weekend, I'll be back late on Monday. So I can't actually try this until then, but it will be the first thing I do when I get back.

Thank you for all your replies
_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Sat Jul 28, 2018 1:07 pm    Post subject: Reply with quote

Edit: What boot media you used, are you sure boot was in UEFI mode?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Sat Jul 28, 2018 1:25 pm    Post subject: Reply with quote

@P.Kosunen
the pastebin of mount, https://paste.pound-python.org/show/NVHCaiE3JoPn2HDl8j4N/ , contains "efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)"
_________________
Defund the FCC.
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Sat Jul 28, 2018 1:31 pm    Post subject: Reply with quote

P.Kosunen wrote:
Edit: What boot media you used, are you sure boot was in UEFI mode?

Pretty sure, otherwise grub-install wouldn't have said "Installing for x86_64-efi platform" when I installed it without the target parameter, right?
_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Sat Jul 28, 2018 1:33 pm    Post subject: Reply with quote

AndrewAmmerlaan wrote:
P.Kosunen wrote:
Edit: What boot media you used, are you sure boot was in UEFI mode?

Pretty sure, otherwise grub-install wouldn't have said "Installing for x86_64-efi platform" when I installed it without the target parameter, right?


yes. you are right.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Sat Jul 28, 2018 2:03 pm    Post subject: Reply with quote

Our grub.cfg's are identical except for UUID's, file systems, device names. I use reiserfs and have ESP on nvme0n1p2 and / on nvme1n1p1 explaining any differences. I conclude that grub-mkconfig functioned properly.
The UEFI boot options menu you reported and the efibootmgr output both show that grub-install failed to write a UEFI boot entry for gentoo/grub to the UEFI flash memory on the motherboard. My understanding is that grub invokes efibootmgr to write the boot entry. My entry looks like
Code:
Boot0001* gentoo   HD(2,GPT,cad2219f-3047-4b03-a174-19475754a5cb,0xe1800,0x32000)/File(\EFI\GENTOO\GRUBX64.EFI)
Suggest entering the chroot, mounting /boot/efi, running efibootmgr to create the gentoo/grub boot entry. My guess for the command:
Code:
efibootmgr -c -d /dev/dev/nvme0n1 -p 1 -L "gentoo" -l "\efi\boot\grubx64.efi"
efibootmgr -v to check. UEFI boot options to really check.
N.B. , while running efibootmgr to test my guess, I was surprised to receive a "Could not prepare Boot variable: Read-only file system". I'm pretty sure running mount a few minutes earlier showed efivarsfs as rw, but ... Running
Code:
mount -o remount,rw /sys/firmware/efi/efivars
efibootmgr -c -d /dev/dev/nvme0n1 -p 1 -L "gentoo" -l "\efi\boot\grubx64.efi"
fixed my problem but I was not in a chroot. (Actually used -p 2 to suit my system)
BTW my nvme's are Samsung 960.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7092
Location: Saint Amant, Acadiana

PostPosted: Sat Jul 28, 2018 4:29 pm    Post subject: Reply with quote

efivars is mounted ro by default, it is a protective measure, otherwise a simple mistake or buggy application could brick your computer.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
arnvidr
Guru
Guru


Joined: 19 Aug 2004
Posts: 595
Location: Oslo, Norway

PostPosted: Sat Jul 28, 2018 7:33 pm    Post subject: Reply with quote

It seems like you have an extra level of efi folder from me, and I also used the wiki a while back. Maybe try the grub-install with efi-dir as /boot/efi/EFI
_________________
Noone wrote:
anything
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Sun Jul 29, 2018 10:24 am    Post subject: Reply with quote

AndrewAmmerlaan wrote:
efibootmgr: https://paste.pound-python.org/show/OvprDIr1356CVMngQroy/

Grub install has not done boot entry for Gentoo for some reason.

You could try to boot and chroot with SystemRescueCD, UEFI Grub install has always worked for me with it.

arnvidr wrote:
It seems like you have an extra level of efi folder from me, and I also used the wiki a while back. Maybe try the grub-install with efi-dir as /boot/efi/EFI


Grub-install creates that uppercase EFI dir in EFI boot partition if it does not exist, you should not put it in grub-install options.
Back to top
View user's profile Send private message
jmartos
Tux's lil' helper
Tux's lil' helper


Joined: 23 Mar 2008
Posts: 76

PostPosted: Sun Jul 29, 2018 10:59 am    Post subject: Reply with quote

I recently went through the same issue when I changed motherboards to a new SuperMicro X10DRL-i MB. I had to add the "--removable" option to the grub-install command. This is mentioned in the grub2 handbook as being needed for some motherboards.

Code:

grub-install --target=x86_64-efi --efi-directory=/boot --removable
Back to top
View user's profile Send private message
CooSee
Guru
Guru


Joined: 20 Nov 2004
Posts: 459
Location: Earth

PostPosted: Sun Jul 29, 2018 12:16 pm    Post subject: Reply with quote

only this works for me :

Code:
/dev/nvme0n1p1    510984      964    510020   1% /boot/efi


EFI vfat is mounted on /boot/efi

and i had to rename it to BOOTX64.EFI :

Code:
/boot/efi/EFI/BOOT/BOOTX64.EFI


i hope this helps
_________________
beQuiet! Silent Base 800 Black - MSI C236A - Xeon E3-1245v5 - 32GB RAM Kingston - Sapphire Nitro+ Radeon RX590 8G - Samsung PM961 M.2 128GB - Samsung 840 EVO 120GB - Creative Sound Blaster RX PCIe - Logitech Z623 2.1 - G110 Keyboard - Mouse G400
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Sun Jul 29, 2018 8:47 pm    Post subject: Reply with quote

The plot thickens,
grub-install is working fine, I have confirmed that it creates a gentoo option in efibootmgr:
Code:

livecd / # efibootmgr -v                       
BootCurrent: 0003                                                   
Timeout: 1 seconds                                                   
BootOrder: 0000,0003,0001,0002                                       
Boot0000* gentoo        HD(1,GPT,5928dcce-9b45-44a4-b444-363cdc4c297e,0x800,0x31800)/File(\EFI\gentoo\grubx64.efi)                       
Boot0001  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........S.a.m.s.u.n.g. .S.S.D. .9.7.0. .P.R.O. .5.1.2.G.B...................\.,.@.r.d.=.X..........A...........................%8V.........4..Gd-.;.A..MQ..L.S.4.6.3.N.F.0.K.6.2.0.3.6.4.B........BO                                                     
Boot0002  CD/DVD Drive  BBS(CDROM,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0300)..GO..NO..........H.L.-.D.T.-.S.T. .B.D.D.V.D.R.W. .C.H.1.2.N.S.4.0...................\.,.@.r.d.=.X..........A...........................>..Gd-.;.A..MQ..L.9.K.I.L.V.3.2.I.4.8. .6. . . . . . . . ........BO                                                     
Boot0003* UEFI: HL-DT-ST BDDVDRW CH12NS40       PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,65535,0)/CDROM(1,0x7bc6,0x8800)..BO 

However, upon reboot.... it's gone
Code:

livecd / # efibootmgr -v
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0001,0002
Boot0001  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........S.a.m.s.u.n.g. .S.S.D. .9.7.0. .P.R.O. .5.1.2.G.B...................\.,.@.r.d.=.X..........A...........................%8V.........4..Gd-.;.A..MQ..L.S.4.6.3.N.F.0.K.6.2.0.3.6.4.B........BO
Boot0002  CD/DVD Drive  BBS(CDROM,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0300)..GO..NO..........H.L.-.D.T.-.S.T. .B.D.D.V.D.R.W. .C.H.1.2.N.S.4.0...................\.,.@.r.d.=.X..........A...........................>..Gd-.;.A..MQ..L.9.K.I.L.V.3.2.I.4.8. .6. . . . . . . . ........BO
Boot0003* UEFI: HL-DT-ST BDDVDRW CH12NS40       PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,65535,0)/CDROM(1,0x7bc6,0x8800)..BO

I have also tried to add this entry manually, same thing happens.

It also doesn't seem to matter if the partition was created by parted or gdisk. (A parted partition is still marked as EF00 in gdisk)

The problem seems to be that edits that I make with efibootmgr don't stick. Maybe some "security feature" in the motherboard?
(I have checked that efivarfs is read/write)

Tomorrow I'm gonna try adding the --removable parameter and renaming the grubx64.efi file as suggested above.
_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Sun Jul 29, 2018 8:48 pm    Post subject: Reply with quote

But did you modify type for efi partition to ef00 using gptdisk ?

I've been waiting for an answer on that.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7552
Location: Goose Creek SC

PostPosted: Mon Jul 30, 2018 12:11 am    Post subject: Reply with quote

manufacturer and model of the motherboard?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
AndrewAmmerlaan
Apprentice
Apprentice


Joined: 25 Jun 2014
Posts: 151
Location: Lent

PostPosted: Mon Jul 30, 2018 6:07 am    Post subject: Reply with quote

Code:
grub-install --removable --efi-directory=/boot

That worked :) the removable option actually installs grub in /boot/EFI/BOOT/BOOTX64.EFI instead of in /boot/EFI/gentoo/GRUBX64.EFI and it does not create an additional entry in efibootmgr.

Quote:
But did you modify type for efi partition to ef00 using gptdisk ?

No I did not, I just checked that the partition had EF00 in gdisk

Quote:
manufacturer and model of the motherboard?

MSI Z730-A Pro

Of course I forgot to install nvidea-drivers so I had to go back to the live-dvd anyway :(

Thank you all

I'll see about adding a note on the --removable option on the wiki when I'm done installing all the things.
_________________
OS: Gentoo KDE x86_64 (~amd64, 5.1.15-gentoo)
MB: MSI Z370-A PRO
CPU: Intel Core i7-8700K
GPU: NVIDIA GTX 1060 6GB & Intel UHD Graphics 630
SSD: Samsung 970 Pro 512GB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum