sublogic Apprentice
Joined: 21 Mar 2022 Posts: 274 Location: Pennsylvania, USA
|
Posted: Sun Nov 24, 2024 2:20 am Post subject: My layout confuses grub |
|
|
Summary:
My new-to-me laptop arrived this week. Install time. I followed the amd64 handbook, deviating only to set up encrypted partitons for data protection at rest (best done at install time). Kernel is gentoo-kernel-bin, ugrd for the initramfs, grub for bootloader. The storage is gpt-partitioned like so: Code: |
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 238.5G 0 disk
├─nvme0n1p1 259:1 0 1G 0 part /efi
└─nvme0n1p2 259:2 0 237.5G 0 part
└─cleartxt 253:0 0 237.5G 0 crypt
├─vg0-swap 253:1 0 32G 0 lvm [SWAP]
├─vg0-root 253:2 0 40G 0 lvm /
└─vg0-home 253:3 0 40G 0 lvm /home |
There isn't a separate boot partition, all the booting bits must go under /efi. Apparently when I emerged gentoo-kernel-bin,- emerge ran installkernel,
- installkernel copied the files to the right place, and
- installkernel ran ugrd, which generated a good initramfs, and
- installkernel ran grub-mkconfig, which found the kernel and initramfs, but
- grub-mkconfig created a bad grub.cfg .
Why ? Isn't this a supported layout ? What did I miss ?
============================================================================
Details:
Upon rebooting I got this: Code: | Booting `Gentoo GNU/Linux'
error: no such device: 70611462-a82b-4c7d-abe6-1b5a29b0a24f
Loading Linux 6.6.58-gentoo-dist ...
error: no server is specified
Loading initial ramdisk ...
error: you need to load the kernel first.
Press any key to continue...
Failed to boot both default and fallback entries.
Press any key to continue... | (Typed from a screenshot.)
Duckduckgo to the rescue: press "any key" as told, look around in the grub shell using "ls" and "set root". Code: | grub> ls
(hd0) (hd0,gpt2) (hd0,gpt1)
grub> set root=(hd0,gpt1)
grub> ls /
efi/
grub> ls /efi
gentoo/
grub> ls /efi/gentoo
amd-uc.img vmlinuz-6.6.58-gentoo-dist.efi initramfs-6.6.58-gentoo-dist.img System.map-6.6.58-gentoo-dist |
HAH ! It's obvious now. The /efi/EFI/gentoo/grub/grub.cfg is garbage.
Boot rescue media and replace it by this: Code: | set root=(hd0,gpt1)
menuentry 'Gentoo Linux 6.6.58' {
echo 'loading kernel...'
linux /efi/gentoo/vmlinuz-6.6.58-gentoo-dist.efi
echo 'loading initramfs...'
initrd /efi/gentoo/initramfs-6.6.58-gentoo-dist.img
}
menuentry 'UEFI firmware settings' {
fwsetup
} | And that worked. I'm typing this from the laptop in question. But it's a band-aid. I would like future kernel upgrades to automatially generate a proper grub.cfg like they should.
Here's the bad grub.cfg (wgetpaste) . And emerge --info (wgetpaste)
Deviations and choices from the handbook: Code: | ==> /etc/portage/package.use/installkernel <==
sys-kernel/installkernel grub ugrd
sys-kernel/gentoo-kernel -initramfs
sys-kernel/gentoo-kernel-bin -initramfs
==> /etc/kernel/install.conf <==
# This file is managed by sys-kernel/installkernel
layout=efistub
initrd_generator=ugrd
uki_generator=none |
Files after "emerge sys-kernel/gentoo-kernel-bin": Code: | ls -F /efi/EFI/gentoo
amd-uc.img* initramfs-6.6.58-gentoo-dist.img*
config-6.6.58-gentoo-dist* System.map-6.6.58-gentoo-dist*
grub/ vmlinuz-6.6.58-gentoo-dist.efi*
ls -F /efi/EFI/gentoo/grub
fonts/ grub.cfg* grubenv* locale/ themes/ x86_64-efi/ |
At Bootloader default: grub: Code: | # grub-install --efi-directory=/efi --boot-directory=/efi/EFI/gentoo | That must have worked, because there was a grubx64.efi* in /efi/EFI/gentoo and the UEFI firmware went straight to grub. The only thing messed up was the grub.cfg .
So, what step did I skip that confused grub-mkconfig ?
Or is my setup not directly supported by grub-mkconfig ? |
|