Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't boot grub2 with efi
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 11:17 am    Post subject: Can't boot grub2 with efi Reply with quote

Hi there,

I did a full gentoo install on a new PC. My goal was to boot with EFI and grub2, so I acted according to the handbook.

This is my partition setup:

Code:

Partition Table: gpt

/dev/sda1        2048       6143       4096    2M BIOS boot
/dev/sda2        6144     268287     262144  128M EFI-System
/dev/sda3      268288   63182847   62914560   30G Linux-file system
/dev/sda4    63182848 4778924031 4715741184  2,2T Linux-file system


my fstab:

Code:

/dev/sda2   /boot        vfat    defaults,noatime     0 2
/dev/sda3   /            ext4    noatime              0 1
/dev/sda4   /home        ext4    noatime              0 1


Code:

# grep GRUB_PLATFORMS /etc/portage/make.conf
GRUB_PLATFORMS="efi-64"


I emerged grub2 while /boot/ was mounted. There were no errors while executing
Code:
grub2-install --target=x86_64-efi --efi-directory=/boot
or
Code:
grub2-mkconfig -o /boot/grub/grub.cfg


I also copied the kernel to
Code:
/boot/efi/boot/bootx64.efi


The grub2 menu pops up at boot, but when I select the Gentoo entry, I only get the message "Gentoo-4.5.1 is loading" and then it gets stuck / freezes.

I also set up /etc/default/grub to be more verbose but I don't get any information why it's not booting.

Any thoughts on that? Thanks.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 12:29 pm    Post subject: Reply with quote

I don't think you should have copied the kernel to the boot64x.efi file. that's just a loader. kernels sit in boot as usual.

do grub2-install again and this time leave the efi files alone.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 12:31 pm    Post subject: Reply with quote

Thanks, I will try that.

I did that because of the handbook: https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation#Compiling_and_installing
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 12:39 pm    Post subject: Reply with quote

Well, that seems to boot directly the kernel without the help of grub. which apparently EFI systems do. I still use grub so I left the efi files alone. But if you DO want to use grub, regardless of the fact the the system might be able to boot without it, is up to you.

Are you sure the kernel IS working?

If I were you, I would use grub to make sure the boot loader works and i can pass arguments to kernel. next check if kernel works. So just as before, reinstall grub, and then work on kernel. once you know that works, i guess you could overwrite the efi file with the kernel. Don't know if that solution will allow you to use a initrd file. grub does. So again, up to your situation.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 2:23 pm    Post subject: Reply with quote

Thanks for the answer.

Actually I'd like to boot via grub, not directly via EFI.

The kernel is 100% working (it's from a previous installation).

Now I did the following (without touching /boot/efi/boot/bootx64.ef):
Code:

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


Did a reboot but it still isn't booting, hangs on: "Linux 4.5.1-gentoo will be loaded...."
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 2:32 pm    Post subject: Reply with quote

did grub show up this time or did it boot directly in kernel?

try selecting F12 at boot. see what boot options the efi bios sees.

mine shows something like this. EACH os being each owns dir on EFI partition.

http://dale.ro/~axl/IMG_2443.jpg
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 2:37 pm    Post subject: Reply with quote

also you said you kept the kernel from an old installation. did you add support for efi vars and efi framebuffer (if necessary) ?

check CONFIG_EARLY_PRINTK as well.

Code:
[root@ana:~]# grep EARLY /boot/config
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_GENERIC_EARLY_IOREMAP=y
CONFIG_EARLY_PRINTK=y
# CONFIG_EARLY_PRINTK_DBGP is not set
# CONFIG_EARLY_PRINTK_EFI is not set
Tue Apr 19 - 17:35:58
[root@ana:~]# grep EFI /boot/config
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_EFI_MIXED=y
CONFIG_FB_EFI=y
CONFIG_XEN_EFI=y
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# EFI (Extensible Firmware Interface) Support
CONFIG_EFI_VARS=y
CONFIG_EFI_ESRT=y
CONFIG_EFI_VARS_PSTORE=y
# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set
CONFIG_EFI_RUNTIME_MAP=y
# CONFIG_EFI_FAKE_MEMMAP is not set
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_UEFI_CPER=y
CONFIG_CACHEFILES=y
# CONFIG_CACHEFILES_DEBUG is not set
CONFIG_CACHEFILES_HISTOGRAM=y
CONFIG_EFIVAR_FS=y
# CONFIG_EARLY_PRINTK_EFI is not set
# CONFIG_EFI_PGT_DUMP is not set
Tue Apr 19 - 17:36:15
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 2:50 pm    Post subject: Reply with quote

Grub showed up this time (but it showed up before, too).

I can also edit the menu entry.

This are my boot options: http://i.imgur.com/PNFxk6M.jpg

Booting from WDC (the first boot option) and booting from "gentoo" both brings me to the Grub Menu.

I didn't have CONFIG_EARLY_PRINTK_EFI=y in my kernel config. Currently rebuilding the kernel.

Are there any other variables I should have set?

This is what I have:

Code:

CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
# CONFIG_EFI_MIXED is not set
# CONFIG_FB_EFI is not set
CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# EFI (Extensible Firmware Interface) Support
CONFIG_EFI_VARS=y
CONFIG_EFI_ESRT=y
CONFIG_EFI_VARS_PSTORE=y
# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set
CONFIG_EFI_RUNTIME_MAP=y
# CONFIG_EFI_FAKE_MEMMAP is not set
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_UEFI_CPER=y
CONFIG_CACHEFILES=m
# CONFIG_CACHEFILES_DEBUG is not set
# CONFIG_CACHEFILES_HISTOGRAM is not set
CONFIG_EFIVAR_FS=m
CONFIG_EARLY_PRINTK_EFI=y
# CONFIG_EFI_PGT_DUMP is not set
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 2:56 pm    Post subject: Reply with quote

make sure u either change the boot order in bios, or each time manually boot gentoo. only that is uefi mode. the other one i think is standard bios mode.

now it's up to the kernel. and yes, it seems you still missed some options. EFI related at least. i saw efi_mixed missing. also there's a PRINTK option that isn't EFI. i'm guessing both have to be enabled.

http://dale.ro/~axl/config

here's my config if you need it.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 3:25 pm    Post subject: Reply with quote

I activated the missing EFI-variables in the kernel and tried it again ... but failed again.

All my *EFI* variables are now the same as your.

This is my kernel config: https://dpaste.de/gmSC

Now I'm giving your kernel config a try.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 3:28 pm    Post subject: Reply with quote

take a look under processor stuff and scsi/sata stuff. my proc is haswell. dont remember if i included all sata support or none. my system in nvme oriented.

EDIT: also make sure to include in kernel ext4 support. mine only has it as module. i use xfs.


Last edited by axl on Tue Apr 19, 2016 4:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 4:25 pm    Post subject: Reply with quote

I don't know what this is but this appears when I boot your kernel: http://i.imgur.com/pBWegMN.jpg
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 4:27 pm    Post subject: Reply with quote

that is from the fb settings. framebuffer. review settings under drivers -> graphics -> framebuffer.


i dont know what kind of video card u have. mine is nvidia gtx 960 and i use nvidia-drivers for now. you have to set up your own HW.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 4:34 pm    Post subject: Reply with quote

That's odd because I also got a Nvidia: GeForce GTX 560 Ti
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 4:37 pm    Post subject: Reply with quote

did you pass any args to the kernel in relation to vga? like vga=788 or vga=791 or smth?

if yes, use GFXPAYLOADLINUX in grub instead. maybe deselect EFI fb. out of ideas on this one.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 6:33 pm    Post subject: Reply with quote

also i noticed your sda1 partition. bios_boot. that's only for legacy (bios) boot. you only need sda2. the efi partition. look:

[root@ana:~]# gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/nvme0n1: 781422768 sectors, 372.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9EF90B95-7D73-4CF4-9A6A-46D95ABA9DA4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 781422734
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number Start (sector) End (sector) Size Code Name
1 2048 206847 100.0 MiB EF00 efi
2 206848 105064447 50.0 GiB 8300 gentoo
3 105064448 209922047 50.0 GiB AF00 osx
4 209922048 781422734 272.5 GiB 0700 ten

each os you will have, will have a dedicated efi loader on efi partition. and you can switch between then from bios.

i _think_ the bios_legacy is obsolete for efi systems.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 6:48 pm    Post subject: Reply with quote

THanks for your help! Deselecting EFI fb in the kernel helped.

Now I'm able to boot and actually see whats happening.

Now im running in a kernel panic:

Code:
kernel panic-not syncing: VFS: unable to mount root fs on
unknown block(8,3)


Looks like grub2 is trying to boot from the wrong partition (?)
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 6:49 pm    Post subject: Reply with quote

8.3 should be sda3. in your setup that is the right partition. but, i told you to add ext4 support as included (*) not as module. you use ext4 partitions. my kernel was setup for xfs. so just go to filesystems and choose ext4 with Y. and you should be ready :)

EDIT:

if it's not the filesystem support, then it must be SATA support. see in drivers. i selected a lot of those as modules as well since my rig only uses a pcie ssd nvme drive which is completely different from sata/scsi subsystems.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Tue Apr 19, 2016 6:54 pm    Post subject: Reply with quote

Okay ... I marked ext4 as built-in. Also I went to Serial ATA and Parallel ATA drivers (libata) and marked everything as built-in (no modules). That should cover all sata drivers, no?
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Tue Apr 19, 2016 6:55 pm    Post subject: Reply with quote

yeah. that will cover everything. but i do recommend you spend some time cleaning up the bloated support that u dont need. good luck and i hope for good news :D
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Wed Apr 20, 2016 11:59 am    Post subject: Reply with quote

I'm really out of luck with this. Now the gentoo boot entry doenst appear in the efi boot menu. And everytime I'm executing an

Code:
grub2-install --target=x86_64-efi --efi-directory=/boot


my live system (ubuntu 15.10) freezes to death.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Wed Apr 20, 2016 2:43 pm    Post subject: Reply with quote

your system is prolly not booted in efi mode. select from bios EFI usb stick. its different from bios usb stick.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Wed Apr 20, 2016 3:00 pm    Post subject: Reply with quote

I checked that, it's booted in efi mode.

/sys/firmware/efi/ exists and has files in it
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 567
Location: Romania

PostPosted: Wed Apr 20, 2016 3:32 pm    Post subject: Reply with quote

well then, must be the partition layout. i'll repeat how i set up my drive. hope that will help.

Code:
[root@ana:~]# gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/nvme0n1: 781422768 sectors, 372.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9EF90B95-7D73-4CF4-9A6A-46D95ABA9DA4
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 781422734
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   EF00  efi
   2          206848       105064447   50.0 GiB    8300  gentoo
   3       105064448       209922047   50.0 GiB    AF00  osx
   4       209922048       781422734   272.5 GiB   0700  ten


as you can see, i do not have that EF02 partition. as already mentioned before that type of partition is only required if you want to boot in legacy mode. since that is not the case, that partition should not exist.

second of all, the efi partition should be mounted on /boot/efi not /boot.

I am pretty sure u're system crashes because of problem 2. and again, you should not specify neither the target, nor the boot directory.

so, if you said you are sure u booted in efi, mount /dev/sda2 (in your case - althou i suggest u delete sda1 or merge cu sda2 and reorder partitions) to /boot/efi. dont forget sys proc and dev with -o bind. and try grub again. it should work. i also used the ubuntu live thingie.
Back to top
View user's profile Send private message
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Wed Apr 20, 2016 5:44 pm    Post subject: Reply with quote

First: Thanks for your patience and support!

Sigh, I did not work out.

This is my new partition table:

Code:

root@ubuntu:/home/ubuntu# gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.0

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 4883781168 sectors, 2.3 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): E6D6031D-5D54-4BFE-866F-000F05E9DF78
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 4883781134
Partitions will be aligned on 2048-sector boundaries
Total free space is 4778718701 sectors (2.2 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   0700
   2          206848       105064447   50.0 GiB    8300


/dev/sda1 was mounted at (/mnt/gentoo)/boot/efi

Chroot was done with:

Code:

mount -o rbind /dev /mnt/gentoo/dev
mount -t proc none /mnt/gentoo/proc
mount -o bind /sys /mnt/gentoo/sys


Config was generated without any arguments

Code:
grub2-mkconfig


Result: Ubuntu live system freezes: mouse and keyboard disabled. Remote control via ssh still works but shutdown/reboot does not work. Not gentoo entry in bios boot menu.
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
Goto page 1, 2  Next
Page 1 of 2

 
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