Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't get grub2 with efi installed
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
vlynd
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jan 2012
Posts: 123

PostPosted: Thu May 19, 2016 5:11 pm    Post subject: Can't get grub2 with efi installed Reply with quote

I got a working Gentoo Installation (on /dev/sdc2) but can't boot it via grub2:

Currently I'm in a Ubuntu Live CD and chrooted in my Gentoo installation and run grub2-install. But when I reboot the computer there's no UEFI boot entry in the bios start menu.

Here is some data:

Code:

ubuntu ~ (chroot)# fdisk -l /dev/sda /dev/sdb /dev/sdc

Disk /dev/sda: 2,3 TiB, 2500495958016 bytes, 4883781168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: E6D6031D-5D54-4BFE-866F-000F05E9DF78

Device         Start        End    Sectors  Size Type
/dev/sda3  105064448 4883777535 4778713088  2,2T Linux filesystem

Disk /dev/sdb: 931,5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4F611707-434D-4E4C-A564-EACA22E15527

Device       Start        End    Sectors  Size Type
/dev/sdb1     2048     616447     614400  300M Windows recovery environment
/dev/sdb2   616448     821247     204800  100M EFI System
/dev/sdb3   821248    1083391     262144  128M Microsoft reserved
/dev/sdb4  1083392 1953523711 1952440320  931G Microsoft basic data

Disk /dev/sdc: 232,9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 37A25E6C-633C-4BEC-A2F4-BDD750A39D34

Device        Start       End   Sectors   Size Type
/dev/sdc1      2048     83967     81920    40M EFI System
/dev/sdc2     83968  82003967  81920000  39,1G Linux filesystem
/dev/sdc3  82003968 488396799 406392832 193,8G Linux filesystem


Code:

ubuntu ~ (chroot)# cat /etc/fstab
# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>
/dev/sdc1               /boot           vfat            defaults,noatime     0 2
/dev/sdc2      /      ext4      noatime,user_xattr      0 1
/dev/sdc3      /home      ext4      noatime,user_xattr      0 1
/dev/sr0      /mnt/cdrom   auto      noauto,ro   0 0


Code:

ubuntu ~ (chroot)# grep GRUB_PLATFORMS /etc/portage/make.conf
GRUB_PLATFORMS="efi-64"


Code:

ubuntu ~ (chroot)# grub2-install --target=x86_64-efi --efi-directory=/boot /dev/sdc
Installing for x86_64-efi platform.
efibootmgr: Could not set variable Boot0000: No such file or directory
efibootmgr: Could not prepare boot variable: No such file or directory
Installation finished. No error reported.
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 309

PostPosted: Thu May 19, 2016 8:58 pm    Post subject: Re: Can't get grub2 with efi installed Reply with quote

If we assume you have /dev/sdc2 mounted at /mnt/gentoo then you should have /dev/sdc1 mounted at /mnt/gentoo/boot/efi (or /boot/efi in the chroot).
Make sure you have efivarfs mounted read/write.
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: Fri May 20, 2016 7:52 am    Post subject: Reply with quote

Okay, I tried that.

Changed the /etc/fstab line to:

Code:
 /dev/sdc1               /boot/efi           vfat            defaults,noatime     0 2


And mounted efivars with:

Code:
# mount -o remount /sys/firmware/efi/efivars -o rw,nosuid,nodev,noexec,noatime


Then ran grub2-install again. But gentoo still doesn't appear in the boot menu :(
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 May 20, 2016 2:01 pm    Post subject: Reply with quote

Boot the install media. mount the gentoo partitions including boot and efi. enter the chroot.
Code:
nano /etc/portage/make.conf
Verify
Quote:
GRUB_PLATFORMS="efi-64"
is present.
run
Code:
grub2-install --target=x86_64-efi
Code:
emerge wgetpaste
Code:
wgetpaste -t /boot/grub/grub.cfg
Does a boot entry exist?
Code:
ls -alR /boot/efi | wgetpaste -t
Post the url's returned by wgetpaste.
BTW and IMHO life is easier and boot is faster if grub is scrapped in favor of efi stub kernel https://wiki.gentoo.org/wiki/EFI_stub_kernel provides a built in boot loader
If you intend to multboot, rEFInd is my favorite boot manager. efibootmgr also gets good reviews.

Quote:
grub2-install --target=x86_64-efi --efi-directory=/boot /dev/sdc
Seems like /boot/efi was your intended efi directory?
_________________
Defund the FCC.
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: Fri May 20, 2016 5:48 pm    Post subject: Reply with quote

Here are my pastes:

https://bpaste.net/show/4c2f49c5c98e

https://bpaste.net/show/a9f747de583d

It seems I cant change the UEFI Setup?

Code:

# efibootmgr -t 3
efibootmgr: Could not set Timeout: No such file or directory
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 May 20, 2016 7:48 pm    Post subject: Reply with quote

Your pastes look good. Some other problem exists.
How did you deal with Secure Boot in UEFI/BIOS?
Did you boot the ubuntu livecd install media in UEFI mode for the install?
Disk /dev/sdb has an Efi Sysytem Partition for Windows. Most (maybe all) current UEFI implementations will not handle more than one ESP.
Assuming Secure Boot is disabled or shimmed and the install was done from uefi media and that Windows is to be retained, I would recommend using https://wiki.gentoo.org/wiki/UEFI_Dual_boot_with_Windows_7/8 (also works with 10). It was written when UEFI was mostly found on laptops with one drive, but it works with multiple disks.
Alternatively, if you have a backup of windows and a windows rescue/install cd/usb: from the chroot with /boot mounted
Code:
umount boot/efi #just in case
mount /dev/sdb2 /boot/efi
mkdir /mnt/efi
cp -a /boot/efi /mnt/efi #safety copy
grub2-install --target=x86_64-efi
os-prober
grub2-mkconfig -o /boot/grub/grub.cfg
efibootmgr # hopefully shows windows and grub in boot list
efibootmgr -c -d /dev/sdb -p 2 -L "Gentoo" -l "/boot/efi/EFI/gentoo/grubx64.efi" #if not
efibootmgr # hopefully now shows windows and grub


exit gracefully and reboot to UEFI/BIOS to set boot order.
_________________
Defund the FCC.
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: Fri May 20, 2016 10:04 pm    Post subject: Reply with quote

That sucks :/

https://bpaste.net/show/7f6ead6b6de5

Secure Boot is turned off and I did boot the uefi version of the live cd
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 May 20, 2016 11:26 pm    Post subject: Reply with quote

does
Code:
mount | grep efivars
while in the chroot look like
Quote:
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
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 309

PostPosted: Sat May 21, 2016 12:19 am    Post subject: Re: Can't get grub2 with efi installed Reply with quote

Your root partition is /dev/sdc2
Your efi partition is /dev/sdc1

During Gentoo installation you should have used
Code:
mount /dev/sdc2 /mnt/gentoo

you should have then done something like
Code:
mkdir -p /mnt/gentoo/boot/efi
mount /dev/sdc1 /mnt/gentoo/boot/efi


You should ensure efivarfs is mounted read/write, so output of
Code:
mount | grep efivarfs
maybe
Code:
efivarfs on /sys/firmware/efi/efivars type efivarfs (ro,nosuid,nodev,noexec,relatime)

would require remount of efivarfs read/write
mount efivarfs /sys/firmware/efi/efivarfs -o remount,rw
so
Code:
mount | grep efivarfs
would be
Code:
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,relatime)


If you chroot into this then you should be able to install grub using
Code:
grub2-install --target=x86_64-efi


Error messages during the grub2-install like could not set Boot... suggest a problem with efivarfs such as mounted read only. Which I think you need to address before moving on.

If you get to the stage where you want to manually add boot options using efibootmgr then that could be done using
Code:
efibootmgr -c -L Gentoo_manually_added_grub -d /dev/sdc -p 1 -l \\EFI\\gentoo\\grubx64.efi


If you are still having problems could you post the output of
Code:
mount
efibootmgr -v
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 May 21, 2016 1:42 am    Post subject: Reply with quote

@ vlynd
So both members of the peanut gallery are fairly well convinced that efivarfs is not mounted in the chroot or is mounted read only instead of read/write.
running
Code:
mount | grep efivarfs
checks efivarfs status.
_________________
Defund the FCC.
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: Sun May 22, 2016 4:48 pm    Post subject: Reply with quote

Hi guys,

thanks for all the help.

I followed DONAHUEs proposal and installed refind from inside windows 8. That worked like a charm and I can now boot gentoo. Surprinsingly, when I choose gentoo from inside refind, I end up in a grub menu where I can boot gentoo. This is not exactly neat but it works. :)
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sun May 22, 2016 5:29 pm    Post subject: Reply with quote

life can be made even neater if you rebuild the gentoo kernel as an efi stub.

I use:
Quote:
Processor type and features --->
[*] EFI runtime service support
[*] EFI stub support
[*] EFI mixed-mode support

[*] Built-in kernel command line
(root=PARTUUID=89bc9633-fbc9-4a90-8a67-e058cb655d95 ro) Built-in kernel command line
[*] Built-in command line overrides boot loader arguments
in menuconfig and use make && make modules_install && make install to build the kernel. This places kernels, configs, and system maps in /boot converting any existing with the version number to .old. The kernels are named vmlinuz-<version> which refind will find and list in the boot menu. The vmlinuz-<version>.old will also be found and listed providing a convenient recovery option from a botched kernel. Grub can be unmerged as the built in cmdline replaces its only useful function.

You can use /dev/sdc2 instead of PARTUUID in the cmdline.
_________________
Defund the FCC.
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