-
Notifications
You must be signed in to change notification settings - Fork 143
install: ommit mountspec kargs when --root-mount-spec
is empty
#1451
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
Hi, thanks for working on this! This change to omit the root mount specification kernel arguments for generic images is a good improvement.
I've left a couple of comments on the implementation:
- There's a critical issue in the kernel argument construction logic that likely causes the boot failure you observed. The
boot=
argument is unintentionally dropped when the root mount spec is empty. - The new test for the empty mount spec will panic. It should instead assert that an error is returned, which is the expected behavior for an invalid (empty) mount spec.
Addressing these should get the PR into a good state. Let me know if you have any questions!
P.S. There's a small typo in the PR title ('ommit' -> 'omit').
// If the root mount spec is empty, we omit the mounts kargs entirely. | ||
// https://github.com/bootc-dev/bootc/issues/1441 | ||
let mut kargs = if root_info.mount_spec.is_empty() { | ||
Vec::new() | ||
} else { | ||
[rootarg] | ||
.into_iter() | ||
.chain(root_info.kargs) | ||
.chain(bootarg) | ||
.collect::<Vec<_>>() | ||
}; | ||
|
||
kargs.push(RW_KARG.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for this contribution! I see you're trying to omit the root mount-related kernel arguments when --root-mount-spec
is empty.
There's a potential issue with the current implementation. The bootarg
is only included in the else
branch, which means it's omitted when root_info.mount_spec.is_empty()
. The boot=
kernel argument is important for features like FIPS compliance, and omitting it might be the reason the generated image fails to boot, as you mentioned in the PR description.
I'd suggest restructuring the logic to ensure bootarg
and RW_KARG
are always added, while the root-specific arguments are conditional. This also makes the logic a bit easier to follow.
Here's a suggested change:
// If the root mount spec is empty, we omit the mounts kargs entirely. | |
// https://github.com/bootc-dev/bootc/issues/1441 | |
let mut kargs = if root_info.mount_spec.is_empty() { | |
Vec::new() | |
} else { | |
[rootarg] | |
.into_iter() | |
.chain(root_info.kargs) | |
.chain(bootarg) | |
.collect::<Vec<_>>() | |
}; | |
kargs.push(RW_KARG.to_string()); | |
// If the root mount spec is empty, we omit the mounts kargs entirely. | |
// https://github.com/bootc-dev/bootc/issues/1441 | |
let mut kargs: Vec<String> = if !root_info.mount_spec.is_empty() { | |
// Add root-related kargs | |
std::iter::once(rootarg).chain(root_info.kargs).collect() | |
} else { | |
Vec::new() | |
}; | |
// Always add boot and rw kargs | |
kargs.extend(bootarg); | |
kargs.push(RW_KARG.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Also not that it matters at all but we could still use iterators here.
Also minor but it'd be nice to preserve the existing kernel argument ordering, i.e. keep RW_KARG
before bootarg
just to minimize changes.
3aa40e6
to
c8b5e29
Compare
The reason the console is blank is we don't inject any And yes with an omitted So basically I'd just verify this works for you with CoreOS and we can skip tests here (though we could support reverse-dependency testing, would be cool to support triggering a cosa build from here!); also please update the documentation for the argument to note the change. |
Yes I found that out an edited my message, but you reviewed in the meantime :)
It looks like an
Yes for sure, I plan to, I just wanted to get some feedback. |
I think this is directionally fine as is, but it feels to me like what we want (in addition) is a mechanism where the target image can drive this (which strongly relates also to systemd-repart as there the target knowledge is embedded in the image). That could manifest say as an option in the bootc install config, then we update the FCOS images to set it, and |
We also need support for But also, related to this is #1388 |
c8b5e29
to
f1c77e1
Compare
Notably, we skip generating an fstab entry for boot, even if it's on a separate partition. this requires the image initramfs have some knowledge to find the rootfs and bootfs (labels or DPS). See bootc-dev#1441
f1c77e1
to
560711d
Compare
@cgwalters I updated to keep the kargs order and make the boot mount spec argument conditonnal on Also updated the man page and a nicer commit message. An FCOS rawhide image built with this nicely boot :) I'll run it through the tests to see if I find anything weird |
Instead of deploying the container to the tree then copy all the contents to the disk image, use bootc to directly manage the installation to the target filesystems. Right now this requires to use the image as the buildroot so this requires python (for osbuild). This is tracked in [1]. As we have python in rawhide now I duplicated the manifest and added a switch in the osbuild wrapper script. We can keep the manifest duplicated until we are confident to roll this to all streams. [1] bootc-dev/bootc#1410 Requires: bootc-dev/bootc#1460 bootc-dev/bootc#1451 osbuild/osbuild#2149 osbuild/osbuild#2152 All of which have landed in osbuild-159 and bootc 1.6
Instead of deploying the container to the tree then copy all the contents to the disk image, use bootc to directly manage the installation to the target filesystems. Right now this requires to use the image as the buildroot so this requires python (for osbuild). This is tracked in [1]. As we have python in rawhide now I duplicated the manifest and added a switch in the osbuild wrapper script. We can keep the manifest duplicated until we are confident to roll this to all streams. [1] bootc-dev/bootc#1410 Requires: bootc-dev/bootc#1460 bootc-dev/bootc#1451 osbuild/osbuild#2149 osbuild/osbuild#2152 All of which have landed in osbuild-159 and bootc 1.6
Instead of deploying the container to the tree then copy all the contents to the disk image, use bootc to directly manage the installation to the target filesystems. Right now this requires to use the image as the buildroot so this requires python (for osbuild). This is tracked in [1]. As we have python in rawhide now I duplicated the manifest and added a switch in the osbuild wrapper script. We can keep the manifest duplicated until we are confident to roll this to all streams. [1] bootc-dev/bootc#1410 Requires: bootc-dev/bootc#1460 bootc-dev/bootc#1451 osbuild/osbuild#2149 osbuild/osbuild#2152 All of which have landed in osbuild-159 and bootc 1.6
This is an attempt to address #1441
I don't really know this code base, so i am opening this to get some feedback.
In this state the kargs are effectivelty omitted from the grub BLS entry.
Here is how i tested it :
Using coreos-assembler to get the build bootc binary inside the oci-archive, using the
overrides/rootfs
mechanism../rootfs
is a disk image mounted through loopback with/boot
and/boot/efi
already mounted