Init (runit) fails when booting with initramfs (solved)
I'm having what seems to me a strange problem at boot. Someone on the reddit sub for Artix was having what I think is probably a similar problem --link-- but there's no solution posted there. I shared my experience there was well, so I apologize for any duplication.
I'm dual booting Artix and Gentoo, with the zen kernel for Artix and a custom compiled kernel for Gentoo. The two share an efi boot partition containing both kernels. I have so far been using efibootmgr directly to create efi boot entries for them, and they were both working for months.
However, Artix suddenly stopped booting with the zen kernel. I get errors roughly like this at boot:
Failed to execute /init (error -2)
Kernel panic - not syncing: No working init found
...
Kernel offset ...
It also said something suggesting adding an init= line to the kernel options. I tried that (I'm using runit as my init system), and instead it would just say /sbin/runit-init or /usr/bin/runit-init failed with the same -2 error and kernel panic.
But here's something weird. At some point months ago just for fun I added an EFI boot entry to load Artix using the kernel compiled for Gentoo. (I was just testing if it was any faster. It wasn't.) That entry still works and boots me into Artix, runit and all.
The difference seems to be that the Gentoo kernel doesn't need a init ramdisk to boot; there's no initrd=... in its kernel options. Somehow this allows it to work, even with the same runit installation failing with the zen kernel.
I've tried some other kernels from Artix: the regular linux package, linux-lts, (also a couple from the AUR). I also tried downgrading to older versions of the zen kernel I had in my pacman cache, which I thought had worked OK to boot (though it has been awhile since I last rebooted and didn't have that big a cache). All yield the same result as the zen kernel. It doesn't seem to be the kernel. It seems rather to be any loading of the kernel that requires an initramfs.
To make sure it wasn't the efibootmgr commands I was using, I also installed grub. When I use that, the boot hangs at "Loading initial ramdisk".
I tried rerunning mkinitcpio with various options. No luck. I also installed dracut to see if the initramfs it creates worked any better than mkinitcpio's, but it doesn't seem to be any different.
The other person on reddit is using openrc rather than runit and had been using grub from the start, but is also hung on loading the ramdisk. Also, since runit works with the Gentoo kernel, I doubt it's runit specific.
But I frankly don't have a clue what's going on.