Skip to content

Conversation

@Johan-Liebert1
Copy link
Collaborator

Add an internal command for soft rebooting the system. Similar to how
it's done for ostree, we only allow soft reboot if the other deployment
has the same kernel state, i.e. the SHASum of kernel + initrd is the
same as that of the current deployment.

soft reboot is not possible in case of UKI deployment

After a soft reboot the kernel cmdline doesn't change so we can't rely
on the composefs= parameter in the cmdline. Instead, we check the
source of the root mount point

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
`target` field in Args was not being used. Use it if it is passed in the
args. Also helps us mount the new root at `/run/nextroot`

Also, use Cmdline struct instead of String to represent the kernel
command line

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@bootc-bot bootc-bot bot requested a review from jmarrero December 4, 2025 08:36
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for soft reboots for composefs deployments, a significant feature that aligns its capabilities more closely with ostree. The changes include a new internal command for preparing the soft reboot, logic to determine soft reboot capability based on kernel state, and an updated mechanism for detecting the booted deployment after a soft reboot by inspecting the root mount source.

Overall, the implementation is well-thought-out. However, I've identified a couple of critical issues. One is an error handling bug where a failure in the exec call for systemctl soft-reboot would be silently ignored. Another is a logic error in the usage of OnceLock which would fail to detect a soft reboot correctly on subsequent calls. I've also provided a suggestion to refactor a section of the code to improve its conciseness and readability. Addressing these points will enhance the robustness and maintainability of this new feature.

Add an internal command for soft rebooting the system. Similar to how
it's done for ostree, we only allow soft reboot if the other deployment
has the same kernel state, i.e. the SHASum of kernel + initrd is the
same as that of the current deployment.

soft reboot is not possible in case of UKI deployment

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@Johan-Liebert1
Copy link
Collaborator Author

plan-20-image-pushpull-upgrade seems to have failed with

content: Failed to kill unit test-cat-progress.service: Unit test-cat-progress.service not loaded.
content: Running as unit: test-cat-progress.service; invocation ID: ad2c2ea1c85a4253a2fc81619b9ade72
content: layers already present: 65; layers needed: 11 (267.8 MB)
content: Deploying...done (5 seconds)
content: Bound images stored: 3
content: Queued for next boot: ostree-unverified-image:containers-storage:localhost/bootc-derived
content:   Version: 10
content:   Digest: sha256:38e79b454a170138c58e2add8b6106ff374d63c03c33f8ef693590f0e28adf17
content: -- No entries --
content: Adding quoted karg via rpm-ostree to test ostree issue #3544
content: error: System transaction in progress
content: Connection to localhost closed.

Is this related to rpm-ostree? coreos/rpm-ostree#210 seems related, but not sure

Comment on lines +91 to +88
let verity_from_mount_src = root_mnt
.source
.strip_prefix("composefs:")
.ok_or_else(|| anyhow::anyhow!("Root not mounted using composefs"))?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hum...I'm OK with this but ultimately I think it'd be even nicer to have truly structured metadata associated with the mount point somehow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wouldn't the fsconfig string be that metadata?

// This is of the format composefs:<composefs_hash>
let verity_from_mount_src = root_mnt
.source
.strip_prefix("composefs:")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we strongly associate this string with the thing that creates it via a const?

Copy link
Collaborator Author

@Johan-Liebert1 Johan-Liebert1 Dec 5, 2025

Choose a reason for hiding this comment

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

I wanted to, but it's done in composefs-rs. Maybe we can export it from there

host.spec.boot_order = BootOrder::Rollback
};

// Can only soft reboot non UKI boot entries
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is a little bit more complex, as we'd have to extract .linux and .initrd sections to compute the hash. Definitely possible though. That being said, in the confidential clusters use case, would soft rebooting be a thing anyway?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We want to support sealed systems outside of just confidential workloads.

It is a little bit more complex, as we'd have to extract .linux and .initrd sections to compute the hash.

There are other UKI components too - such as the critical .cmdline. I think what we really need to do here is a complete diff the two, just dropping out composefs= from the .cmdline or so.

@cgwalters
Copy link
Collaborator

content: error: System transaction in progress

It's a flake (well, a bug somewhere), I'll ensure we have an issue for it

After a soft reboot the kernel cmdline doesn't change so we can't rely
on the `composefs=` parameter in the cmdline. Instead, we check the
source of the root mount point

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
@cgwalters

This comment was marked as outdated.

@cgwalters cgwalters added the needs-rebase Used by the rebase helper label Dec 9, 2025
@cgwalters
Copy link
Collaborator

Hmm...right I think we need to use pull_request_target for the rebase helper

@Johan-Liebert1
Copy link
Collaborator Author

I have rebased it locally. Working on soft-reboot for UKIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Used by the rebase helper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants