Skip to content

Conversation

cgwalters
Copy link
Member

@cgwalters cgwalters commented Jul 1, 2025

  • Add --reboot and --reset arguments
  • Related to that, if we target as soft reboot a deployment
    other than the staged one, automatically clear the staged
    deployment as otherwise the semantics are too confusing.
  • Rename the APIs so they all say soft_reboot and not next_root

Signed-off-by: Colin Walters walters@verbum.org

@cgwalters cgwalters added the area/soft-reboot Issues related to soft rebotos label Jul 1, 2025
Copy link

@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

The pull request introduces soft reboot functionality to ostree, allowing for staged updates and system resets. The changes include modifications to the documentation, symbol definitions, sysroot deployment logic, and command-line interface. The code introduces new functions for preparing and clearing soft reboot states, ensuring service finalization, and handling related file operations. The tests were also updated to verify the new functionality.

@cgwalters cgwalters force-pushed the soft-reboot-followups3 branch from 4f16be7 to 9372542 Compare July 1, 2025 18:55
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@jmarrero
Copy link
Member

jmarrero commented Jul 3, 2025

/test fcos-e2e

Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

While the test passes, if I do this manually I see:

##########################################################################
Warning: '/sysroot' is not mounted read-only
To disable this warning, use:
  sudo systemctl disable coreos-warn-invalid-mounts.service
##########################################################################

Another interesting thing is that with this I have to consistently call systemctl soft-reboot to be able to get an actual soft-reboot. Maybe because we are doing the /run/nextroot prep after calling reboot?

@cgwalters
Copy link
Member Author

Warning: '/sysroot' is not mounted read-only

Yeah it's because the test suite explicitly remounts it just because it's convenient.

Another interesting thing is that with this I have to consistently call systemctl soft-reboot to be able to get an actual soft-reboot. Maybe because we are doing the /run/nextroot prep after calling reboot?

Ahhh good call! Yeah that has to be it. There's a bit of a clash then with staging and /etc finalization. Maybe what we could do with a bit more work here is to split things up so that we create the raw mount point always, but only handle /etc finalization at shutdown time.

Or for now we could document this issue. I don't think it's critical; we're not setting up soft reboots by default, then tooling will need to opt-in/be aware and it's going to be pretty common I think for the tooling that initiates an upgrade to also be the thing doing a reboot.

That said though, if we did decide to queue soft reboots by default, then we should definitely fix this because otherwise in use case like desktop environments and the like, the UX will just have a "reboot" option and probably not also a soft reboot option.

@jmarrero
Copy link
Member

jmarrero commented Jul 7, 2025

Yeah it's because the test suite explicitly remounts it just because it's convenient.

I am not sure I follow, we expect '/sysroot' not mounted read-only` to be the correct behavior after a soft-reboot?

@cgwalters
Copy link
Member Author

I am not sure I follow, we expect '/sysroot' not mounted read-only` to be the correct behavior after a soft-reboot?

Only in the test case because it calls require_writable_sysroot - but we should stop doing that (and start testing that sysroot is readonly)

@cgwalters
Copy link
Member Author

OK I've been thinking/working on this more and I've come to the conclusion that when soft rebooting, we should not finalize the staged deployment if it's not the one targeted by soft reboots.

Maybe what we could do with a bit more work here is to split things up so that we create the raw mount point always, but only handle /etc finalization at shutdown time.

This one is going to be possible but messy.

@cgwalters cgwalters force-pushed the soft-reboot-followups3 branch 2 times, most recently from bdec06a to c590811 Compare July 7, 2025 18:47
@cgwalters cgwalters changed the title soft-reboot: Run at finalize time, add --reboot and --reset soft-reboot: Many changes Jul 7, 2025
@cgwalters cgwalters force-pushed the soft-reboot-followups3 branch 4 times, most recently from 926750d to 81b6f23 Compare July 7, 2025 21:45
@cgwalters
Copy link
Member Author

This one is going to be possible but messy.

Well it wasn't, it was mostly undoing things...

I think my original thought in moving the mount setup to shutdown is that we didn't have to deal with the possibility "skew" between the mount state of /run/nextroot and our metadata file (so many things would be cleaner really if we could have xattrs on mount points or so).

Anyways, we're now back to setting up the mounts when prepare-soft-reboot is invoked, and I added a test case that verifies with this systemctl reboot now does soft reboot by default.

@cgwalters
Copy link
Member Author

Only in the test case because it calls require_writable_sysroot - but we should stop doing that (and start testing that sysroot is readonly)

For posterity there was a bug here, we weren't including the right metadata and so ostree-remount.service was remounting it writable.

@cgwalters cgwalters force-pushed the soft-reboot-followups3 branch 2 times, most recently from f154dc8 to d927ba7 Compare July 8, 2025 00:24
@cgwalters cgwalters mentioned this pull request Jul 8, 2025
9 tasks
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@cgwalters cgwalters requested a review from jmarrero July 8, 2025 15:04
@cgwalters
Copy link
Member Author

/gemini review

Copy link

@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 significant and valuable changes to the soft-reboot functionality. The new command-line arguments, API renaming, and logic for handling staged deployments are well-implemented. The code is robust, and the tests are comprehensive. I've provided a few minor suggestions to improve code clarity and fix small issues in the test scripts. Overall, this is a great contribution.

- Add --reboot and --reset arguments
- Don't compile on centos stream 9 (missing `open_tree` glibc wrapper)
  as the functionality isn't supported by systemd there; that said
  we should also do dynamic detection
- Fix /sysroot writability
- If we target as soft reboot a deployment
  *other* than the staged one, automatically clear the staged
  deployment as otherwise the semantics are too confusing.
- Rename the APIs so they all say `soft_reboot` and not `next_root`

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters force-pushed the soft-reboot-followups3 branch from d927ba7 to 6bee4a0 Compare July 8, 2025 15:34
@cgwalters cgwalters enabled auto-merge July 8, 2025 15:36
@cgwalters cgwalters merged commit 15118f9 into ostreedev:main Jul 8, 2025
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/soft-reboot Issues related to soft rebotos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants