Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] UEFI M2 NVME boot hangs loading kernel
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
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Sat Apr 27, 2019 9:39 pm    Post subject: [SOLVED] UEFI M2 NVME boot hangs loading kernel Reply with quote

I have a new UEFI MB with three NVME slots, all filled. I followed the handbook's gpt/UEFI instructions to create four primary partitions on the first NVME, p1, p2, p3, and p4 with p2 the boot partition (formatted fat16) and p4 the root partition. I used p4 and the remaining two NVMEs to create an LVM logical volume to act as root (formatted ext4). I edited /etc/fstab with the UUIDs of p2 (for /boot) and the logical volume (for /).

I installed grub with the command
Code:
grub-install --target=x86_64-efi --efi-directory=/boot --modules="part_gpt lvm ext2"

The install was successful and grub boots normally. However, when it tries to load the kernel, it hangs:
Code:
Loading Linux 4.20.13-gentoo ...
Two lights on my keyboard flash which usually happens when there's some kind of driver malfunction.

I added the --removable flag to the grub-install and got the same behavior. If possible, I'd like to use grub rather than efibootmgr or refind.

Any hints on how to proceed will be gratefully received.

[SOLVED] A root LVM filesystem needs an initramfs to provide the LVM driver to the kernel. genkernel can make that. Also, the kernel needs to have the NVME driver to access an LVM volume composed of NVMEs. Details are in my posts, below. Enormous thanks go to NeddySeagoon for his careful explanation of the boot process, without which I would still have a non-booting brick! [/SOLVED]


Last edited by cfgauss on Mon Apr 29, 2019 9:25 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sat Apr 27, 2019 11:49 pm    Post subject: Reply with quote

cfgauss,


Loading Linux 4.20.13-gentoo ... is from grub, not the kernel. Its the echo statement above the linux line.
Flashing lights on the keyboard indicate a kernel panic. It most have loaded to be able to panic.

How did you configure and make your kernel?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Sun Apr 28, 2019 12:17 am    Post subject: Reply with quote

NeddySeagoon wrote:
How did you configure and make your kernel?

I copied over the root filesystem from my old BIOS box hard drive, circa 2008, and then followed the handbook suggestions on configuring the kernel from within the chroot. Mostly this involved changing Intel options to AMD options, adding EFI, etc.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Sun Apr 28, 2019 3:45 am    Post subject: Reply with quote

I know that some MBs cannot boot from NVMEs. Could that be my problem?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sun Apr 28, 2019 10:40 am    Post subject: Reply with quote

cfgauss,

It appears that it is booting something as that something is flashing the keyboard LEDs.
As a working hypothesis, lets assume that its the kernel because that's what the kernel does when it gets into a state where it can't contiune.

Blank screens are not terribly rare. The next step is to try to get some useful information on the console.

To that end, rebuild you kernel with CONFIG_FB_SIMPLE set.
This will let the kernel take over the framebufer left behind by grub. That may get some diagnostic information on the console.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Sun Apr 28, 2019 11:35 pm    Post subject: Reply with quote

NeddySeagoon wrote:
It appears that it is booting something as that something is flashing the keyboard LEDs. As a working hypothesis, lets assume that its the kernel because that's what the kernel does when it gets into a state where it can't continue.

I agree with the hypothesis. It looks like a kernel panic (although an invisible one) which in my experience is usually caused by grub not finding the root filesystem.
NeddySeagoon wrote:
To that end, rebuild your kernel with CONFIG_FB_SIMPLE set.
This will let the kernel take over the framebufer left behind by grub. That may get some diagnostic information on the console.

I did recompile but nothing appears on the console. It just hangs.

In the good news department, the UEFI did boot my old hard drive so I'm typing from my familiar Gentoo system. Although the old MB was about 2008, the drive is probably only four years old and was gpt. The /boot partition had boot,esp flags but was ext2 rather than fat32 but booted anyway.

When grub booted the new system from the NVME, I hit e to edit the command list:
Code:
setparams 'Gentoo GNU/Linux'
load_video
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
   search --no-floppy --fs-uuid --set=root 53F0-578F
else
   search --no-floppy --fs-uuid --set=root 53F0-578F
fi
echo 'Loading Linux 4.2013-gentoo ...'
linux /vmlinuz-4.20.13-gentoo root=/dev/mapper/rootfs-root ro

Even though I ran grub-install with a parameter to include the lvm module, it wasn't insmod'd here so I added that. No help. 53F0-578F is the UUID of the /boot partition on the first NVME and /dev/mapper/rootfs-root is the LVM volume I created from the three NVMEs.

From within the chroot, here's efibootmgr -v:
Code:
BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0000,0004,0003,0005
Boot0000* gentoo   HD(2,GPT,3e66a41c-c51e-4d57-ac7a-ef192ba42125,0x1800,0x80000)/File(\EFI\gentoo\grubx64.efi)
Boot0003* efibootmgr   HD(2,GPT,3e66a41c-c51e-4d57-ac7a-ef192ba42125,0x1800,0x80000)/File(\EFI\gentoo_2\bootx64.efi)root=/dev/mapper/rootfs-root
Boot0004* UEFI: ASUS    DRW-24B1ST   j   PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x1)/Sata(7,65535,0)/CDROM(1,0x30,0x3270)..BO
Boot0005* grub   VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)

As you can see I tried efibootmgr but that hung as well. 3e66a41c-c51e-4d57-ac7a-ef192ba42125 is the PARTUUID of the /boot partition of the first NVME.

As a curiosity, the three NVMEs are numbered differently when viewed in my old system as compared to the chroot but the UUIDs and PARTUUIDs are correct.

Many thanks for your suggestions. Any more debugging hints you can provide will be gratefully received.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Apr 29, 2019 12:01 am    Post subject: Reply with quote

cfgauss,

grub.cfg:
echo 'Loading Linux 4.2013-gentoo ...'
linux /vmlinuz-4.20.13-gentoo root=/dev/mapper/rootfs-root ro


Root on LVM requires an initrd, as you need user space tools to start LVM.

Whatever the UEFI firmware loads needs to be on a VFAT partition.
If its grub, your kernel and initrd can be on any filesystem that grub can read.
Grub can read LVM without any help too, so it can load the kernel from an LVM filesystem. That does not help the kernel.

When grub has loaded the kernel and optionally, the initrd, it jumps to the kernel entry address.
The kernel is all alone if there is no initrd so must be able to mount root unaided.
For root on LVM you need at least vgchange to make the logical volumes visible. Its not in the kernel, so it has to be in the initrd.

None of this prevents console output though.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Mon Apr 29, 2019 3:05 pm    Post subject: Reply with quote

NeddySeagoon wrote:
...Root on LVM requires an initrd, as you need user space tools to start LVM...

Many thanks. I didn't know this. I've not used an LVM for root before and, hence, have never created an initrd. Here's what I did.

From chroot, I installed genkernel-next and ran genkernel --lvm initramfs. This created initramfs-genkernel-x86_64-4.20.13-gentoo in /boot. I also added GRUB_CMDLINE_LINUX="dolvm" in /etc/default/grub. grub-mkconfig found both the kernel and the initrd. When I boot the system, grub now echos
Code:
Loading Linux 4.20.13-gentoo ...
Loading initial ramdisk ...

before it hangs.

Have I installed a correct initrd? Are there any other changes to /etc/default/grub needed? The initramfs should intervene before init and after the kernel has booted. Does the hang indicate a kernel panic?

Continuing thanks for your suggestions.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Apr 29, 2019 3:19 pm    Post subject: Reply with quote

cfgauss,

That's experience, its what you get just after you needed it :)

Code:
genkernel --lvm initramfs
only builds the initrd with lvm support.
If your kernel config has not changed, that's OK.

Code:
genkernel --lvm all
is safer, as it builds the kernel and initrd as a matching set.

I don't use grub2. Grub legacy has worked untoucheh for 10 years on this system, I don't see any reason to update it.
I'm not sure if
Code:
GRUB_CMDLINE_LINUX="dolvm"
is supposed to be the entire command line, or just stuff to append to it.

Looking in /boot/grub/grub.cfg will tell you.
The lines starting
Code:
linux
load the kernel and pass parameters to it. One essential parameter is the location of the root filesystem.
You should have
Code:
linux <kernel> dolvm root=...


In view of the console issue, its worth trying
Code:
genkernel --lvm all

_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Mon Apr 29, 2019 9:21 pm    Post subject: Reply with quote

NeddySeagoon wrote:

Code:
genkernel --lvm all
is safer, as it builds the kernel and initrd as a matching set.

I did that and included the NVME driver in the kernel and it boots! I suspect that even with LVM help from the initramfs, the kernel needs the NVME driver since the LVM is composed of physical NVMe devices.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Apr 29, 2019 9:34 pm    Post subject: Reply with quote

cfgauss,

Correct. The kernel needs the NVME driver to show the NVME devices to LVM.
You can do LVM on top of anything, its just another abstraction layer. Its that layer that goes in the initrd.

What driver is the system using for the console now?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Mon Apr 29, 2019 9:36 pm    Post subject: Reply with quote

NeddySeagoon wrote:
What driver is the system using for the console now?

I believe it's CONFIG_FB_SIMPLE.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Apr 29, 2019 9:48 pm    Post subject: Reply with quote

cfgauss,

dmesg will tell.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Mon Apr 29, 2019 9:51 pm    Post subject: Reply with quote

NeddySeagoon wrote:
cfgauss,
dmesg will tell.

Code:
dmesg|grep -i console
suggests "colour frame buffer device 240x75"
Back to top
View user's profile Send private message
bammbamm808
Guru
Guru


Joined: 08 Dec 2002
Posts: 487
Location: Hawaii

PostPosted: Tue Apr 30, 2019 1:47 am    Post subject: Reply with quote

NeddySeagoon wrote:
cfgauss,

Correct. The kernel needs the NVME driver to show the NVME devices to LVM.
You can do LVM on top of anything, its just another abstraction layer. Its that layer that goes in the initrd.

What driver is the system using for the console now?


The efifb seems to work rather well and offers nice resolutions. I've used it with a couple of x370/x470 boards and nouveau/nvidia without problems. No simplefb support here.
_________________
Asrock X470 Taichi
Ryzen 2700x
32Gb Samsung B-die (16GB dual rank x2) DDR4
Geforce GTX 1060 6GB
Samsung Evo 840 500Gb +Seagate 1TB HDD
Etc....
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Sun May 05, 2019 3:22 pm    Post subject: Reply with quote

NeddySeagoon wrote:
What driver is the system using for the console now?

I have (today) enabled CONFIG_FB_EFI, CONFIG_FB_SIMPLE, and CONFIG_FB_NVIDIA and this provides a nice 240x75 console framebuffer which doesn't interfere with the binary nVidia driver. dmesg reports the framebuffer is provided by efifb.

I suspect this is more config than needed.
Back to top
View user's profile Send private message
bammbamm808
Guru
Guru


Joined: 08 Dec 2002
Posts: 487
Location: Hawaii

PostPosted: Sun May 05, 2019 3:59 pm    Post subject: Reply with quote

cfgauss wrote:
NeddySeagoon wrote:
What driver is the system using for the console now?

I have (today) enabled CONFIG_FB_EFI, CONFIG_FB_SIMPLE, and CONFIG_FB_NVIDIA and this provides a nice 240x75 console framebuffer which doesn't interfere with the binary nVidia driver. dmesg reports the framebuffer is provided by efifb.

I suspect this is more config than needed.


I am able to run my efifb at 1920 x 1080. If you wanted more lines onscreen you could try higher resolutions.
_________________
Asrock X470 Taichi
Ryzen 2700x
32Gb Samsung B-die (16GB dual rank x2) DDR4
Geforce GTX 1060 6GB
Samsung Evo 840 500Gb +Seagate 1TB HDD
Etc....
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Sun May 05, 2019 5:19 pm    Post subject: Reply with quote

bammbamm808,

CONFIG_FB_NVIDIA should not be used, unless you have some hardware from the last millennium.
It will prevent nvidia-drivers from loading.

That goes for all the CONFIG_FB_<hardware_type> options.
At a pinch, you can use CONFIG_FB_VESA as thats a fairly universal standard in the PC world.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
cfgauss
Guru
Guru


Joined: 18 May 2005
Posts: 550
Location: USA

PostPosted: Mon May 06, 2019 1:42 am    Post subject: Reply with quote

NeddySeagoon wrote:
CONFIG_FB_NVIDIA should not be used, unless you have some hardware from the last millennium.

I have unset CONFIG_FB_NVIDIA and left CONFIG_FB_SIMPLE and CONFIG_FB_EFI set. The resulting kernel produces the same 240x75 console framebuffer as before (courtesy of efifb) and the binary nVidia driver loads X/KDE normally. I suspect that CONFIG_FB_SIMPLE by itself would not work.

My graphics card is GeForce GTX 1050 Ti.
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