-
Notifications
You must be signed in to change notification settings - Fork 154
install: add target_root_path for RootSetup
#1752
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
base: main
Are you sure you want to change the base?
Conversation
01ff672 to
0830023
Compare
|
Build the patch based on Check the If I reboot, seems it still booted into old rhel9.6, how can I check if the installation is successful?
|
|
This is a complex topic. A first thing here is that This issue also relates to #820 I think at the current time it's expected that
That is strange; what does |
|
One issue also related to this is that some of the install integration tests are still mostly orchestrated via the GHA I think we should likely switch them over to tmt. Although it gets subtle as reproducing the Edge starting state via tmt will require some work, but we can do that as a followup. |
Actually on ostree OS, it only removes
Run After reboot, boot into the old rhel9.6-edge, find directory |
You're right! And that's one of the issues here - this system is ostree but not bootupd, and that's one of the problem roots - I think in this case we'll just not change the bootloader state at all which is not expected. I think basically if we detect ostree but not bootupd, then we should proceed by wiping out the complete ESP as before alongside everything in Now...there is a related but distinct thing here which is that if we detect bootupd, we should also forcibly do a |
25cf806 to
4c8db70
Compare
Sorry that this is out of my knowledge, what I see is from clean_boot_directories() before install_to_filesystem_impl(), any pointer for this? Thank you!
LGTM, have no idea where I should add this.
Should the new entries config and kernel file are created after running |
Yep that's the right place
In the logic where we have
Yes the boot loader entries are written by the install (and upgrade) process; those should stay the same as is today. What's special cased right now is ostree-vs-non-ostree in the |
The bootupctl update is a little different as it currently reads path form
With @jbtrystram 's help, do testing with change, cleanup ESP files and preserve like After reboot, boot into the old rhel9.6-edge, directory I think what you said for the comment makes sense, but I have no idea how to fix this, any pointer is much appreciated. Copy the comment here: |
13f3c22 to
41935bb
Compare
|
Check more and find that the new The workaround is remove After booted, check that Edit:
This explains why the mount shows as |
|
Based on the above comment, one workaround is
Edit: |
Get pointer from bootc-dev#1752 (comment) On Ostree OS, should empty the complete ESP and everything in `/boot` but preserve `/boot/loader`. Signed-off-by: Huijing Hei <hhei@redhat.com> Co-worked by: Jean-Baptiste Trystram <jbtrystram@redhat.com>
5e2338b to
e5a6ba4
Compare
root_path for RootSetuptarget_root_path for RootSetup
|
Do some testing based on PR, Before reboot: After reboot and check |
e5a6ba4 to
0e61edd
Compare
ea64cd9 to
4449ca1
Compare
|
CI error: |
| if let Some(boot) = root_setup.boot.as_ref() { | ||
| if !boot.source.is_empty() { | ||
| let mount_extra = format!( | ||
| "systemd.mount-extra={}:{}:{}:{}", |
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.
Let's link to #1388 here - and also note the problem is that functionality isn't in C9S today, and there were people who wanted this fix on that version.
There's more discussion in that issue, including the big wrinkle that for FIPS we need a BOOT= karg today.
crates/lib/src/install.rs
Outdated
| let source_boot = target_root.join(BOOT); | ||
| let target_boot = root_setup.physical_root_path.join(BOOT); | ||
| tracing::debug!("Bind mounting {source_boot} to {target_boot}"); | ||
| Command::new("mount") |
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.
We have a mount module it'd make sense to use
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.
With bootc_mount::mount(source_boot.as_str(), &target_boot)?;, so change to use boot.source, WDYT?
Mount /target/boot to /target/sysroot/boot on ostree
[19568.268855] /target/boot: Can't lookup blockdev
mount: /target/sysroot/boot: /target/boot is not a block device.
error: Installing to filesystem: Creating ostree deployment: Failed to run command: Command {
program: "mount",
args: [
"mount",
"/target/boot",
"/target/sysroot/boot",
],
create_pidfd: false,
}
crates/lib/src/install.rs
Outdated
| .context("Mounting host / to {ALONGSIDE_ROOT_MOUNT}")?; | ||
| } | ||
|
|
||
| let target_root_path = &fsopts.root_path.clone(); |
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.
I don't think we need to clone here
crates/lib/src/install.rs
Outdated
| let target_root_path = &fsopts.root_path.clone(); | ||
| // Get a file descriptor for the root path /target | ||
| let target_rootfs_fd = { | ||
| let rootfs_fd = Dir::open_ambient_dir(&target_root_path, cap_std::ambient_authority()) |
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.
I think we can just pass &fsopts.root_path here
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.
ACK, let me try, thank you!
crates/lib/src/install.rs
Outdated
| let rootfs_fd = Dir::open_ambient_dir(&target_root_path, cap_std::ambient_authority()) | ||
| .with_context(|| format!("Opening target root directory {target_root_path}"))?; | ||
|
|
||
| tracing::debug!("Root filesystem: {target_root_path}"); |
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.
This debug could go earlier if we need it, we're just a copy of fsopts.root_path
crates/lib/src/install.rs
Outdated
|
|
||
| tracing::debug!("Root filesystem: {target_root_path}"); | ||
|
|
||
| if let Some(false) = rootfs_fd.is_mountpoint(".")? { |
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.
Also I think we should verify this earlier.
To summarize: target_root_path = fsopts.root_path and I think it's a lot clearer if we don't have another alias for it.
(Though of course, even better if we only hold it as a Dir but that's going to be harder)
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.
So we need both target_root_path and root_path, is this right?
-
On ostree OS,
target_root_pathwill be/target(used by bootupd), androot_pathwill be/target/sysroot,physical_rootshould be the directory file descriptor of/target/sysroot. -
On package mode, both
target_root_pathandroot_pathwill be/target,physical_rootshould be the directory file descriptor of/target.
Edit:
I did testing and am sure that physical_root should be the dir of /target/sysroot on ostree.
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.
Also tried with target_root_path = fsopts.root_path, but make failed. So I do not change this, but maybe I misunderstood this.
Get pointer from Colin's comment bootc-dev#1752 (comment) - Empty the complete ESP - On ostree OS, empty everything in `/boot` but preserve `/boot/loader` - On none ostree OS, the loader is directory that needs to be removed. Signed-off-by: Huijing Hei <hhei@redhat.com>
4449ca1 to
f53aa17
Compare
Get pointer from Colin's comment bootc-dev#1752 (comment) - Empty the complete ESP - On ostree OS, empty `/boot` but preserve `/boot/loader` - On none ostree OS, the loader is directory that needs to be removed. Signed-off-by: Huijing Hei <hhei@redhat.com>
2cfdd0b to
e02e016
Compare
b5a1567 to
5c6f148
Compare
Get pointer from Colin's comment bootc-dev#1752 (comment) - Empty the complete ESP - On ostree OS, empty `/boot` but preserve `/boot/loader` - On none ostree OS, the loader is directory that needs to be removed. Signed-off-by: Huijing Hei <hhei@redhat.com>
5c6f148 to
d1fe1cc
Compare
|
Rebase the main branch and waiting for the CI result. |
Get pointer from Colin's comment bootc-dev#1752 (comment) - Empty the complete ESP - On ostree OS, empty `/boot` but preserve `/boot/loader` - On none ostree OS, the loader is directory that needs to be removed. Signed-off-by: Huijing Hei <hhei@redhat.com>
d1fe1cc to
204fe60
Compare
|
Maybe the CI failed is not related to the PR, could you help to review again? Thank you @cgwalters ! |
Get pointer from Colin's comment bootc-dev#1752 (comment) - Empty the complete ESP - On ostree OS, empty `/boot` but preserve `/boot/loader` - On none ostree OS, the loader is directory that needs to be removed. Signed-off-by: Huijing Hei <hhei@redhat.com>
When running `install to-filesystem` on ostree OS, should use `target_root_path` for bootupctl to install bootloader. Signed-off-by: Huijing Hei <hhei@redhat.com>
59cbf82 to
6ce4173
Compare
Also need to mount the separate boot partition to `/target/sysroot/boot` on ostree OS. Signed-off-by: Huijing Hei <hhei@redhat.com>
6ce4173 to
106c3ff
Compare
When install to-filesystem on ostree OS, will pass
target_root_pathtobootupctlto install bootloader.