{"id":5505,"date":"2026-04-09T03:22:48","date_gmt":"2026-04-09T10:22:48","guid":{"rendered":"https:\/\/catbradley.io\/?p=5505"},"modified":"2026-04-09T03:22:48","modified_gmt":"2026-04-09T10:22:48","slug":"i-tried-apt-commands-new-rollback-feature-heres-how-it-went","status":"publish","type":"post","link":"https:\/\/catbradley.io\/?p=5505","title":{"rendered":"I Tried Apt Command&#x27;s New Rollback Feature \u2014 Here\u2019s How It Went"},"content":{"rendered":"<p><a href=\"https:\/\/itsfoss.com\/apt-command-guide\/\">APT<\/a>, or <em>Advanced Package Tool<\/em>, is the package manager on Debian and its derivatives like <em>Ubuntu<\/em>, <em>Linux Mint<\/em>, and <em>elementary OS<\/em>. On these, if you want to install something, remove it, or update the whole system, you do it via APT.<\/p>\n<p>It has been around for decades, and if you are on a <a href=\"https:\/\/itsfoss.com\/debian-based-distros\/\">Debian-based distro<\/a>, then you have almost certainly used it without giving it much thought. That said, it has seen active development in the last couple of years.<\/p>\n<p>We covered the <a href=\"https:\/\/itsfoss.com\/news\/apt-3-release\/\">APT 3.0<\/a> release this time last year, which kicked off the 3.x series with a colorful new output format, the <a href=\"https:\/\/blog.jak-linux.org\/2024\/05\/14\/solver3\/?ref=itsfoss.com\">Solver3<\/a> dependency resolver, a switch from GnuTLS\/GnuPG to OpenSSL, and Sequoia for cryptographic operations.<\/p>\n<p>The 3.1.x cycle that followed has now closed out with <a href=\"https:\/\/tracker.debian.org\/media\/packages\/a\/apt\/changelog-3.2.0\">APT 3.2<\/a> <strong>as the stable release<\/strong>, and it brings some notable changes with it.<\/p>\n<h2>What do you get with Apt 3.2?<\/h2>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/itsfoss.com\/content\/images\/2026\/04\/apt-3-2-help-command.png\" class=\"kg-image\" alt=\"a terminal window that shows the output to apt --help, we have the version numbers, a brief description of apt, and a list of the most used apt commands\" loading=\"lazy\" width=\"910\" height=\"668\" \/><\/figure>\n<p>The biggest additions with this release are <strong>transaction history with rollback support<\/strong>, <strong>some new commands<\/strong>, and per-repository package filtering.<\/p>\n<p>APT now keeps a log of every package install, upgrade, and removal. You can view the full list with <code>apt history-list<\/code>, which shows all past operations with an ID assigned to each. To see exactly what packages were affected in a specific operation, you can use <code>apt history-info &lt;ID&gt;<\/code>.<\/p>\n<p>From there, <code>apt history-undo &lt;ID&gt;<\/code> <strong>can be used to reverse a specific operation<\/strong>, reinstalling removed packages or removing installed ones as needed. If you<strong> undo something mistakenly<\/strong> and want it back, run <code>apt history-redo &lt;ID&gt;<\/code> to reapply it. <\/p>\n<p>For cases where you want to revert everything back to the state at a particular point, <code>apt history-rollback &lt;ID&gt;<\/code> does that by undoing all operations that happened after the specified ID. Use this with care, as it makes a permanent change.<\/p>\n<p><code>apt why<\/code> and <code>apt why-not<\/code> are another set of new additions that let you trace the dependency chain behind a package. Run <code>apt why &lt;package&gt;<\/code> and APT will tell you exactly what pulled it onto your system. Run <code>apt why-not &lt;package&gt;<\/code> and it will tell you why it is not installed.<\/p>\n<p>Similarly, <code>Include<\/code> and <code>Exclude<\/code> are two new options that let you limit which packages APT uses from a specific repository. Include restricts a repo to only the packages you specify, and Exclude removes specific packages from a repo entirely.<\/p>\n<p>Solver3, which shipped as opt-in with APT 3.0, <strong>is now on by default<\/strong>. It also gains the ability to upgrade packages by source package, so all binaries from the same source are upgraded together.<\/p>\n<p>Additionally, your system will no longer go to sleep while <code>dpkg<\/code> is running mid-install and JSONL performance counter logging is also in, though that is mostly useful for developers.<\/p>\n<p>If all of that&#8217;s got you interested, then you can try Apt 3.2 on a <a href=\"https:\/\/wiki.debian.org\/DebianUnstable\">Debian Sid<\/a> installation as I did below or wait for the <a href=\"https:\/\/itsfoss.com\/ubuntu-26-04-release-features\/\">Ubuntu 26.04 LTS<\/a> release, which is reportedly shipping it.<\/p>\n<h2>How to use rollback on Apt?<\/h2>\n<figure class=\"kg-card kg-embed-card kg-card-hascaption\"><figcaption>\n<p><i><em class=\"italic\">I almost got lost in the labyrinth of Vim, unable to exit.<\/em><\/i><\/p>\n<\/figcaption><\/figure>\n<p>After installing some new programs using APT, I tested a few commands to see how rollback and redoing transactions worked. First, I ran <code>sudo apt history-list<\/code> in the terminal and entered my password to authorize the command.<\/p>\n<p>The output was a list of APT transactions that included the preparatory work I had done to switch to Debian Sid from Stable, as well as the two install commands to get <a href=\"https:\/\/itsfoss.com\/tag\/vim\/\">Vim<\/a> and <a href=\"https:\/\/itsfoss.com\/nala\/\">Nala<\/a> installed.<\/p>\n<p>Next, I ran <code>sudo apt history-info 4<\/code>, the number being the ID of the transaction, and I was shown all the key details related to it, such as the start\/end time, requested by which user, the command used, and packages changed.<\/p>\n<p>After that, I ran <code>sudo apt history-undo 4<\/code> to revert the Vim installation and <code>sudo apt history-redo 4<\/code> to restore the installation; both of these commands worked as advertised.<\/p>\n<p>Finally, I tested <code>sudo apt history-rollback 3<\/code> to get rid of Nala, and the process was just about the same as before, with me being asked to confirm changes by typing &#8220;<em>Y<\/em>&#8220;.<\/p>\n<p><strong>When I tried to run <code>apt history-redo<\/code> for this one, the execution failed as expected.<\/strong><\/p>\n<hr \/>\n<p>\ud83d\udcac <em>Do these new additions look useful to you? Can&#8217;t be bothered? Let me know below!<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/feed.itsfoss.com\/link\/24361\/17316349.gif\" height=\"1\" width=\"1\" \/><\/p>","protected":false},"excerpt":{"rendered":"<p>APT, or Advanced Package Tool, is the package manager on Debian and its derivatives like Ubuntu, Linux Mint, and elementary OS. On these, if you want to install something, remove&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5505","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rss"],"_links":{"self":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts\/5505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5505"}],"version-history":[{"count":0,"href":"https:\/\/catbradley.io\/index.php?rest_route=\/wp\/v2\/posts\/5505\/revisions"}],"wp:attachment":[{"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/catbradley.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}