Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
uefi boot kernel upgrade problem. -- Solved.
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
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Mon Aug 31, 2015 1:46 am    Post subject: uefi boot kernel upgrade problem. -- Solved. Reply with quote

Hi,

Just installed Gentoo on a router box. I got it working with UEFI boot via these instructions and some others: https://wiki.gentoo.org/wiki/GRUB2#UEFI_with_GPT

I'm not new to Gentoo, not new to hardened and not at all new to Linux. I'm new to UEFI boot.

I used genkernel because I thought it would save time just to get something working, very wrong there but it's over. It boots using the genkernel I installed during initial gentoo installation.

I installed hardened-sources 4.1.6 kernel and installed a new kernel (not genkernel) pretty much like I've been doing for about 2 decades now.

It still boots into 4.0.8 kernel which was built with genkernel.

This is the first time I've really messed with a pure uefi boot system, and I don't know what I'm missing.

I KNOW I have UEFI boot, because it took me a long time to get there from BIOS boot.
I THINK I have grub as boot loader, but I see no evidence that it's actually involved.
I think I'm missing whatever tells the efi system that there's a new kernel.

Thanks.


Last edited by 1clue on Thu Sep 03, 2015 11:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Wed Sep 02, 2015 2:54 am    Post subject: Reply with quote

I now have a system that only boots from system rescue iso or gentoo iso.

I completely removed efibootmgr and grub. I reformatted the /boot and /boot/efi partitions. I rebuilt the kernel and reinstalled it. I reinstalled grub and efibootmgr per the instructions in the handbook: https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader with help from https://wiki.gentoo.org/wiki/GRUB2#UEFI_with_GPT

Somehow during this my network devices changed from the 'new' way back to eth*, which baffles me but whatever. I wish they would stick to one thing.

My partitions are at https://bpaste.net/show/00dab5a52a7c
My mounts are at https://bpaste.net/show/6881cfca1e01
My /boot looks like this: https://bpaste.net/show/efc01effe39f
efibootmgr -v output is https://bpaste.net/show/2838d102aab6
egrep -v '($|!\s*$)' /etc/portage/make.conf: https://bpaste.net/show/63571c78ca1b

Somebody please help.
Back to top
View user's profile Send private message
schorsch_76
Guru
Guru


Joined: 19 Jun 2012
Posts: 450

PostPosted: Wed Sep 02, 2015 6:18 am    Post subject: Reply with quote

UEFI's boot principle is:

EFI Partition: There are the bootloaders or programms you can start. Basicly you put here grub or the efi kernel. There are Folders like "EFI\Windows" "EFI\gentoo". Each folder contains the bootloader for that system. A *.efi file.

The efi variables are there to let you specify a file from this partiton UEFI should start. BUT: When you name the file EFI/BOOT/bootx64.efi, UEFI will start it even without a UEFI variable. To start my uefi system i dont use the variables, i use the default (fallback) bootx64.efi. In my case i renamed the grubx64.efi to bootx64.efi. The grub.cfg file is at /boot/grub/grub.cfg. on sda2 (ext2).


See:
http://www.rodsbooks.com/refind/
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
http://www.rodsbooks.com/linux-uefi/

EDIT:
Your first Partition should be the EFI partiton EF00.
_________________
// valid again: I forgot about the git access. Now 1.2GB big. Start: 2015-06-25
git daily portage tree
Web: https://github.com/schorsch1976/portage
git clone https://github.com/schorsch1976/portage
Back to top
View user's profile Send private message
hurvajs77
n00b
n00b


Joined: 05 Apr 2010
Posts: 56

PostPosted: Wed Sep 02, 2015 7:22 am    Post subject: Reply with quote

I had similar problem in past - I lost option to boot Windows and still boot with old kernel. So, I found this solution. I wrote small script for compile a new kernel and fix EFI bootmanager

Code:
#!/bin/bash

KERNEL=$(eselect kernel list | grep \* | awk '{ print $2 }' | sed 's/linux-//g')
ESP=/boot

cd /usr/src/linux/

make -j5 && \
        make -j5 modules_install && \
        make install

emerge @module-rebuild

grub2-install --target=x86_64-efi --efi-directory=$ESP --bootloader-id="Gentoo Linux" --boot-directory=$ESP --recheck
grub2-mkconfig -o /boot/grub/grub.cfg


PS3="Please enter your choice: "
select CHOICE_ACTION in "REBOOT" "Nothing"; do
    case $CHOICE_ACTION in
        "REBOOT")
            shutdown -r now
            break
            ;;

        "Nothing")
            break
            ;;

    esac
done

USE flags for Grub:
Code:
sys-boot/grub-2.02_beta2-r7:2::gentoo  USE="fonts multislot nls sdl themes truetype -debug -device-mapper -doc -efiemu -libzfs -mount -static {-test}" GRUB_PLATFORMS="efi-64 multiboot pc -coreboot -efi-32 -emu -ieee1275 -loongson -qemu -qemu-mips -uboot -xen"

If you haven't other OS, so you don't need Grub and booting solve efibootmgr
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Thu Sep 03, 2015 4:44 pm    Post subject: Reply with quote

Other than having an unbootable kernel, I'm good now. I'm looking at a kernel panic right now.

So how do you choose a different kernel during boot? That's the thing that gets me here: I'm going to be building a lot of kernels to get the minimum configuration that works for me, I'd like to not have to use system rescue cd in order to get back into my system. All I get is one choice.

I thought you could use grub in conjunction with an EFI boot system. All I ever get is the one kernel.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Thu Sep 03, 2015 5:08 pm    Post subject: Reply with quote

There is currently nothing but Gentoo on this system. There may be a pfSense distro at some point but I'd prefer that to be on a guest.

My intent is for it to be a kvm host which will handle firewall, routing, vpn and UTM guests. The CPU is an Intel Atom C2758 which has QuickAssist encryption and compression features, so I'm probably going to have to build some proprietary modules for that to take effect, which means even more kernel builds.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Thu Sep 03, 2015 8:07 pm    Post subject: Reply with quote

I have a working kernel again.

I'm still only getting one kernel listed in grub. I'd like to be able to choose installed kernels like before.

And here's another thing: Using your script as a reference ESP is /boot/efi for me. I have /boot as usual, and /boot/efi for efi kernel. Do I actually need /boot or can I essentially delete it and mount /boot/efi onto my / partition? Or can what's currently /boot/efi be /boot?

I'm very confused right now. Your script helps but I still really don't get how a boot loader works in conjunction with efi. My looking at docs doesn't seem to help, it seems like most of the docs assume BIOS boot and make comments about efi here and there.

Code:

# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
└─sda1   8:1    0 465.8G  0 part
sdb      8:16   0 223.6G  0 disk
├─sdb2   8:18   0   512M  0 part /boot
├─sdb3   8:19   0    10G  0 part /
├─sdb4   8:20   0   200G  0 part
└─sdb5   8:21   0   600M  0 part /boot/efi


sda1 and sdb4 are LVM partitions which don't matter right now. My original sdb1 was a 2M partition per the handbook that turned out to be useless so I deleted it to prevent confusing the system.

I'd like to fix this so it's a correctly done efi-boot system with grub2 to choose kernels. I'll happily scrape the whole thing off and start over if I have to, even just to get the partition numbers right.

sdb is an ssd, sda is an older spinner I had laying around to use for bulk storage.

As an aside about network interface naming mentioned earlier:
It turns out that the gentoo kernel I'm building uses enp4s0 and such as net interface names and system rescue cd uses eth4 for the same nic. Irritating. At any rate I have a duplicate config in /etc/conf.d/net for my console interface so I don't have to think about it when it's an emergency, none of the others will be right but at least I'll get into the box. That doesn't really pertain to the support issue, but I mentioned it above and I'm letting you know I figured that one out.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Thu Sep 03, 2015 11:31 pm    Post subject: Reply with quote

schorsch_76 wrote:
UEFI's boot principle is:

EFI Partition: There are the bootloaders or programms you can start. Basicly you put here grub or the efi kernel. There are Folders like "EFI\Windows" "EFI\gentoo". Each folder contains the bootloader for that system. A *.efi file.

The efi variables are there to let you specify a file from this partiton UEFI should start. BUT: When you name the file EFI/BOOT/bootx64.efi, UEFI will start it even without a UEFI variable. To start my uefi system i dont use the variables, i use the default (fallback) bootx64.efi. In my case i renamed the grubx64.efi to bootx64.efi. The grub.cfg file is at /boot/grub/grub.cfg. on sda2 (ext2).


OK so what you're saying is that I need both a /boot and a /boot/efi.

I should be able to take /boot/efi/EFI/gentoo/grubx64.efi and copy/move it to /boot/efi/EFI/BOOT/bootx64.efi and grub will work?

Just tried that, it works. Thanks. I'm where I need to be on this.

Quote:

EDIT:
Your first Partition should be the EFI partiton EF00.


Had the Gentoo Handbook told me to make a larger partition for this I would have done so. It turns out they had a ridiculously small partition and it couldn't be formatted with fat32. The /boot/efi I have is 600m which is probably a bit extreme, but I just kept bumping the size up until I could format the partition to fat32.
Back to top
View user's profile Send private message
Darth Marley
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jan 2007
Posts: 107

PostPosted: Tue Sep 08, 2015 7:46 pm    Post subject: Reply with quote

You can mount the efi partition as /boot. I got away with it before I knew more, and now knowing more have seen articles suggesting just mounting it as boot anyway. The bios will boot correctly as long as everything is in its proper place, and Linux doesn't care if /boot has a /efi directory.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Fri Sep 18, 2015 3:13 am    Post subject: Reply with quote

I need to put my post count back to 1.

I finally got it right. I reformatted sdb1 and deleted sdb5, and after much ado I got my machine booting off of a unified EF00 /dev/sdb1.

It's almost like my first linux install, back in the 90s.

It's never been the same since lilo.

I'm officially an old fart now. Rather than speeding up I'm slowing down.

Thanks for the help again people.
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