Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Boot issues GRUB2/NVMe/GPT/EFI
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
eatingthenight
n00b
n00b


Joined: 28 Apr 2018
Posts: 8

PostPosted: Sat Apr 28, 2018 4:39 pm    Post subject: [Solved] Boot issues GRUB2/NVMe/GPT/EFI Reply with quote

Hey the forums have been real helpful throught the install so far however a few hours of searching haven't turned up anything obvious for fixing this. I am trying to install Gentoo on a new Carbon X1 6th Gen laptop and upon booting up I get an error that it can't fine the needed root drive. I have tried booting without the initramfs which clearly didn't have nvme enabled in it and thus makes sense that it would fail. I removed the initramfs and tried booting both with genkernel and a custom kernel that I ensured is compiled with NVMe enabled in the kernel not as a module. With both kernels it segfauls saying VFS can't mount root fs.

Some System Info:

Drive Format
Code:

root@sysresccd /root % parted /dev/nvme0n1
GNU Parted 3.2
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                           
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name    Flags
 1      1049kB  3146kB  2097kB               grub    bios_grub
 2      3146kB  137MB   134MB   fat16        boot    boot, esp
 3      137MB   256GB   256GB   ext4         rootfs


My boot directory containing both my custom kernel and genkernal
Code:

sysresccd /boot # ls -lah
total 17M
drwxr-xr-x  4 root root  16K Dec 31  1969 .
drwxr-xr-x 21 root root 4.0K Apr 23 20:00 ..
-rwxr-xr-x  1 root root 145K Apr 28 07:51 config-4.9.76-gentoo-r1
drwxr-xr-x  3 root root 2.0K Apr 27 21:53 EFI
drwxr-xr-x  6 root root 2.0K Apr 28 08:02 grub
-rwxr-xr-x  1 root root 5.2M Apr 27 21:30 kernel-genkernel-x86_64-4.9.76-gentoo-r1
-rwxr-xr-x  1 root root 3.1M Apr 28 07:51 System.map-4.9.76-gentoo-r1
-rwxr-xr-x  1 root root 3.1M Apr 27 21:30 System.map-genkernel-x86_64-4.9.76-gentoo-r1
-rwxr-xr-x  1 root root 5.2M Apr 28 07:51 vmlinuz-4.9.76-gentoo-r1


My grub config file
Code:

sysresccd /boot/grub # cat grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  bac30a0a-1bcf-45e5-a9bf-8783d47141f0
else
  search --no-floppy --fs-uuid --set=root bac30a0a-1bcf-45e5-a9bf-8783d47141f0
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
   load_video
   if [ "x$grub_platform" = xefi ]; then
      set gfxpayload=keep
   fi
   insmod gzio
   insmod part_gpt
   insmod fat
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root  B63C-3429
   else
     search --no-floppy --fs-uuid --set=root B63C-3429
   fi
   echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
   linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=/dev/nvme0n1p3 ro 
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
   menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.9.76-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.9.76-gentoo-r1-advanced-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root  B63C-3429
      else
        search --no-floppy --fs-uuid --set=root B63C-3429
      fi
      echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
      linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=/dev/nvme0n1p3 ro 
   }
   menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.9.76-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.9.76-gentoo-r1-recovery-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root  B63C-3429
      else
        search --no-floppy --fs-uuid --set=root B63C-3429
      fi
      echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
      linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=/dev/nvme0n1p3 ro single
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1-advanced-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root  B63C-3429
      else
        search --no-floppy --fs-uuid --set=root B63C-3429
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1 ...'
      linux   /vmlinuz-4.9.76-gentoo-r1 root=/dev/nvme0n1p3 ro 
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1-recovery-bac30a0a-1bcf-45e5-a9bf-8783d47141f0' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root  B63C-3429
      else
        search --no-floppy --fs-uuid --set=root B63C-3429
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1 ...'
      linux   /vmlinuz-4.9.76-gentoo-r1 root=/dev/nvme0n1p3 ro single
   }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


Also a random question what is the purpose of the /boot/grub/x86_64-efi folder it looks like it contains a much of modules but I would expect to see an nvme one in it but I do not.

Other random information while I'm thinking of it. When i messed around in the initramfs I tried to manually modprobe nvme and it failed saying it couldn't find the nvme_core.ko file.

Any help much appreciated.


Last edited by eatingthenight on Sun Apr 29, 2018 7:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
eatingthenight
n00b
n00b


Joined: 28 Apr 2018
Posts: 8

PostPosted: Sat Apr 28, 2018 8:01 pm    Post subject: Reply with quote

EFI output if helpful for anything

Code:

root@sysresccd /boot % efibootmgr -v
BootCurrent: 001C
Timeout: 0 seconds
BootOrder: 0001,0000,001C,0018,0019,001A,001B,001D,001E,001F,0024
Boot0000* Windows Boot Manager   HD(2,GPT,4a4b7ff4-4771-4c1d-9751-f2a97be01b0e,0x1800,0x40000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0001* gentoo   HD(2,GPT,4a4b7ff4-4771-4c1d-9751-f2a97be01b0e,0x1800,0x40000)/File(\EFI\gentoo\grubx64.efi)
Boot0010  Setup   FvFile(721c8b66-426c-4e86-8e99-3457c46ab0b9)
Boot0011  Boot Menu   FvFile(126a762d-5758-4fca-8531-201a7f57f850)
Boot0012  Diagnostic Splash Screen   FvFile(a7d8d9a6-6ab0-4aeb-ad9d-163e59a7a380)
Boot0013  Lenovo Diagnostics   FvFile(3f7e615b-0d45-4f80-88dc-26b234958560)
Boot0014  Regulatory Information   FvFile(478c92a0-2622-42b7-a65d-5894169e4d24)
Boot0015  Startup Interrupt Menu   FvFile(f46ee6f4-4785-43a3-923d-7f786c3c8479)
Boot0016  Rescue and Recovery   FvFile(665d3f60-ad3e-4cad-8e26-db46eee9f1b5)
Boot0017  MEBx Hot Key   FvFile(ac6fd56a-3d41-4efd-a1b9-870293811a28)
Boot0018* USB CD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,86701296aa5a7848b66cd49dd3ba6a55)
Boot0019* USB FDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,6ff015a28830b543a8b8641009461e49)
Boot001A* NVMe0   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,001c199932d94c4eae9aa0b6e98eb8a400)
Boot001B* ATA HDD0   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f601)
Boot001C* USB HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,33e821aaaf33bc4789bd419f88c50803)
Boot001D* PCI LAN   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)
Boot001E  Other CD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a35406)
Boot001F  Other HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f606)
Boot0020* USBR BOOT CDROM   PciRoot(0x0)/Pci(0x14,0x0)/USB(11,1)
Boot0021* USBR BOOT Floppy   PciRoot(0x0)/Pci(0x14,0x0)/USB(11,0)
Boot0022* ATA HDD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,91af625956449f41a7b91f4f892ab0f6)
Boot0023* ATAPI CD   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,aea2090adfde214e8b3a5e471856a354)
Boot0024* PCI LAN   VenMsg(bc7838d2-0f82-4d60-8316-c068ee79d25b,78a84aaf2b2afc4ea79cf5cc8f3d3803)

Back to top
View user's profile Send private message
eatingthenight
n00b
n00b


Joined: 28 Apr 2018
Posts: 8

PostPosted: Sat Apr 28, 2018 8:40 pm    Post subject: Reply with quote

I did manage to get it to fine NVME drives on boot and can see them listed however now it isn't loading them now. The genkernel tries to load the proper drive but doens't load the NVME module so I'm missing something I imagine in my custom kernel config.
Back to top
View user's profile Send private message
eatingthenight
n00b
n00b


Joined: 28 Apr 2018
Posts: 8

PostPosted: Sat Apr 28, 2018 9:21 pm    Post subject: Reply with quote

Not to leave anyone hanging if they come across this later but I was able to get this working. Make sure to check in the .config file for your kernel and ENSURE that it says all NVME config is turned on and installed in the kernel not as a module. I turned on CONFIG_NVME_CORE and CONFIG_BLK_DEV_NVME although i'm not sure if both were needed.

This gets you almost all the way to what you want. You need to re-create your initramfs as well. I did this using genkernel --install initramfs which was set to use the kernel in /usr/src/linux which we have just updated to support NVME devices.

I am curious why an initramfs is needed in this case however. The install guide made it sound like having one was optional unless you wanted to do something like RAID or root encryption. It seems like the initramfs is needed for the nvme driver to be loaded however which ... seems strange due to limited knowledge of the boot process internals.

Thanks!
Back to top
View user's profile Send private message
eatingthenight
n00b
n00b


Joined: 28 Apr 2018
Posts: 8

PostPosted: Tue May 08, 2018 1:55 am    Post subject: Reply with quote

So i looked into my issue a bit more today and wanted to post back here for anyone who comes across this. I forgot to build ext4 support which my root file system uses into the kernel. After doing this and rebooting I was able to boot. Note that you can't use UUID if you aren't using a initramfs since this it not yet available so you will need to set root to the block device which should look something like /dev/nvme0n1p3 or /dev/sda.
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