I've been using Gentoo for over 15 years now and decided to replace one of my machines with a brand new AMD Ryzen machine. But: I can't get it to boot with a custom kernel, whilst the standard genkernel kernel ("genkernel all") boots up just fine.
Here's what I did: I set up gentoo on a new machine with two NVMe storage devices according to the gentoo handbook. My / is an ext4 formatted fs on a LV, whose VG/PV is residing on a raid1. To get things booting up fast, I decided to go with the "allmighty kernel" by doing a genkernel all (which is the gentoo-way of building a very generic kernel like it is used on live-media). I installed grub2 onto an ESP on the first NVMe device (after failing with RAID1 for the ESP).
Reboot, machine comes up. Now I took the kernel config from the genkernel build and menuconfig-ed it. I unticked a whole lot of device drivers and other options, bearing in mind that (from experience) I'd still have to fine-tune the kernel config later.
However, I ended up with a kernel that does not boot at all. When I select the custom built kernel via grub, the machine is stuck at the following:
Booting a command list
Loading Linux 5.4.38-gentoo-x86_64 ...
Loading initial ramdisk ...
It doesn't matter whether i choose the initramfs from the initial "almighty-genkernel-build" or the initramfs built from my custom kernel. As soon as I try to boot my custom kernel, the machine completely locks up after it says "Loading initial ramdisk ...".
What I tried to fix it:
- I completely wiped the ESP and reinstalled the kernels and GRUB2 onto it
- I ran GRUB2 with "set debug=all", but it essentially only told me about loading stuff from the ESPs FAT filesystem
- I checked against https://wiki.gentoo.org/wiki/Ryzen and corrected some config values, with no success
- I did quite some research on the web and fiddled with stuff like random.trust_cpu=on/off
Here's my hardware specs:
- AMD Ryzen 5 3600
- ASUS B450M-A
- 4x8GB Kingston HyperX DDR4-2666
- Kingston KC2000 256GB NVMe PCIe SSD
For me it drills down to these questions:
- Is my assumption correct that there is an issue with my custom built kernel? Why would the system immediately lock up when I try to boot it and leave everything else untouched?
- Which kernel config could be the culprit here? I already invested quite some hours and can't see menuconfig clearly anymore ;)
Thanks for any advice!
UPDATE for more info:
- The kernel sources for the genkernel build and the custom build are exactly the same. Meaning that both were built from the package sys-kernel/gentoo-sources 5.4.38. No un-/install of the sources was done between the builds.
- I got both versions of the kernel and initramfs image on my boot partition. So I could and did test also with exactly the same grub.cfg by interactively editing the kernel file name before boot.