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

man/bootc-rollback: add information about /etc #1173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmarrero
Copy link
Contributor

@jmarrero jmarrero commented Mar 6, 2025

This is just adding the docs added on https://gitlab.com/fedora/bootc/docs/-/merge_requests/90 to the man page.

@github-actions github-actions bot added documentation Improvements or additions to documentation control/skip-ci Do not run expensive CI on this job labels Mar 6, 2025
Signed-off-by: Joseph Marrero Corchado <[email protected]>

This is because `bootc rollback` just reorders the existing deployments. It doesn't create new deployments. The /etc merges happen when new deployments are created.

If you want to save a modified /etc file for use after the rollback:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor nit, we're not consistently back-ticking filenames, i.e. this should be /etc

Comment on lines +48 to +49
Another option if one is sure the situation you are rolling back for is not the config files i.e content in /etc/ and you want to go to an older deployment you can `bootc switch`
to that older image, this will perform the /etc merge and deploy the previous version of the software.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This sentence is a bit awkward, maybe:

To perform a logical rollback, while still carrying forward changes to local configuration files, use bootc switch to an explicit prior image tag or digest. This acts the same as a bootc upgrade, just with older content.

@@ -32,6 +32,22 @@ rollback invocation.

: Print help (see a summary with -h)

# Note on Rollbacks and the /etc Directory

When you perform a rollback (e.g., with bootc rollback), any changes made to files in the `/etc` directory won’t carry over to the rolled-back deployment.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's backtick bootc rollback too.

@jeckersb
Copy link
Contributor

jeckersb commented Mar 6, 2025

I think this is not quite right, because the stuff under docs/src/man is autogenerated. Looks like the flow begins from cargo xtask update-generated which is basically doing:

  • cargo xtask manpages
    • which in turn is running cargo run --features=docgen -- man --directory target/man to generate the manpages from the docstrings in the rust src
    • additionally iterates through the files in docs/src/man-md and uses mandown to convert those into manpages and put them under target/man as well
  • Runs pandoc on everything in target/man to then turn those into the files in docs/src/man

So really this needs to go into the docstring in the rust source, or we need some better way to include additional sections in the manpage beyond just autogenerating the DESCRIPTION?

@cgwalters
Copy link
Collaborator

Ah yes, you're right. Glad you caught that. I guess we probably need to auto-generate loud "Don't edit this file" markers too.

This all said, I was poking at switching to hand-writing the man pages but just extracting the minimal argument docs from the rust code instead. Or maybe we just want a CI test to ensure they're in sync.

@jeckersb
Copy link
Contributor

jeckersb commented Mar 6, 2025

Looks like you can add things to the EXTRAS section by using after_help on the clap Command: https://github.com/clap-rs/clap/blob/master/clap_mangen/examples/man.rs#L17

@jeckersb
Copy link
Contributor

jeckersb commented Mar 6, 2025

I pushed a version to my fork which seems to do what we want, incorporating Colin's suggestions. If that looks sane to others we can incorporate it into this PR.

@jeckersb
Copy link
Contributor

jeckersb commented Mar 6, 2025

Although now that I re-examine it I'm not 100% sold on that solution, because it ends up in the bootc rollback --help output (maybe we want that, maybe we dont?). If we do want it in there, formatting needs tweaked because the 80-char wrapped string in the indoc expands into nice paragraphs in the manpage, but it does not expand nicely on the cli; instead we end up with the hard line breaks:

Change the bootloader entry ordering; the deployment under `rollback` will be queued for the next boot, and the current will become rollback.  If there is a `staged` entry (an unapplied, queued upgrade) then it will be discarded.

Note that absent any additional control logic, if there is an active agent doing automated upgrades (such as the default `bootc-fetch-apply-updates.timer` and associated `.service`) the change here may be reverted.  It's recommended to only use this in concert with an agent that is in active control.

A systemd journal message will be logged with `MESSAGE_ID=26f3b1eb24464d12aa5e7b544a6b5468` in order to detect a rollback invocation.

Usage: bootc rollback

Options:
  -h, --help
          Print help (see a summary with '-h')

Note on Rollbacks and the `/etc` Directory:

When you perform a rollback (e.g., with `bootc rollback`), any
changes made to files in the `/etc` directory won’t carry over
to the rolled-back deployment.  The `/etc` files will revert
to their state from that previous deployment instead.

This is because `bootc rollback` just reorders the existing
deployments. It doesn't create new deployments. The `/etc`
merges happen when new deployments are created.

If you want to save a modified `/etc` file for use after the
rollback: You can copy it to a directory under `/var`, like
`/var/home/User` (for a specific user) or `/var/root/` (for
the root user).  These directories aren’t affected by the
rollback as it is user content.

Going back to the original state from either through a
temporary rollback or another `bootc rollback`, the `/etc`
directory will restore to its state from that original
deployment.

To perform a logical rollback, while still carrying forward
changes to local configuration files, use `bootc switch` to an
explicit prior image tag or digest. This acts the same as a
`bootc upgrade`, just with older content.

@jmarrero
Copy link
Contributor Author

jmarrero commented Mar 6, 2025

I am not sure if all man pages content is expected to be on the --help page. But I can see people benefiting from it and also can see it being too much 🤷‍♂️

@jmarrero
Copy link
Contributor Author

jmarrero commented Mar 6, 2025

We could point to the doc URL... but then we have to think about RHEL vs Fedora docs?

@cgwalters
Copy link
Collaborator

We had a live chat on this; I'm fine with having a relatively long --help but in the more medium term I'd lean towards either (or both!) of:

  • Manual man page generation, with CI to check
  • Creating a man bootc-upgrade-rollback that has all the details, kind of like man bootup

Copy link
Contributor

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Thanks for adding that to the docs!

Could you add a similar (maybe briefer) note to the fedora-bootc docs? We can xref here for the full details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
control/skip-ci Do not run expensive CI on this job documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants