apt history undo: Rollback apt Changes in Ubuntu 26.04

Ubuntu 26.04 (Resolute Raccoon) ships with APT 3.2, which adds native transaction history. To undo a package install, run sudo apt history-undo . First find the ID with sudo apt history-list. To roll everything back to a checkpoint: sudo apt history-rollback . No extra packages needed — it's built in.

What Changed in Ubuntu 26.04: APT 3.2 and the New History Commands

On Ubuntu 24.04 there was no native undo. You'd grep /var/log/apt/history.log, reconstruct the package list manually, and run apt-get install package=old-version on each one — if the old version was even still available. Tedious, easy to miss auto-installed dependencies, and entirely manual.

Ubuntu 26.04 ships APT 3.2, released in April 2026. The headline addition is a structured transaction log that APT itself understands. Every apt install, apt remove, apt upgrade, and autoremove gets recorded with an ID, and you can address any of those operations by that ID later.

The five new commands are:

  • apt history-list — lists all past transactions with sequential IDs
  • apt history-info — shows the full detail of one transaction
  • apt history-undo — reverses a single transaction
  • apt history-redo — re-applies a previously undone transaction
  • apt history-rollback — undoes every transaction that happened after the given ID

One boundary to know up front: history starts from when you first ran APT under 26.04. If you upgraded from 24.04, nothing from before the upgrade appears in the list.

How to Read Your Ubuntu 26.04 apt Transaction History

Start here every time. history-list gives you the ID you'll pass to everything else:

sudo apt history-list

Output looks like this:

ID Command line Date and Time Action Changes 0 install vim 2026-05-01 10:21:33 Install 1 1 upgrade 2026-05-02 09:44:17 I,U 87 2 install nginx curl wget 2026-05-03 15:12:44 Install 3 3 remove nginx 2026-05-03 15:45:10 Remove 1

The Action column uses shorthand: I = installed, U = upgraded, R = removed. Changes is the total package count affected.

How to Inspect a Transaction Before You Undo It

Don't skip this step. Always check what a transaction actually did before reversing it:

sudo apt history-info 2
Start-Date: 2026-05-03 15:12:44 Requested-By: youruser (1000) Commandline: apt install nginx curl wget Install: nginx, curl, wget End-Date: 2026-05-03 15:12:57

I've made the mistake of undoing the wrong ID because I assumed without checking. The history-info step takes five seconds and has saved me more than once.

How to Undo a Single apt Install or Remove

This is the main use case: you installed something, it caused a problem, you want the system back the way it was. Pass the transaction ID to history-undo:

sudo apt history-undo 2

APT works out the reverse automatically. If transaction 2 installed three packages, it removes all three — including auto-installed dependencies that nothing else needs. If the transaction removed a package, it reinstalls it. You get a normal apt confirmation prompt before anything changes.

The thing that catches people: history-undo operates on that specific transaction in isolation. If a later transaction installed something that depends on a package you're about to undo, APT will either refuse or surface a dependency warning. Read those warnings. If it's pulling out more than you expected, stop, run history-info on the later transaction IDs, and understand what's connected before proceeding.

How to Use apt history-rollback to Revert Multiple Changes

history-undo handles one transaction. When you want to rewind to a checkpoint — undoing everything that happened after a specific point — use history-rollback:

sudo apt history-rollback 1

That reverses every transaction with an ID greater than 1, in reverse order, leaving your system in the state it was in immediately after transaction 1. This is the right command after an apt upgrade that broke something, or after installing a batch of packages and deciding half of them shouldn't be there.

I used this after accidentally running apt upgrade on a machine that wasn't supposed to be touched. A 47-package upgrade undone in under two minutes. The confirmation prompt shows exactly what's going to change — review it before typing Y.

You can skip the confirmation with -y:

sudo apt history-rollback 1 -y

Don't use -y on rollback unless you've already reviewed the transaction list and know exactly what will be undone. The prompt is there for a reason.

How to Redo What You Undid

If you ran history-undo and realised you actually needed that package, history-redo re-applies the transaction:

sudo apt history-redo 2

APT re-resolves dependencies fresh, so if the package state has shifted since the original install, it adapts. The limitation worth knowing: history-redo works on individual undone transactions — it does not re-apply a bulk history-rollback. If you rolled back too aggressively, you'll need to re-install the packages manually or redo them one transaction ID at a time.

What apt history undo Won't Solve: Real Limitations

These commands manage packages, not your whole system. A few things trip people up:

The old version has to still be in the repos. Rolling back an upgrade only works if the previous package version is still available from your configured APT sources. Ubuntu pushes security updates fast, and superseded versions get pulled. Try to roll back a weeks-old upgrade and you'll likely see something like:

E: Version '2.4.57-2ubuntu1' for 'apache2' was not found

This is the biggest real-world limit. The sooner you catch a problem and roll back, the more likely it works.

Config files aren't restored. Undoing a removal reinstalls the package — it doesn't restore the config to its pre-removal state. If you removed a package and its config got purged or modified, you're on your own for that part.

Manual dpkg installs aren't tracked. If you installed a .deb file with dpkg -i, it won't appear in apt history-list. Same for Snap and Flatpak — outside APT's scope entirely.

It's not a full system snapshot. For kernel changes, shared library upgrades, anything involving /etc, or whole-system recovery, you still want Timeshift with Btrfs or LVM snapshots. apt history-rollback is a precise scalpel for package operations — it's not a time machine for the OS.

Quick Reference: apt history Commands in Ubuntu 26.04

Command What it does
sudo apt history-list List all past transactions with IDs
sudo apt history-info Show full detail of a specific transaction
sudo apt history-undo Reverse a single transaction
sudo apt history-redo Re-apply a previously undone transaction
sudo apt history-rollback Undo all transactions after the given ID

FAQ

Does apt history undo work on Ubuntu 24.04?

No. These commands require APT 3.2, which ships with Ubuntu 26.04 (Resolute Raccoon). On 24.04 you're back to manually reading /var/log/apt/history.log and using apt-get install package=version to downgrade individual packages. The apt-rollback tool listed in older Ubuntu manpages (22.04, 24.04) is a separate third-party utility — it's not the same thing as APT 3.2's native history commands.

What's the difference between apt history-undo and apt history-rollback?

history-undo reverses one specific transaction by ID. history-rollback undoes every transaction that happened after the given ID — a checkpoint restore. Use undo for a single surgical change; use rollback when you want to get back to a known-good point in time.

Can I roll back a full system upgrade with apt history-rollback?

Technically yes, but it often fails for large upgrades because many pre-upgrade package versions have already been removed from the Ubuntu repositories. Security patches especially — Ubuntu supersedes old versions quickly. For major upgrade rollbacks, a full system snapshot (Timeshift, LVM snapshot, VM checkpoint) is the right tool. history-rollback works best for targeted changes you catch early.

Where does APT 3.2 store its history database?

The legacy text log at /var/log/apt/history.log is still written and still readable. APT 3.2's structured transaction database — the one that history-list reads from — lives under /var/lib/apt/. Check the APT man page (man apt) on your 26.04 system for the exact filename if you need to back it up or inspect it directly.

How far back does the apt history go?

From the first APT 3.2 operation on that system — so from your Ubuntu 26.04 install date, or the first apt run after upgrading to 26.04. History from Ubuntu 24.04 or earlier doesn't carry over.

Does apt history track snap or flatpak installs?

No. Only packages managed through APT — standard .deb packages from your configured repositories. Snap, Flatpak, and packages installed manually with dpkg -i are all outside APT's transaction log.