Gentoo boot problem

I compiled a new kernel in my Gentoo hard install. I had 5.15.88 and 6.15.3, and I made 7.2.6

cd /usr/src/linux
set the symbolic link
copy the old config file
make olddefconfig
make -j4
make modules_install
make install    .... it needed sys-kernel/installkernel
grub-mkconfig -o /boot/grub/grub.cfg

Then reboot and do update-grub in Debian
Then boot Gentoo
It gets a kernel panic … cannot find root filesystem — none of the 3 kernels will boot

So, I check /etc/fstab in Gentoo … it is OK.
I try a UUID instead of /dev/sda5
and I check grub.cfg in Gentoo … it seems correct.

So, I chroot into Gentoo, make a new initramfs for 7.2.6,
redo grub-mkconfig, exit the chroot, … and it still panics on boot … cant find root filesystem.

I am out of ideas.
Any suggestions welcome.

I find it difficult to imagine what could cause all 3 kernels to fail to boot. I have only modified the new kernel.

This is the first time I have compiled a kernel that way. I have previously used genkernel.

Part of grub.cfg

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $me
nuentry_id_option 'gnulinux-simple-5fa0230a-6757-4281-a209-9f116869d70c' {
	load_video
	if [ "x$grub_platform" = xefi ]; then
		set gfxpayload=keep
	fi
	insmod gzio
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gp
t5 --hint-baremetal=ahci0,gpt5  5fa0230a-6757-4281-a209-9f116869d70c
	else
	  search --no-floppy --fs-uuid --set=root 5fa0230a-6757-4281-a209-9f116869d70c
	fi
	echo	'Loading Linux 7.2.6-gentoo-x86_64 ...'
	linux	/boot/vmlinuz-7.2.6-gentoo-x86_64 root=UUID=5fa0230a-6757-4281-a209-9f11
6869d70c ro  
	echo	'Loading initial ramdisk ...'
	initrd	/boot/amd-uc.img /boot/initramfs-7.2.6-gentoo-x86_64.img
}

Why is it using amd-uc.img ? I have an intel processor.

I have the answer,
that line in grub.cfg

initrd	/boot/amd-uc.img /boot/initramfs-7.2.6-gentoo-x86_64.img

is supposed to concatenate the two cpio files , but there is a bug in grub and it does not… you only get the first cpio file in the grub menu.

The fix… use

initrd /boot/initramfs-7.2.6-gentoo-x86_64.img

it then boots.

Not sure what
/boot/amd-uc.img
is for?

So, building a new kernel had nothing to do with the problem. I did a world update and that brought in a new grub complete with its bug.

You could try adding the Intel microcode to the same place where Grub put AMD microcode. Microcode - Gentoo Wiki Here’s more Intel microcode - Gentoo Wiki

Yes, I have found out I should have the Intel microcode, not amd.
and
I read that one can build the microcode into the initramfs, instead of having it separate … that will avoid the grub issue.

I think this mess is an outcome of my learning curve activities with gentoo. It was coincidental that it came to the surface after a kernel upgrade.

Very few people would ever be affected by this grub bug. Only gentoo handles microcode independently.

The Gentoo manual is ambiguous… do I need to install both linux-firmware and intel- microcode?

You should but the microcode is not mandatory. I use binary kernel which automates kernel updates to Portage.

The AMD microcode is part of the linux-firmware package!! Intel microcode is a separate package. Always use “grub-mkconfig -o /boot/grub/grub.cfg” to update the gentoo grub before running any Debian based update-grub, even better is to enable os-prober in gentoo and let gentoo boot Debian!!

I have never trusted Gentoo enough to do that.

I understand that… when I run update-grub in Debian it looks at the Gentoo grub.cfg to get its info.

The intel microcode is built into firmware so it is already in initramfs.. The amd microcode can be added to initramfs by doing

genkernel --microcode=amd initramfs

then cleanup

mv /boot/amd-uc.img  /boot/amd-uc.img.hide
grub-mkconfig -o /boot/grub/grub.cfg

You actually have to move the amd-uc.img file out of sight or grub will keep picking it up and adding it to the initrd line.

The new kernel boots much slower than the previous one?

I use gentoo-kernel-bin so maybe it differs from your build kernel it that the microcode is in the grub.cfg:

BEGIN /etc/grub.d/10_linux

menuentry ‘Gentoo GNU/Linux’ --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option ‘gnulinux-simple-f59b87ad-7307-4746-95ad-c4b0feac8e32’ {
load_video
if [ “x$grub_platform” = xefi ]; then
set gfxpayload=keep
fi
insmod gzio
insmod part_msdos
insmod ext2
search --no-floppy --fs-uuid --set=root f59b87ad-7307-4746-95ad-c4b0feac8e32
echo	‘Loading Linux 6.18.54-gentoo-dist-bin …’
linux	/boot/vmlinuz-6.18.54-gentoo-dist-bin root=UUID=f59b87ad-7307-4746-95ad-c4b0feac8e32 ro  quiet loglevel=3 pci=noaer pcie_aspm=off acpi_mask_gpe=0x50
echo	‘Loading initial ramdisk …’
initrd	/boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-6.18.54-gentoo-dist-bin.img
}

I have amd-uc.img and intel-uc.img in my /boot. Intel i5 is the processor. When I make the grub-mkconfig it finds them both:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file …
Found theme: /boot/grub/themes/gentoo_glass/theme.txt
Found linux image: /boot/vmlinuz-6.18.54-gentoo-dist-bin
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-6.18.54-gentoo-dist-bin.img
Found linux image: /boot/vmlinuz-6.18.50-gentoo-dist-bin
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-6.18.50-gentoo-dist-bin.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Adding boot menu entry for UEFI Firmware Settings …
done

That line will not work with my grub in Debian. … it sees only the first item so it has no initramfs and panics. … it us supposed to concatenate the 3 images. ( in my case 2).
I dual boot and Debian controls grub.
It has always worked until recently.
Maybe I need to update my Debian.

Maybe you need to make a 40_custom boot entry for your Gentoo in Debian. Do you have grub on Gentoo too? You could try to boot from it and if all works add the Debian entry to that grub and switch the booting to Gentoo. (As Daniel already suggested)