Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 719828 - >=app-emulation/xen-4.12 prevents Linux from finding initramfs
Summary: >=app-emulation/xen-4.12 prevents Linux from finding initramfs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Tomáš Mózes
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-27 17:28 UTC by Jason Cooper
Modified: 2020-04-28 12:18 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Failed kernel boot log (with Xen) (kernel-xen.log,52.07 KB, text/plain)
2020-04-27 17:28 UTC, Jason Cooper
Details
Successful kernel boot (without Xen) (kernel.log,57.64 KB, text/plain)
2020-04-27 17:29 UTC, Jason Cooper
Details
generated grub config file (grub.cfg,32.81 KB, text/plain)
2020-04-27 17:35 UTC, Jason Cooper
Details
Vanilla Linux v5.4.25 config file (config-v5.4.35-001,140.41 KB, text/plain)
2020-04-27 17:37 UTC, Jason Cooper
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Cooper 2020-04-27 17:28:45 UTC
Created attachment 634928 [details]
Failed kernel boot log (with Xen)

All,

While performing a rare server reboot, I've discovered that I can no longer boot with Xen.  Booting without Xen, same grub.cfg, same kernel, same initramfs works fine.  When attempting to boot with Xen, I get:

-------------->8----------------------
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.4.35 #10
Hardware name: Supermicro X9DRi-LN4+/X9DR3-LN4+/X9DRi-LN4+/X9DR3-LN4+, BIOS 3.2 03/04/2015
Call Trace:
 dump_stack+0x64/0x7c
 panic+0xff/0x2c6
 mount_block_root+0x292/0x2b6
 prepare_namespace+0x166/0x19c
 ? rest_init+0x95/0x95
 kernel_init+0x5/0xeb
 ret_from_fork+0x35/0x40
Kernel Offset: disabled
--------------------------------------

I suspect grub is loading the initramfs to a location that is not accessible to the kernel after Xen has taken control.  I've removed 'dom0_mem' from the Xen command line without success.

Thankfully, Grub provides no way for me to a) determine where it loads the initramfs to, nor b) force it to a different address. :-/

I'm sure there's a simple option I'm missing, but I'll be damned if I can find it.  Any insight or suggestions would be appreciated.
Comment 1 Jason Cooper 2020-04-27 17:29:19 UTC
Created attachment 634930 [details]
Successful kernel boot (without Xen)
Comment 2 Jason Cooper 2020-04-27 17:35:13 UTC
Created attachment 634932 [details]
generated grub config file
Comment 3 Jason Cooper 2020-04-27 17:37:25 UTC
Created attachment 634936 [details]
Vanilla Linux v5.4.25 config file
Comment 4 Jason Cooper 2020-04-27 17:49:32 UTC
I should also mention, I was going to downgrade to Xen 4.11 (what I was previously running), but those ebuilds are no longer in portage. :(
Comment 5 Tomáš Mózes 2020-04-27 19:23:47 UTC
echo	'Loading initial ramdisk ...'
	module2	--nounzip   /intel-uc.img /initramfs-genkernel-x86_64-5.4.35

Please try to remove intel-uc.img and regenerate grub.cfg. Only initramfs from genkernel should be there.
Comment 6 Jason Cooper 2020-04-27 19:43:48 UTC
(In reply to Tomáš Mózes from comment #5)
> echo	'Loading initial ramdisk ...'
> 	module2	--nounzip   /intel-uc.img /initramfs-genkernel-x86_64-5.4.35
> 
> Please try to remove intel-uc.img and regenerate grub.cfg. Only initramfs
> from genkernel should be there.

Well, I owe you a bottle of whiskey, sir.  :-)

That was exactly it!  I'm so glad it wasn't a bug, although I would like to know what put that file there. 

Thanks!
Comment 7 Tomáš Mózes 2020-04-28 12:13:55 UTC
Actually, it's not your fault. It happens since Grub started to include intel-uc.img as module. Now you have a running Xen, but you don't have the microcode applied.

Here's the workaround that works for me:
1) have this in your /etc/default/grub
GRUB_CMDLINE_XEN="... ucode=scan"
GRUB_EARLY_INITRD_LINUX_STOCK=""

2) install sys-firmware/intel-microcode USE=initramfs
3) install genkernel
4) generate an initramfs with genkernel
5) concatenate the microcode with the initramfs from genkernel:

cat intel-uc.img initramfs-${KV}-gentoo${KR}.img > initrd-${KV}-${kernel_type}${KR}
rm -v initramfs-${KV}-gentoo${KR}.img

6) in /boot you'll have something like:
config-5.4.35-gentoo
initrd-5.4.35-gentoo
kernel-5.4.35-gentoo

7) regen grub.cfg, now your xen grub entry looks like:
multiboot2      /xen.gz placeholder ... ucode=scan ${xen_rm_opts}
echo    'Loading Linux 5.4.35-gentoo ...'
module2 /kernel-5.4.35-gentoo placeholder ro 
echo    'Loading initial ramdisk ...'
module2 --nounzip   /initrd-5.4.35-gentoo

Thanks to GRUB_EARLY_INITRD_LINUX_STOCK="" intel-uc.img is not included in the initrd line, but we have everything packed together. You have your microcode applied and the help of initrams too.