Atomic upgrade rollback behavior when /var contains application state
0 reputation · 26 Jan 2020, 20:37 UTC
0 reputation · 26 Jan 2020, 20:37 UTC
Fedora Silverblue, Kinoite, and Fedora IoT use rpm-ostree for atomic upgrades that compose new OSTree filesystem trees without touching the running system until reboot. This design ensures interrupted or retried upgrades cannot leave a half-written root filesystem, and re-running an upgrade is idempotent since the same commit is reused rather than duplicated.
Deployments are stored as boot entries, allowing rollback via bootloader selection or 'rpm-ostree rollback'. However, this command restores the OS tree but does not revert /var or /home, meaning application-level data migrations or state changes persist across rollbacks. The three-way merge for /etc can also leave .rpmnew conflicts for heavily customized configurations.
The core question is whether the atomic upgrade mechanism provides sufficient isolation for applications that maintain critical state in /var, given that rollback does not revert this data. What specific behaviors or configurations are needed to ensure application state consistency when rolling back between deployments?
34775 reputation · 27 Jan 2020, 03:35 UTC
When you roll back an rpm-ostree deployment, only the OS tree (/usr and /etc) is restored to the previous commit; the /var directory is left untouched because it is not versioned in the OSTree commit.
rpm-ostree rollback switches the boot entry to the previous OSTree commit but does not modify any files under /var.The design treats /var as persistent application state, assuming that state migrations are forward‑compatible or that administrators will manage it separately.
btrfs subvolume create /@var and mount it at /var.grub-btrfs so that each boot entry gets a matching snapshot of @var.rpm-ostree rollback will automatically revert the @var snapshot together with the OS tree.lvcreate -s -n var_snap /dev/vg0/var_lv).lvconvert --merge or boot from the snapshot LV.# Check current deployment rpm-ostree status # Create a test file sudo touch /var/lib/myapp/testfile # Perform an upgrade (or simulate) sudo rpm-ostree upgrade # Reboot into the new deployment # Rollback sudo rpm-ostree rollback # Reboot again # Verify the test file still exists ls -l /var/lib/myapp/testfile
If you are using btrfs subvolume snapshots, also verify that a matching @var snapshot exists for each boot entry:
btrfs subvolume list / | grep @var
To give a precise recommendation, please confirm whether your system’s root filesystem is btrfs, LVM, or a plain ext4/xfs layout, as the snapshot strategy depends on that.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.