Skip to content

bootc rollback writes the new boot order, then exits 1 with update_timestamps: No such file or directory when /sysroot/ostree/bootc is missing #2687

Backlog

Description

@Quantum-Sicarius

Summary

On an ostree-backend host where /sysroot/ostree/bootc has never been created, bootc rollback swaps the deployment order (prints Next boot: rollback deployment) and then fails:

Next boot: rollback deployment
error: Rollback: Rollback (ostree): Updating storage root mtime: update_timestamps: No such file or directory (os error 2)

The rollback has taken effect on disk, but the command exits 1. Automation that checks the exit code concludes that the rollback failed. greenboot is one such caller: it logs Manual intervention required - rollback failed and does not reboot, so the host keeps running the image that failed its health checks.

This is the rollback counterpart of RHEL-153671 / #2118. #2118 fixed the same error for bootc upgrade --check by initializing the bootc storage first. rollback never reaches that initialization.

Environment

  • Fedora CoreOS 45
  • bootc 1.17.1-1.fc45
  • rpm-ostree 2026.3-2.fc45
  • greenboot 0.16.4 (greenboot-rs)
  • ostree backend (not composefs)

The host was installed with coreos-installer, not bootc install. It is updated with rpm-ostree rebase ostree-image-signed:docker://quay.io/example/image:tag, not bootc upgrade/switch. On such a host, /sysroot/ostree contains only boot.0, boot.0.0, deploy and repo. There is no /sysroot/ostree/bootc.

Steps to reproduce

Tested on stock Fedora CoreOS 45.20261030.3.1 in a VM:

  1. Install Fedora CoreOS with coreos-installer.
  2. rpm-ostree rebase ostree-unverified-registry:quay.io/fedora/fedora-coreos:stable, then reboot, so the deployment is container-image based.
  3. rpm-ostree kargs --append=repro=1, then reboot. Both deployments are now container-image based. Do not layer packages: with client-side layered packages, rollback bails earlier with Rollback is not container image based (deploy.rs L1350-L1352). Do not run bootc upgrade or bootc switch, which would create the directory (see below).
  4. Confirm /sysroot/ostree/bootc does not exist.
  5. Run sudo bootc rollback.

Our fleet hits the same failure when greenboot triggers the rollback after a red boot, because greenboot runs bootc rollback.

Actual

$ sudo bootc rollback
Next boot: rollback deployment
error: Rollback: Rollback (ostree): Updating storage root mtime: update_timestamps: No such file or directory (os error 2)
$ echo $?
1

The rollback has nonetheless taken effect:

  • bootc status reports rollbackQueued: true.
  • The boot loader entries are swapped: the entry without repro=1 is now the default.
  • /run/reboot-required exists.

Expected

Either the rollback succeeds (exit 0), or it fails before changing the boot order. It should not commit the change and then report failure.

Cause

In deploy::rollback(), the call to update_mtime() comes after write_deployments() and write_reboot_required() (deploy.rs L1385-L1396 at v1.17.1; unchanged on main at L1468-L1479 and in v1.17.5):

    booted_ostree
        .sysroot
        .write_deployments(&new_deployments, gio::Cancellable::NONE)?;
    ...
        println!("Next boot: rollback deployment");
    ...
    write_reboot_required(rollback_image.manifest_digest.as_ref())?;

    sysroot.update_mtime()?;

Storage::update_mtime() calls update_timestamps("ostree/bootc") and propagates any error (store/mod.rs L902-L919; main L1049-L1066). The cap-std-ext update_timestamps it uses is a plain utimensat(..., AT_SYMLINK_NOFOLLOW), so a missing path returns ENOENT. The doc comment says the touch exists so that bootc-status-updated.path (PathChanged=/ostree/bootc) fires.

On the ostree backend, ostree/bootc is created only as a side effect of Storage::get_ensure_imgstore() → CStorage::create(), which does create_dir_all("ostree/bootc") before initializing ostree/bootc/storage (podstorage.rs L311-L324). The other update_mtime() callers reach that first:

rollback touches neither, so it fails on any host that has never run one of the operations above. Hosts installed by coreos-installer and managed only by rpm-ostree are one example. The reports below show the same missing directory after Anaconda or bootc-image-builder ISO installs. bootc edit with a boot-order change calls deploy::rollback() directly (cli.rs L1810-L1811), so it should fail the same way.

The rollback call was added in 93079bb (#977, first released in v1.1.4). Image-store creation was already lazy then (bffb3bb), which makes the failure probably as old as the call. We inferred that from the code and have not run old releases.

Effect on greenboot

greenboot-rs runs bootc rollback and treats any non-zero exit as failure (handler.rs L171-L182). On failure it logs Manual intervention required - rollback failed and returns without calling handle_reboot (main.rs L404-L421). The result is a host that stays up on the failed deployment while the next boot already points at the previous one, until something else reboots it.

Effect on retries

Running bootc rollback a second time makes things worse. Status derives boot_order from deployment order: it is Rollback when the rollback deployment's index is below the booted one (status.rs L361-L370). The second run therefore undoes the first and fails the same way:

$ sudo bootc rollback
notice: Reverting queued rollback state
Next boot: current deployment
error: Rollback: Rollback (ostree): Updating storage root mtime: update_timestamps: No such file or directory (os error 2)

Afterwards rollbackQueued is false and the boot loader entries are back in their original order. A caller that retries on a non-zero exit alternates between the two states, and each attempt reports failure.

Related reports

Possible fixes (maintainers' call)

  • Treat the mtime touch as best-effort: ignore ENOENT in update_mtime(), or create ostree/bootc there.
  • Or ensure the directory exists in rollback before write_deployments(), as cli: Initialize bootc storage before upgrade --check #2118 did for upgrade --check, so that a failure happens before the boot order changes.

Workaround, tested: create the directory once, as root. /sysroot is read-only on FCOS, so remount it first:

$ sudo mount -o remount,rw /sysroot && sudo mkdir /sysroot/ostree/bootc
$ sudo bootc rollback
Next boot: rollback deployment
$ echo $?
0

Running bootc rollback again then reverts cleanly, also with exit 0. Running bootc upgrade or bootc switch once has the same effect as the mkdir, but also initializes ostree/bootc/storage.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions