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

Consider an rpm-ostree history command #1489

Closed
jlebon opened this issue Aug 3, 2018 · 10 comments
Closed

Consider an rpm-ostree history command #1489

jlebon opened this issue Aug 3, 2018 · 10 comments
Assignees

Comments

@jlebon
Copy link
Member

jlebon commented Aug 3, 2018

In a discussion on IRC, one idea we discussed was something equivalent to dnf history, i.e. rpm-ostree history, where one is able to see exactly which branches/versions/checksums were actually deployed on the system at which times.

Somewhat related to #558, though this is orthogonal to the actual branch history on which the system is currently sitting on and is instead a history of the system itself. This can be useful for debugging/auditing.

@dustymabe
Copy link
Member

/me likey

@dustymabe
Copy link
Member

This could also allow us to track down more complicated upgrade path bugs

@g00nix
Copy link

g00nix commented Aug 5, 2018

I am planning to switch from normal Fedora to Silverblue and this would help a lot in keeping track of what happened to my laptop.

@cgwalters
Copy link
Member

Some of this is already in the journal.

@jlebon jlebon self-assigned this Sep 25, 2018
@jlebon
Copy link
Member Author

jlebon commented Oct 1, 2018

So, I started hacking on this with the idea of keeping it all in the journal. Basically, enhance the upgrader to write a structured msg to the journal when we create a new deployment and then enhance ostree-prepare-root so that it writes to the journal the deployment path we're booting into. Combined, these two provide enough information to trace exactly when we rebooted into what branch/commit/etc...

The main advantage of this approach is that we don't have to maintain our own db/logs on the side. It also gives us history basically for free, i.e. without needing for an enabled systemd service on boot to mark in the db when a deployment was booted into (not to mention doing it from the initramfs means we still notice boots even if they didn't boot successfully all the way).

One downside though is that we're limited to what we can dump in the journal. E.g. one thought I had initially was just to keep the whole commit object around since that contains the pkglist, overlays, overrides, etc... With the journal approach, we'd have to find a good balance on what to include.

jlebon added a commit to jlebon/libdnf that referenced this issue Dec 20, 2018
Not all users of libdnf really need the functionality added by the SWDB
database. This is especially true for rpm-ostree-based variants of
Fedora and RHEL, which only use libdnf for composing on the server and
package layering on the client.

Some major differences that render the SWDB not useful for rpm-ostree:
- rpm-ostree already keeps track of requested packages in a separate
  database (really, text file).
- rpm-ostree always applies package installs from scratch on top of the
  base OSTree, so the concept of history is simply different (see e.g.
  coreos/rpm-ostree#1489).
- rpm-ostree updates are performed offline, i.e. not on the live system.
  As such, we don't need to track the state of the RPM transaction as it
  happens in a separate database. If librpm throws an error, we just
  throw out the whole offline rootfs.
- OSTree commits themselves already contain the list of packages that
  were installed in them, so that we can consult the commit metadata (or
  even the rpmdb directly) if we need to render the RPM diff on a system
  or OSTree branch.
@jlebon
Copy link
Member Author

jlebon commented Apr 10, 2019

Some related discussions in coreos/fedora-coreos-tracker#170.

@jlebon
Copy link
Member Author

jlebon commented Apr 17, 2019

PR in #1813.

jlebon added a commit to jlebon/rpm-ostree that referenced this issue Jun 11, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
jlebon added a commit to jlebon/rpm-ostree that referenced this issue Jul 20, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
jlebon added a commit to jlebon/rpm-ostree that referenced this issue Sep 20, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
jlebon added a commit to jlebon/rpm-ostree that referenced this issue Sep 20, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
jlebon added a commit to jlebon/rpm-ostree that referenced this issue Sep 21, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: coreos#1489
rh-atomic-bot pushed a commit that referenced this issue Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this issue Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this issue Sep 23, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this issue Sep 24, 2019
This is the rpm-ostree equivalent of `dnf history`. As opposed to the
history of the refspec (i.e. `ostree log`), this shows the history of
the system, i.e. the refspecs the host deployed, checksums, versions,
layered packages, etc... The amount of details remembered is similar to
what shows up in `status`.

There's definitely some further enhancements possible (e.g. printing
package diffs, displaying rollbacks), though this seems in good enough
shape as a first cut.

Closes: #1489

Closes: #1813
Approved by: cgwalters
@petersenna
Copy link

petersenna commented May 15, 2020

Hi, this is really awesome, thank you! But how to rollback to a previous state? I tried rpm-ostree rebase but I still have same LocalPackages and LayeredPackages as before... My goal is to get back in time, and revert what I did with rpm-ostree that was adding LocalPackages, adding LayeredPackages, and adding some kargs...

@cgwalters
Copy link
Member

For the package bits, use rpm-ostree reset -oli. For kernel arguments, unfortunately we don't track the defaults so we don't have a way to undo that - see ostreedev/ostree#479

@jlebon
Copy link
Member Author

jlebon commented May 15, 2020

The history should have the list of rpm-ostree kargs commands that you ran at least so you could manually undo those by running rpm-ostree kargs again for the opposite actions.

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

Successfully merging a pull request may close this issue.

5 participants