Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub with NVME and UEFI
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
stunirvana21
n00b
n00b


Joined: 24 May 2011
Posts: 41

PostPosted: Sun Sep 18, 2016 2:52 am    Post subject: Grub with NVME and UEFI Reply with quote

I see that I am not the only one having issues installing Gentoo on a NVME and with a motherboard that supports UEFI. What is the correct procedure? I see a couple recent posts related to my question (here and here) but I want to clarify a few things:

1. Is it required to make the first small 2MB partition as the handbook suggests? If so, does it need to be formatted in some way?
2. Does /boot need to be formatted FAT and if so does it need to be FAT16?
3. What version of grub is required?


I currently have a small 2MB partition and /boot formatted FAT (I think FAT32 ; whatever the default for mkfs.vfat is). The small partition has the bios_grub flag set and /boot has the boot flag set. I have grub 2.0.2~beta3 installed. I get some errors when I try to install grub using this command: grub-install --target=x86_64-efi --efi-directory=/boot --debug

here is the output from the above command. Besides anything answered in my above questions, does anyone have any suggestions? If you need more information, please let me know.

Thanks!
Back to top
View user's profile Send private message
324874
Apprentice
Apprentice


Joined: 26 Jul 2014
Posts: 168

PostPosted: Sun Sep 18, 2016 8:23 am    Post subject: Reply with quote

Hello stunirvana21 !

The handbook is a more a guide than a book. A computer doesn't work by thought. You have to know how things work to use a computer. A computer science background is required.
However, you can use a computer with a basic background. The handbook try to explain things but it's not comprehensive. Moreover, some important things could be missed because
that require mastery, time, etc.

So, your questions could be (not necessary better than yours, cf note):
  1. What is the bios boot partition? Why do I need a bios boot partition?
  2. The EFI system partition also needs to be a FAT32 partition (handbook). So, how do I format a partition with a FAT 32 file system?
  3. What is grub? Is there a new version of grub needed? Why a new version of grub is needed? (The answer is in the threads you've read.)

Try to solve the above. You may meet others challenges. You may ask for help again !

note : Find questions that help to move.

Best regards, feng.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sun Sep 18, 2016 9:52 am    Post subject: Reply with quote

@2

I backuped yesterday my hole box to a new SSD 128GB on an external drive. Fresh out of the packaging. Than I swapped that drive in my notebook and made it active.

You need for uefi for partition 2, assume its the first harddisc and you followed loosely the gentoo handbook partition layout, where partition 2 is the boot partition with fat32 and 128MB size.

Code:
mkfs.vfat ....


I doubt fat16 exists these days, was in the MSDOS days. Fat32 = vfat as far as I know

https://wiki.gentoo.org/wiki/Handbook:X86/Installation/Disks

Quote:
vfat mkfs.vfat Yes sys-fs/dosfstools


Quote:
For instance, to have the boot partition (/dev/sda2) in ext2 and the root partition (/dev/sda4) in ext4 as used in the example partition structure, the following commands would be used:
root #mkfs.ext2 /dev/sda2


-- off topic: Any usb stick since widnows 2000 day was formated with fat32 / aka vfat or ntfs. also any sdcard and such
fat 16 does not really exists anymore in my point of view

---

I do not own such nvme stuff

=> https://forums.gentoo.org/viewtopic-t-1046366-highlight-nvm.html

Quote:
My efiboormgr command:
Code:
efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "Gentoo" --loader "\efi\boot\bootx64.efi"


--

Quote:
1. Is it required to make the first small 2MB partition as the handbook suggests? If so, does it need to be formatted in some way?


I did just made it as suggested by the gentoo handbook yesterday and than used grub2-install with sysrescuecd 4.6.0 (warning its not the latest one), with a different command line invocation on uefi box without nvme.

I just created that partition but did not made any file-system on it. just mkpart 1 3 afaik waht i remember from yesterday
Back to top
View user's profile Send private message
stunirvana21
n00b
n00b


Joined: 24 May 2011
Posts: 41

PostPosted: Sun Sep 18, 2016 1:02 pm    Post subject: Reply with quote

Roman_Gruber wrote:

=> https://forums.gentoo.org/viewtopic-t-1046366-highlight-nvm.html

Quote:
My efiboormgr command:
Code:
efibootmgr --create --disk /dev/nvme0n1 --part 1 --label "Gentoo" --loader "\efi\boot\bootx64.efi"




I get an error when I run that command which is the same I was getting with grub-install:

Code:
efibootmanager: EFI variables are not supported on this system.


I think that is because I can't load the efivars module. Here is my attempt in a chroot:

Code:

# uname -a
Linux livecd 4.4.6-gentoo #1 SMP Thu Sep 15 06:51:35 UTC 2016 x86_64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz GenuineIntel GNU/Linux

# modinfo efivars
filename:       /lib/modules/4.4.6-gentoo/kernel/drivers/firmware/efi/efivars.ko
alias:          platform:efivars
version:        0.08
license:        GPL
description:    sysfs interface to EFI Variables
author:         Matt Domsch <Matt_Domsch@Dell.com>
srcversion:     F41244608A5EE50C2E5BE67
depends:       
intree:         Y
vermagic:       4.4.6-gentoo SMP mod_unload modversions

# modprobe efivars -v
insmod /lib/modules/4.4.6-gentoo/kernel/drivers/firmware/efi/efivars.ko
modprobe: ERROR: could not insert 'efivars': Exec format error


The Gentoo live CD (9/15) I am using doesn't have efivars and if I try to insmod the module from outside a chroot I get the following which is the same error if I insmod from inside the chroot.

Code:

# insmod lib/modules/4.4.6-gentoo/kernel/drivers/firmware/efi/efivars.ko
insmod: ERROR: could not insert module lib/modules/4.4.6-gentoo/kernel/drivers/firmware/efi/efivars.ko: Invalid module format


I could try a rescuecd like Roman_Gruber used assuming it has the efivars module. However I feel like I should be able to use the Gentoo live CD. Am I missing something? Am I incorrect in thinking I need the efivars module?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sun Sep 18, 2016 2:12 pm    Post subject: Reply with quote

Yuo need to find a way to boot your box.

There are different ways and approaches to boot an OS.

When you have for example a second disc installed you could install the bootloader on the second disc and boot from there your system ...

The only thing that comes in my mind is that you use very new hardware with dated, we call it stable, kernels.

When you own the latest of the latest avaiable in hardware you should and I recommend that you use the latest availabe kernel from kernel.org, which just means unmasking gentoo-sources, so you use the latest gentoo-sources 4.7.3 or 4.7.4, whichever is as of now in the tree.


You may check how other distros or users boot their linux from nvme.

Warning this reflects my opinion and not gentoo policy ...

You may reuse / abuse a binary distro when it installs and boots from your hardware flawless. I always hacked my gentoo into a binary distro bootloader just ouf of lazyness and convinience. Having a working binary distro installed in a 10GB partition to keep on installing gentoo while looking up the handbook on the fly or information on the net comes handy
Back to top
View user's profile Send private message
stunirvana21
n00b
n00b


Joined: 24 May 2011
Posts: 41

PostPosted: Sun Sep 18, 2016 3:36 pm    Post subject: Reply with quote

Roman_Gruber wrote:

The only thing that comes in my mind is that you use very new hardware with dated, we call it stable, kernels.

When you own the latest of the latest avaiable in hardware you should and I recommend that you use the latest availabe kernel from kernel.org, which just means unmasking gentoo-sources, so you use the latest gentoo-sources 4.7.3 or 4.7.4, whichever is as of now in the tree.


My hardware is newish but has been out for awhile now. I have a z170 chipset with a skylake processor and an NVMe drive. I could upgrade the kernel but then I still won't be able to load efivars. I was planning on upgrading gcc (for the -march=skylake-avx512 support) and the kernel to newer versions once I got the base system settled which is what I've done in the past.

Quote:

You may reuse / abuse a binary distro when it installs and boots from your hardware flawless. I always hacked my gentoo into a binary distro bootloader just ouf of lazyness and convinience.


What distribution have you used to do this? I probably will just have to do this...
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sun Sep 18, 2016 4:20 pm    Post subject: Reply with quote

Better references: https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide
https://wiki.gentoo.org/wiki/GRUB2
https://wiki.gentoo.org/wiki/GRUB2_Quick_Start
You asked
Quote:
1. Is it required to make the first small 2MB partition as the handbook suggests? If so, does it need to be formatted in some way?
2. Does /boot need to be formatted FAT and if so does it need to be FAT16?
3. What version of grub is required?
1. The first small 2MB partition is needed if the intended boot disk is GPT labeled and UEFI is not to be used. The 2MB should not be formatted; if it is, grub-install will destroy the formatting and install grub2 binary files in the space.
If the intended boot disk is GPT labeled and UEFI is to be used and the computer does not have an existing ESP (EFI System Partition); an ESP should be created and formatted as FAT32. 100MB is will be enough for you, some older UEFI implementations apparently required 512MiB.
2. If there is a separate ESP:
a) A separate boot partition may be formatted with any valid linux file system.
b) An integrated (on the root partition) /boot directory may and will be formatted with any valid linux file system.
c) Before executing the grub-install command the ESP must be mounted.
If there is not a separate ESP and /boot/efi is to be used to contain the EFI files, the boot partition must be formatted FAT32.
FAT16 is non standard.
3. The version of grub you used appears to be adequate. Appeared the kernel was not configured to support efivars.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
stunirvana21
n00b
n00b


Joined: 24 May 2011
Posts: 41

PostPosted: Sun Sep 18, 2016 4:52 pm    Post subject: Reply with quote

DONAHUE wrote:
Better references: https://wiki.gentoo.org/wiki/Sakaki%27s_EFI_Install_Guide
https://wiki.gentoo.org/wiki/GRUB2
https://wiki.gentoo.org/wiki/GRUB2_Quick_Start
You asked
Quote:
1. Is it required to make the first small 2MB partition as the handbook suggests? If so, does it need to be formatted in some way?
2. Does /boot need to be formatted FAT and if so does it need to be FAT16?
3. What version of grub is required?
1. The first small 2MB partition is needed if the intended boot disk is GPT labeled and UEFI is not to be used. The 2MB should not be formatted; if it is, grub-install will destroy the formatting and install grub2 binary files in the space.
If the intended boot disk is GPT labeled and UEFI is to be used and the computer does not have an existing ESP (EFI System Partition); an ESP should be created and formatted as FAT32. 100MB is will be enough for you, some older UEFI implementations apparently required 512MiB.
2. If there is a separate ESP:
a) A separate boot partition may be formatted with any valid linux file system.
b) An integrated (on the root partition) /boot directory may and will be formatted with any valid linux file system.
c) Before executing the grub-install command the ESP must be mounted.
If there is not a separate ESP and /boot/efi is to be used to contain the EFI files, the boot partition must be formatted FAT32.
FAT16 is non standard.
3. The version of grub you used appears to be adequate. Appeared the kernel was not configured to support efivars.


Thanks for the response. That clears up some of my confusion. I am going to try a fresh install and see if I can get it working.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sun Sep 18, 2016 5:35 pm    Post subject: Reply with quote

better to fix than reinstall with gentoo. for best help post the exact command and its result. suggest using efi-stub kernel as your boot loader and dispensing with grub2. If you feel a need for multibooting, suggest rEFInd (as the most elegant boot manager) or efibootmgr .
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Mon Sep 19, 2016 8:39 am    Post subject: Reply with quote

You only need to redo the part with installing the bootloader and configuring hte kernel. Anyting else can be / should be reused.

ITs one of the big milestones to get your kernel booted up with any installation. As this needs some tweaking / research with the first installtion of the hardware
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