13

Let's read the official documentation:

dnf history rollback <transaction-spec> Undo all transactions performed after the specified transaction. If it is not possible to undo any transaction due to the current state of RPMDB, do not undo any transaction.

Emphasis is mine. So this command refers to the undo command. Okay, let's read the documentation concerning undo:

dnf history undo <transaction-spec> Perform the opposite operation to all operations performed in the specified transaction. If it is not possible to undo any operation due to the current state of RPMDB, do not undo any operation.

It sounds that those two commands do the same things with the exception that the former can undo several transactions, and the later just one.

Is this understanding correct? (I would appreciate answers from first-hand experience, not from the point of view how you interpret the manual, I'm interested in facts, not guesses.)

Context: I need to write a script that runs dnf upgrade -y and then runs some tests and then reverse the dnf changes if the tests fail. I'm looking for the best way of achieving this.

16

undo only undoes that specific transaction, while rollback undoes everything between that transaction and the current state of the system.

Example: you install htop, then later install ncdu and glances, followed by mc the next day.

You later want to undo installing htop, so you use the undo function to try to undo installing htop, but still keep the other programs you installed later.

If you rolled back to the transaction that installed htop, you'd instead undo the installation of ncdu, glances and mc, while still keeping htop.

  • 1
    Yep, that I how I understood it too, but wanted to confirm, thank you for doing that! ;) – Andrew Savinykh Mar 5 '17 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.