Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initramfs-module: add example adding a module to the initramfs #63

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

jmarrero
Copy link
Member

@jmarrero jmarrero commented Jun 14, 2023

Demos generating a initramfs with specific modules added and omitted.

@@ -0,0 +1,8 @@
FROM quay.io/fedora/fedora-coreos:stable
RUN KERNEL=$(rpm -q kernel | cut -c 8-); \
dracut --reproducible -v --add 'ostree' -f --no-hostonly --omit-drivers 'nouveau' --omit 'nfs' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing we could note here is that it's now a best practice to ensure that the "base image" has its initramfs arguments embedded in the image. coreos/fedora-coreos-config#1828

I think at this time, the --omit nfs is not needed (per that PR).

Oh I see, it looks like you may have copied these arguments from the RHCOS one, which has these others.

Maybe if we're aiming to handle RHCOS here we could at least link to
https://github.com/openshift/os/blob/1f2c0eb7e370d2412db15fa28556f419ddf73c5d/common.yaml#L37

But ideally in the future we do the same change for RHCOS that we did for FCOS and then this bit isn't necessary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will link to both files in a comment then, that way we provide enough guideline to both RHCOS and FCOS users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am re reading this, does that mean that for --no-hostonly we don't need to add it either because it's also provided on overlay.d/05core/usr/lib/dracut/dracut.conf.d/fcos-nohostonly.conf ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@jmarrero jmarrero marked this pull request as ready for review June 15, 2023 18:47
@jmarrero jmarrero force-pushed the iniramfs branch 2 times, most recently from f1b9980 to 2bcd8ed Compare June 15, 2023 19:02
Comment on lines 18 to 20
cat /lib/modules/$KERNEL_VERSION/initramfs.img dracut-random.cpio.gz > /lib/modules/$KERNEL_VERSION/initramfs-new.img && \
# Move initramfs to final destination.
mv /lib/modules/$KERNEL_VERSION/initramfs-new.img /lib/modules/$KERNEL_VERSION/initramfs.img && ostree container commit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor nit, this can be condensed into

cat dracut-random.cpio.gz >> /lib/modules/$KERNEL_VERSION/initramfs.img && \
  ostree container commit

@cgwalters
Copy link
Member

BTW this all relates to https://bugzilla.redhat.com/show_bug.cgi?id=1380866

@jmarrero
Copy link
Member Author

putting back as draft as with FIPS I can't get it to boot with or without the /dev/random workaround. Need to dig.

@jmarrero jmarrero marked this pull request as draft June 16, 2023 19:23
@cgwalters
Copy link
Member

AFAIK no one is really testing FIPS in Fedora today. The FIPS setup only lives in RHCOS today. So...I'd be fine ignoring the FIPS-FCOS problem for now if you prefer!

@jmarrero jmarrero marked this pull request as ready for review July 7, 2023 18:03
@jmarrero
Copy link
Member Author

jmarrero commented Jul 7, 2023

I was able to reboot into the image with the current example on Fedora, no need for the cpio file with /dev/random on FCOS and no fips. merging

@jmarrero jmarrero merged commit c068b65 into coreos:main Jul 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants