d2vm icon indicating copy to clipboard operation
d2vm copied to clipboard

CentOS 9 grub cannot find kernel

Open stuart11n opened this issue 1 year ago • 10 comments

Hi,

If I enable --bootloader grub-bios this happens:

image

It's looking in a non-existent path. Any ideas where I could look?

Thanks.

stuart11n avatar Sep 10 '24 13:09 stuart11n

Also if I run without --bootloader grub-bios and boot the VM then install grub manually and reboot I get exactly the same issue. So it seems there is something dragged into the VM from the docker environment? It's very strange.

stuart11n avatar Sep 10 '24 13:09 stuart11n

here is the source:

image

stuart11n avatar Sep 10 '24 13:09 stuart11n

Hello @lttlrck !

I cannot reproduce using the main branch:

d2vm convert quay.io/centos/centos:stream9 --bootloader grub-bios -o centos-stream.qcow2 -v --force
d2vm run qemu --mem 4096 --cpus 4 centos-stream.qcow2
Using existing disk [images/centos-stream.qcow2] format
SeaBIOS (version 1.13.0-1ubuntu1.1)
Machine UUID e9da08a1-8081-4c66-9376-b235f295e37b


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+7FF8C730+7FECC730 CA00



Booting from Hard Disk...
GRUB loading..
Welcome to GRUB!
  Booting `CentOS Stream (5.14.0-505.el9.x86_64) 9'

Probing EDD (edd=off to disable)... ok
[    0.000000] Linux version 5.14.0-505.el9.x86_64 ([email protected]
[    0.000000] The list of certified hardware and cloud instances for Red Hat Enterprise .
[    0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.14.0-505.el9.x86_64 r8
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007ffdefff] usable
[    0.000000] BIOS-e820: [mem 0x000000007ffdf000-0x000000007fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000b0000000-0x00000000bfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000017fffffff] usable
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] APIC: Static calls initialized
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014
...

Can you share the Dockerfile please ?

Adphi avatar Sep 10 '24 14:09 Adphi

I cannot share my dockerfile but it is:

FROM quay.io/centos/centos:stream9-minimal

# lots of regular dnf install, nothing that touches /boot/ or grub. no kernel installs.

I should try an empty dockerfile

I worked around the issue by adding this to the centos template, which is horrible and fragile:

{{- if .GrubBIOS }}
RUN sed -i 's#/root/var/lib/docker/btrfs/subvolumes/[0-9a-f]*##' /boot/loader/entries/*
{{- end }}

stuart11n avatar Sep 10 '24 14:09 stuart11n

Is it possible that one of the dnf contains a vmlinuz which would then be discovered by grub ?

Adphi avatar Sep 10 '24 14:09 Adphi

I don't think so.

image

As it is my hosts docker volume path leaking in, maybe this is an environment issue. Something strange with my dev environment/docker install.

stuart11n avatar Sep 10 '24 14:09 stuart11n

Can you run find / -name 'vmlinuz*' inside the vm please ?

Adphi avatar Sep 10 '24 14:09 Adphi

the full docker image, converted to QCOW2, without --bootloader:

image


with a dockerfile containing only:

FROM quay.io/centos/centos:stream9-minimal

it boots ok. So something in my dockerfile is causing an issue.

I will try to track it down, and report back if I find it.

stuart11n avatar Sep 10 '24 15:09 stuart11n

You will not find it without the --bootloader grub-bios. Due to the following lines, it will be moved to /boot/vmlinuz:

https://github.com/linka-cloud/d2vm/blob/d8ee37833e25b22996adad2a0fe7026e24657e6b/templates/centos.Dockerfile#L41-L45

Can you run the find command directly in your container image ?

Adphi avatar Sep 10 '24 15:09 Adphi

nothing.

image

I did some grepping and there is no trace of this path either:

image

this doesn't make any sense and I fear I am wasting your time because of a strange artifact in my environment.

stuart11n avatar Sep 10 '24 15:09 stuart11n