Can I rollback an apt-get upgrade if something goes wrong? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsDKMS stuck while installing new kernel, what shall I do?Is there any way to easily revert apt-get upgrades to previous 'snapshot'APT source.list issueapt-get won't install: dpkg: files list for package 'gnome-themes-standard-data' is not a regular fileWhen and why should I use apt-get update?Debian installs new, non depended on packagesHow to run a command before download with apt-get?Set apt-get options to tolerate harmless 'dpkg --force-conflicts' kludge?Can't upgrade packagesdebian unstable and apt upgrade policies with installed experimental packagesCleaner way to detect if a particular package was installed in apt-get hook?Debian testing added to sources.list, how to undo the upgrades?

Can each chord in a progression create its own key?

Python - Fishing Simulator

Working through the single responsibility principle (SRP) in Python when calls are expensive

Are there continuous functions who are the same in an interval but differ in at least one other point?

Can a flute soloist sit?

What happens to a Warlock's expended Spell Slots when they gain a Level?

Do ℕ, mathbbN, BbbN, symbbN effectively differ, and is there a "canonical" specification of the naturals?

How to determine omitted units in a publication

How to support a colleague who finds meetings extremely tiring?

different output for groups and groups USERNAME after adding a username to a group

Why are PDP-7-style microprogrammed instructions out of vogue?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Is 'stolen' appropriate word?

Circular reasoning in L'Hopital's rule

Do warforged have souls?

Am I ethically obligated to go into work on an off day if the reason is sudden?

how can a perfect fourth interval be considered either consonant or dissonant?

One-dimensional Japanese puzzle

How to read αἱμύλιος or when to aspirate

What was the last x86 CPU that did not have the x87 floating-point unit built in?

Can we generate random numbers using irrational numbers like π and e?

Was credit for the black hole image misappropriated?

Do working physicists consider Newtonian mechanics to be "falsified"?

Why not take a picture of a closer black hole?



Can I rollback an apt-get upgrade if something goes wrong?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election ResultsDKMS stuck while installing new kernel, what shall I do?Is there any way to easily revert apt-get upgrades to previous 'snapshot'APT source.list issueapt-get won't install: dpkg: files list for package 'gnome-themes-standard-data' is not a regular fileWhen and why should I use apt-get update?Debian installs new, non depended on packagesHow to run a command before download with apt-get?Set apt-get options to tolerate harmless 'dpkg --force-conflicts' kludge?Can't upgrade packagesdebian unstable and apt upgrade policies with installed experimental packagesCleaner way to detect if a particular package was installed in apt-get hook?Debian testing added to sources.list, how to undo the upgrades?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








46















Is there a way, before starting an aptitude upgrade or apt-get upgrade, to set up something so that you can "easily" rollback your system to the "apt" state it was before the actual upgrade, if something goes wrong?



That is, for example, reinstall the old version of the packages that were upgraded during the process.



(EDIT) A few hints: I know that etckeeper for example uses some hook on apt so that it is notified whenever apt installs or uninstalls a package. I suppose there could be some kind of script that could save the list of newly installed package and their previous version number to be able to reinstall them from the apt cache (/var/cache/apt/archives). There is also checkinstall which can keep track of file modifications...



Any details on how to achieve that properly?










share|improve this question
























  • I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

    – Anthon
    Jun 11 '13 at 19:00

















46















Is there a way, before starting an aptitude upgrade or apt-get upgrade, to set up something so that you can "easily" rollback your system to the "apt" state it was before the actual upgrade, if something goes wrong?



That is, for example, reinstall the old version of the packages that were upgraded during the process.



(EDIT) A few hints: I know that etckeeper for example uses some hook on apt so that it is notified whenever apt installs or uninstalls a package. I suppose there could be some kind of script that could save the list of newly installed package and their previous version number to be able to reinstall them from the apt cache (/var/cache/apt/archives). There is also checkinstall which can keep track of file modifications...



Any details on how to achieve that properly?










share|improve this question
























  • I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

    – Anthon
    Jun 11 '13 at 19:00













46












46








46


20






Is there a way, before starting an aptitude upgrade or apt-get upgrade, to set up something so that you can "easily" rollback your system to the "apt" state it was before the actual upgrade, if something goes wrong?



That is, for example, reinstall the old version of the packages that were upgraded during the process.



(EDIT) A few hints: I know that etckeeper for example uses some hook on apt so that it is notified whenever apt installs or uninstalls a package. I suppose there could be some kind of script that could save the list of newly installed package and their previous version number to be able to reinstall them from the apt cache (/var/cache/apt/archives). There is also checkinstall which can keep track of file modifications...



Any details on how to achieve that properly?










share|improve this question
















Is there a way, before starting an aptitude upgrade or apt-get upgrade, to set up something so that you can "easily" rollback your system to the "apt" state it was before the actual upgrade, if something goes wrong?



That is, for example, reinstall the old version of the packages that were upgraded during the process.



(EDIT) A few hints: I know that etckeeper for example uses some hook on apt so that it is notified whenever apt installs or uninstalls a package. I suppose there could be some kind of script that could save the list of newly installed package and their previous version number to be able to reinstall them from the apt cache (/var/cache/apt/archives). There is also checkinstall which can keep track of file modifications...



Any details on how to achieve that properly?







debian package-management apt upgrade aptitude






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 12 '13 at 0:20







Totor

















asked Jun 11 '13 at 18:55









TotorTotor

8,807135281




8,807135281












  • I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

    – Anthon
    Jun 11 '13 at 19:00

















  • I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

    – Anthon
    Jun 11 '13 at 19:00
















I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

– Anthon
Jun 11 '13 at 19:00





I am not aware that apt has something like that build in, you would have to keep track of the currently installed package numbers etc. Easier IMHO just to restore yesterdays backup if necessary.

– Anthon
Jun 11 '13 at 19:00










3 Answers
3






active

oldest

votes


















40














I just now had to figure out an answer to this, because the last apt-get upgrade on a Debian server made it impossible to boot the most recent kernel beyond a busybox, failing to mount the zfs root partition. At least an older kernel could still boot, but was incompatible with other software. Thus the need for a rollback.



The short answer - you could use the following command:



$ apt-get -s install $(apt-history rollback | tr 'n' ' ')


if it does what you want remove the -s and run it again. Here are the steps I took to get this working properly:



  1. I temporarily trimmed my /var/log/dpkg.log to leave just today's upgrade



  2. I installed the tiny script apt-history from here into ~/.bashrc and ran



    $ apt-history rollback > rollback.txt
    ...
    libzfs2:amd64=0.6.4-4~wheezy
    zfsutils:amd64=0.6.4-4~wheezy
    zfs-initramfs:amd64=0.6.4-4~wheezy
    ...



  3. This provides a nicely formatted list of versioned packages to roll-back to by feeding it into apt-get install. Trim this list as needed in a text editor and then run (with -s for dry-run first):



    $ apt-get -s install $(cat rollback.txt | tr 'n' ' ')
    $ apt-get install $(cat rollback.txt | tr 'n' ' ')


Apt will warn about the downgrades which is expected. To prevent this rollback to be overwritten by the next upgrade, the packages will need to be pinned, until the original issue is resolved. For example with: apt-mark hold zfsutils libzfs2 ...




function apt-history() grep upgrade 





share|improve this answer

























  • Nice finding those resources! Great answer!

    – L0j1k
    May 25 '16 at 17:50






  • 1





    The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

    – Totor
    Jul 17 '17 at 12:18











  • With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

    – luator
    Sep 7 '18 at 9:15






  • 1





    After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

    – dps
    Sep 21 '18 at 4:33


















6














The log files /var/log/apt/history.log and /var/log/apt/term.log are the closest things available to your description:




I suppose there could be some kind of script that could save the list of newly installed package and their previous version number




history.log gives a summary list of every action that apt takes in the following format:



Start-Date: 2013-06-21 16:05:05
Commandline: apt-get install rdiff-backup
Install: python-pyxattr:i386 (0.5.0-3, automatic), rdiff-backup:i386 (1.2.8-6), python-pylibacl:i386 (0.5.0-3, automatic
), librsync1:i386 (0.9.7-7, automatic)
End-Date: 2013-06-21 16:05:42


In particular, it gives a list of newly installed packages, or of removed packages.
Additionally, term.log shows what actually appeared on the terminal during the action, so that would show the old and new versions of packages. A random sample from my history.log:



Preparing to replace gnupg 1.4.10-4 (using .../gnupg_1.4.10-4+squeeze1_i386.deb) ...
Unpacking replacement gnupg ...
Processing triggers for install-info ...
Processing triggers for man-db ...
Processing triggers for doc-base ...
Processing 1 changed doc-base file(s)...
Registering documents with scrollkeeper...
Setting up gnupg (1.4.10-4+squeeze1)


Trying to roll back apt automatically is not recommended, but if you use the logs, then it should be possible to do it manually unless the failed action has broken something that interferes with apt's actions, e.g. an inconsistent dpkg database. In that case, you will have to fix the problem before proceeding.






share|improve this answer
































    4














    No, apt doesn't make that easy.



    The best option is some type of snapshot. Either filesystem snapshots through lvm/zfs/btrfs or instance snapshots if you're using a VM of some kind.



    The only other option is to take an inventory of installed packages (dpkg -l) before and after. If you wan to "roll back" you have to explicitly install the previous version.






    share|improve this answer























    • I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

      – Csaba Toth
      Jun 27 '18 at 21:14












    • It may no longer be in the repository.

      – bahamat
      Jul 12 '18 at 0:22











    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f79050%2fcan-i-rollback-an-apt-get-upgrade-if-something-goes-wrong%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    40














    I just now had to figure out an answer to this, because the last apt-get upgrade on a Debian server made it impossible to boot the most recent kernel beyond a busybox, failing to mount the zfs root partition. At least an older kernel could still boot, but was incompatible with other software. Thus the need for a rollback.



    The short answer - you could use the following command:



    $ apt-get -s install $(apt-history rollback | tr 'n' ' ')


    if it does what you want remove the -s and run it again. Here are the steps I took to get this working properly:



    1. I temporarily trimmed my /var/log/dpkg.log to leave just today's upgrade



    2. I installed the tiny script apt-history from here into ~/.bashrc and ran



      $ apt-history rollback > rollback.txt
      ...
      libzfs2:amd64=0.6.4-4~wheezy
      zfsutils:amd64=0.6.4-4~wheezy
      zfs-initramfs:amd64=0.6.4-4~wheezy
      ...



    3. This provides a nicely formatted list of versioned packages to roll-back to by feeding it into apt-get install. Trim this list as needed in a text editor and then run (with -s for dry-run first):



      $ apt-get -s install $(cat rollback.txt | tr 'n' ' ')
      $ apt-get install $(cat rollback.txt | tr 'n' ' ')


    Apt will warn about the downgrades which is expected. To prevent this rollback to be overwritten by the next upgrade, the packages will need to be pinned, until the original issue is resolved. For example with: apt-mark hold zfsutils libzfs2 ...




    function apt-history() grep upgrade 





    share|improve this answer

























    • Nice finding those resources! Great answer!

      – L0j1k
      May 25 '16 at 17:50






    • 1





      The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

      – Totor
      Jul 17 '17 at 12:18











    • With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

      – luator
      Sep 7 '18 at 9:15






    • 1





      After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

      – dps
      Sep 21 '18 at 4:33















    40














    I just now had to figure out an answer to this, because the last apt-get upgrade on a Debian server made it impossible to boot the most recent kernel beyond a busybox, failing to mount the zfs root partition. At least an older kernel could still boot, but was incompatible with other software. Thus the need for a rollback.



    The short answer - you could use the following command:



    $ apt-get -s install $(apt-history rollback | tr 'n' ' ')


    if it does what you want remove the -s and run it again. Here are the steps I took to get this working properly:



    1. I temporarily trimmed my /var/log/dpkg.log to leave just today's upgrade



    2. I installed the tiny script apt-history from here into ~/.bashrc and ran



      $ apt-history rollback > rollback.txt
      ...
      libzfs2:amd64=0.6.4-4~wheezy
      zfsutils:amd64=0.6.4-4~wheezy
      zfs-initramfs:amd64=0.6.4-4~wheezy
      ...



    3. This provides a nicely formatted list of versioned packages to roll-back to by feeding it into apt-get install. Trim this list as needed in a text editor and then run (with -s for dry-run first):



      $ apt-get -s install $(cat rollback.txt | tr 'n' ' ')
      $ apt-get install $(cat rollback.txt | tr 'n' ' ')


    Apt will warn about the downgrades which is expected. To prevent this rollback to be overwritten by the next upgrade, the packages will need to be pinned, until the original issue is resolved. For example with: apt-mark hold zfsutils libzfs2 ...




    function apt-history() grep upgrade 





    share|improve this answer

























    • Nice finding those resources! Great answer!

      – L0j1k
      May 25 '16 at 17:50






    • 1





      The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

      – Totor
      Jul 17 '17 at 12:18











    • With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

      – luator
      Sep 7 '18 at 9:15






    • 1





      After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

      – dps
      Sep 21 '18 at 4:33













    40












    40








    40







    I just now had to figure out an answer to this, because the last apt-get upgrade on a Debian server made it impossible to boot the most recent kernel beyond a busybox, failing to mount the zfs root partition. At least an older kernel could still boot, but was incompatible with other software. Thus the need for a rollback.



    The short answer - you could use the following command:



    $ apt-get -s install $(apt-history rollback | tr 'n' ' ')


    if it does what you want remove the -s and run it again. Here are the steps I took to get this working properly:



    1. I temporarily trimmed my /var/log/dpkg.log to leave just today's upgrade



    2. I installed the tiny script apt-history from here into ~/.bashrc and ran



      $ apt-history rollback > rollback.txt
      ...
      libzfs2:amd64=0.6.4-4~wheezy
      zfsutils:amd64=0.6.4-4~wheezy
      zfs-initramfs:amd64=0.6.4-4~wheezy
      ...



    3. This provides a nicely formatted list of versioned packages to roll-back to by feeding it into apt-get install. Trim this list as needed in a text editor and then run (with -s for dry-run first):



      $ apt-get -s install $(cat rollback.txt | tr 'n' ' ')
      $ apt-get install $(cat rollback.txt | tr 'n' ' ')


    Apt will warn about the downgrades which is expected. To prevent this rollback to be overwritten by the next upgrade, the packages will need to be pinned, until the original issue is resolved. For example with: apt-mark hold zfsutils libzfs2 ...




    function apt-history() grep upgrade 





    share|improve this answer















    I just now had to figure out an answer to this, because the last apt-get upgrade on a Debian server made it impossible to boot the most recent kernel beyond a busybox, failing to mount the zfs root partition. At least an older kernel could still boot, but was incompatible with other software. Thus the need for a rollback.



    The short answer - you could use the following command:



    $ apt-get -s install $(apt-history rollback | tr 'n' ' ')


    if it does what you want remove the -s and run it again. Here are the steps I took to get this working properly:



    1. I temporarily trimmed my /var/log/dpkg.log to leave just today's upgrade



    2. I installed the tiny script apt-history from here into ~/.bashrc and ran



      $ apt-history rollback > rollback.txt
      ...
      libzfs2:amd64=0.6.4-4~wheezy
      zfsutils:amd64=0.6.4-4~wheezy
      zfs-initramfs:amd64=0.6.4-4~wheezy
      ...



    3. This provides a nicely formatted list of versioned packages to roll-back to by feeding it into apt-get install. Trim this list as needed in a text editor and then run (with -s for dry-run first):



      $ apt-get -s install $(cat rollback.txt | tr 'n' ' ')
      $ apt-get install $(cat rollback.txt | tr 'n' ' ')


    Apt will warn about the downgrades which is expected. To prevent this rollback to be overwritten by the next upgrade, the packages will need to be pinned, until the original issue is resolved. For example with: apt-mark hold zfsutils libzfs2 ...




    function apt-history() grep upgrade 






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 9 at 8:10









    fra-san

    2,1021721




    2,1021721










    answered Oct 16 '15 at 18:56









    ChrisWChrisW

    51654




    51654












    • Nice finding those resources! Great answer!

      – L0j1k
      May 25 '16 at 17:50






    • 1





      The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

      – Totor
      Jul 17 '17 at 12:18











    • With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

      – luator
      Sep 7 '18 at 9:15






    • 1





      After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

      – dps
      Sep 21 '18 at 4:33

















    • Nice finding those resources! Great answer!

      – L0j1k
      May 25 '16 at 17:50






    • 1





      The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

      – Totor
      Jul 17 '17 at 12:18











    • With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

      – luator
      Sep 7 '18 at 9:15






    • 1





      After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

      – dps
      Sep 21 '18 at 4:33
















    Nice finding those resources! Great answer!

    – L0j1k
    May 25 '16 at 17:50





    Nice finding those resources! Great answer!

    – L0j1k
    May 25 '16 at 17:50




    1




    1





    The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

    – Totor
    Jul 17 '17 at 12:18





    The apt-history rollback command can be replaced with something like awk '$3 ~ /upgrade/ print $4"="$5' dpkg.log.

    – Totor
    Jul 17 '17 at 12:18













    With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

    – luator
    Sep 7 '18 at 9:15





    With following extension, it only matches upgrades of the given date (so no need to modify the log before): awk '$1 == "2018-09-07" && $3 == "upgrade" print $4"="$5' /var/log/dpkg.log

    – luator
    Sep 7 '18 at 9:15




    1




    1





    After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

    – dps
    Sep 21 '18 at 4:33





    After trimming dpkg.log I get a bunch of version not found messages, i.e. E: Version '5.24.1-3+deb9u3' for 'libperl5.24' was not found. I'm using Debian Stretch for Raspian.

    – dps
    Sep 21 '18 at 4:33













    6














    The log files /var/log/apt/history.log and /var/log/apt/term.log are the closest things available to your description:




    I suppose there could be some kind of script that could save the list of newly installed package and their previous version number




    history.log gives a summary list of every action that apt takes in the following format:



    Start-Date: 2013-06-21 16:05:05
    Commandline: apt-get install rdiff-backup
    Install: python-pyxattr:i386 (0.5.0-3, automatic), rdiff-backup:i386 (1.2.8-6), python-pylibacl:i386 (0.5.0-3, automatic
    ), librsync1:i386 (0.9.7-7, automatic)
    End-Date: 2013-06-21 16:05:42


    In particular, it gives a list of newly installed packages, or of removed packages.
    Additionally, term.log shows what actually appeared on the terminal during the action, so that would show the old and new versions of packages. A random sample from my history.log:



    Preparing to replace gnupg 1.4.10-4 (using .../gnupg_1.4.10-4+squeeze1_i386.deb) ...
    Unpacking replacement gnupg ...
    Processing triggers for install-info ...
    Processing triggers for man-db ...
    Processing triggers for doc-base ...
    Processing 1 changed doc-base file(s)...
    Registering documents with scrollkeeper...
    Setting up gnupg (1.4.10-4+squeeze1)


    Trying to roll back apt automatically is not recommended, but if you use the logs, then it should be possible to do it manually unless the failed action has broken something that interferes with apt's actions, e.g. an inconsistent dpkg database. In that case, you will have to fix the problem before proceeding.






    share|improve this answer





























      6














      The log files /var/log/apt/history.log and /var/log/apt/term.log are the closest things available to your description:




      I suppose there could be some kind of script that could save the list of newly installed package and their previous version number




      history.log gives a summary list of every action that apt takes in the following format:



      Start-Date: 2013-06-21 16:05:05
      Commandline: apt-get install rdiff-backup
      Install: python-pyxattr:i386 (0.5.0-3, automatic), rdiff-backup:i386 (1.2.8-6), python-pylibacl:i386 (0.5.0-3, automatic
      ), librsync1:i386 (0.9.7-7, automatic)
      End-Date: 2013-06-21 16:05:42


      In particular, it gives a list of newly installed packages, or of removed packages.
      Additionally, term.log shows what actually appeared on the terminal during the action, so that would show the old and new versions of packages. A random sample from my history.log:



      Preparing to replace gnupg 1.4.10-4 (using .../gnupg_1.4.10-4+squeeze1_i386.deb) ...
      Unpacking replacement gnupg ...
      Processing triggers for install-info ...
      Processing triggers for man-db ...
      Processing triggers for doc-base ...
      Processing 1 changed doc-base file(s)...
      Registering documents with scrollkeeper...
      Setting up gnupg (1.4.10-4+squeeze1)


      Trying to roll back apt automatically is not recommended, but if you use the logs, then it should be possible to do it manually unless the failed action has broken something that interferes with apt's actions, e.g. an inconsistent dpkg database. In that case, you will have to fix the problem before proceeding.






      share|improve this answer



























        6












        6








        6







        The log files /var/log/apt/history.log and /var/log/apt/term.log are the closest things available to your description:




        I suppose there could be some kind of script that could save the list of newly installed package and their previous version number




        history.log gives a summary list of every action that apt takes in the following format:



        Start-Date: 2013-06-21 16:05:05
        Commandline: apt-get install rdiff-backup
        Install: python-pyxattr:i386 (0.5.0-3, automatic), rdiff-backup:i386 (1.2.8-6), python-pylibacl:i386 (0.5.0-3, automatic
        ), librsync1:i386 (0.9.7-7, automatic)
        End-Date: 2013-06-21 16:05:42


        In particular, it gives a list of newly installed packages, or of removed packages.
        Additionally, term.log shows what actually appeared on the terminal during the action, so that would show the old and new versions of packages. A random sample from my history.log:



        Preparing to replace gnupg 1.4.10-4 (using .../gnupg_1.4.10-4+squeeze1_i386.deb) ...
        Unpacking replacement gnupg ...
        Processing triggers for install-info ...
        Processing triggers for man-db ...
        Processing triggers for doc-base ...
        Processing 1 changed doc-base file(s)...
        Registering documents with scrollkeeper...
        Setting up gnupg (1.4.10-4+squeeze1)


        Trying to roll back apt automatically is not recommended, but if you use the logs, then it should be possible to do it manually unless the failed action has broken something that interferes with apt's actions, e.g. an inconsistent dpkg database. In that case, you will have to fix the problem before proceeding.






        share|improve this answer















        The log files /var/log/apt/history.log and /var/log/apt/term.log are the closest things available to your description:




        I suppose there could be some kind of script that could save the list of newly installed package and their previous version number




        history.log gives a summary list of every action that apt takes in the following format:



        Start-Date: 2013-06-21 16:05:05
        Commandline: apt-get install rdiff-backup
        Install: python-pyxattr:i386 (0.5.0-3, automatic), rdiff-backup:i386 (1.2.8-6), python-pylibacl:i386 (0.5.0-3, automatic
        ), librsync1:i386 (0.9.7-7, automatic)
        End-Date: 2013-06-21 16:05:42


        In particular, it gives a list of newly installed packages, or of removed packages.
        Additionally, term.log shows what actually appeared on the terminal during the action, so that would show the old and new versions of packages. A random sample from my history.log:



        Preparing to replace gnupg 1.4.10-4 (using .../gnupg_1.4.10-4+squeeze1_i386.deb) ...
        Unpacking replacement gnupg ...
        Processing triggers for install-info ...
        Processing triggers for man-db ...
        Processing triggers for doc-base ...
        Processing 1 changed doc-base file(s)...
        Registering documents with scrollkeeper...
        Setting up gnupg (1.4.10-4+squeeze1)


        Trying to roll back apt automatically is not recommended, but if you use the logs, then it should be possible to do it manually unless the failed action has broken something that interferes with apt's actions, e.g. an inconsistent dpkg database. In that case, you will have to fix the problem before proceeding.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 21 '13 at 22:25

























        answered Jun 21 '13 at 22:15









        Faheem MithaFaheem Mitha

        23.4k1885137




        23.4k1885137





















            4














            No, apt doesn't make that easy.



            The best option is some type of snapshot. Either filesystem snapshots through lvm/zfs/btrfs or instance snapshots if you're using a VM of some kind.



            The only other option is to take an inventory of installed packages (dpkg -l) before and after. If you wan to "roll back" you have to explicitly install the previous version.






            share|improve this answer























            • I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

              – Csaba Toth
              Jun 27 '18 at 21:14












            • It may no longer be in the repository.

              – bahamat
              Jul 12 '18 at 0:22















            4














            No, apt doesn't make that easy.



            The best option is some type of snapshot. Either filesystem snapshots through lvm/zfs/btrfs or instance snapshots if you're using a VM of some kind.



            The only other option is to take an inventory of installed packages (dpkg -l) before and after. If you wan to "roll back" you have to explicitly install the previous version.






            share|improve this answer























            • I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

              – Csaba Toth
              Jun 27 '18 at 21:14












            • It may no longer be in the repository.

              – bahamat
              Jul 12 '18 at 0:22













            4












            4








            4







            No, apt doesn't make that easy.



            The best option is some type of snapshot. Either filesystem snapshots through lvm/zfs/btrfs or instance snapshots if you're using a VM of some kind.



            The only other option is to take an inventory of installed packages (dpkg -l) before and after. If you wan to "roll back" you have to explicitly install the previous version.






            share|improve this answer













            No, apt doesn't make that easy.



            The best option is some type of snapshot. Either filesystem snapshots through lvm/zfs/btrfs or instance snapshots if you're using a VM of some kind.



            The only other option is to take an inventory of installed packages (dpkg -l) before and after. If you wan to "roll back" you have to explicitly install the previous version.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 11 '13 at 19:50









            bahamatbahamat

            25k15090




            25k15090












            • I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

              – Csaba Toth
              Jun 27 '18 at 21:14












            • It may no longer be in the repository.

              – bahamat
              Jul 12 '18 at 0:22

















            • I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

              – Csaba Toth
              Jun 27 '18 at 21:14












            • It may no longer be in the repository.

              – bahamat
              Jul 12 '18 at 0:22
















            I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

            – Csaba Toth
            Jun 27 '18 at 21:14






            I know the exact version, but apt refuses: apt install openssl=1.0.2g-1ubuntu4.12 results in E: Version '1.0.2g-1ubuntu4.12' for 'openssl' was not found. I just upgraded to 1.0.2g-1ubuntu4.13 and I'm wondering if that's causing some CORS/CSP problems now

            – Csaba Toth
            Jun 27 '18 at 21:14














            It may no longer be in the repository.

            – bahamat
            Jul 12 '18 at 0:22





            It may no longer be in the repository.

            – bahamat
            Jul 12 '18 at 0:22

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f79050%2fcan-i-rollback-an-apt-get-upgrade-if-something-goes-wrong%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

            Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

            Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.