Results 1 to 9 of 9

Thread: apt hell rollback

  1. #1
    Join Date
    Feb 2015
    Beans
    32

    apt hell rollback

    Hi all, a couple of days ago I managed to install guitarpro6 (a 32bit release) on a amd64 xenial os following this reddit post. I did a favour to a friend, unfortunately the program isn't mine and the filesystem of the host hasn't snapshot capacity Now I'm wondering what to do if a future upgrade will break the required dependencies. What is the best strategy to save the current status before / rollback a future upgrade?
    I read about apt-clone or using the dpkg log to undo the updated package, but I'm not sure if it's the right/simpler way, I'm also wondering if I should take a look to puppet or ansible.
    Surely I need to review aptitude, apt, dpkg documentation, anyway I'd like to have also your opinions.

    Regards

    Luca
    Last edited by luca31; February 12th, 2018 at 02:35 PM.

  2. #2
    Join Date
    Dec 2017
    Location
    RockyMts
    Beans
    1,167

    Re: apt hell rollback

    You really don't want the entire system not updating, stopping security and other fixes. Lock the individual packages using Synaptic Package Manager.

    https://askubuntu.com/questions/2706...being-upgraded

  3. #3
    Join Date
    Feb 2015
    Beans
    32

    Re: apt hell rollback

    Yes but I'd like to try a complete upgrade and if it broke the dependencies I would like to rollback and tweak the necessary pinning. I also thought to dump the entire filesystem with dd or use a backup software like amanda but they seems drastic solutions.. I would prefer to use package manager tools to get the rollback done if possible.
    Last edited by luca31; February 13th, 2018 at 02:23 AM.

  4. #4
    Join Date
    Dec 2017
    Location
    RockyMts
    Beans
    1,167

    Re: apt hell rollback

    Just do a simulated run and see what happens.

    First update:
    Code:
    sudo apt-get update
    Then upgrade:
    Code:
    sudo apt-get -s upgrade
    Using the "-s" switch:
    No action; perform a simulation of events that would occur based on the current system state but do not actually change the system.

    Look it up:
    Code:
    man apt-get

  5. #5
    Join Date
    Feb 2015
    Beans
    32

    Re: apt hell rollback

    Uh thanks for the hint, the option -s seems really useful to keep in mind. Anyway I copied the program manually following a tutorial... not my play, I mean, I opened the deb archive, copied specific files, launched the program and installed a set of missing i386 libreries whenever I got an error. I'm sure a specific version of zlib and libcrypto is required so I can avoid those upgrade but I don't know if other libreries could be problematic, but I presume the package manager wouldn't complain to overwrite them. I think the only way is installing it and downgrade in case of problem. A rollback solution ready would be comforting.. Sorry for my English
    Last edited by luca31; February 13th, 2018 at 12:15 PM.

  6. #6
    Join Date
    Dec 2017
    Location
    RockyMts
    Beans
    1,167

    Re: apt hell rollback

    dpkg-repack creates a .deb file out of a package that has already been installed.

    http://manpages.ubuntu.com/manpages/...-repack.1.html

    https://askubuntu.com/questions/3095...alled-packages

  7. #7
    Join Date
    Aug 2016
    Location
    Wandering
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: apt hell rollback

    Along with the good advice you have been given by cruzer001.
    Warning have good back ups in place before going forward>
    The short answer - you could use the following command:
    Code:
    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:

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

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

    Code:
    apt-history rollback > rollback.txt
    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):
    Code:
    apt-get -s install $(cat rollback.txt | tr '\n' ' ')
    Now without the safety net:
    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 ..."
    My script used is:
    Code:
    function apt-history(){
        case "$1" in
          install)
                cat /var/log/dpkg.log | grep 'install '
                ;;
          upgrade|remove)
                cat /var/log/dpkg.log | grep $1
                ;;
          rollback)
                cat /var/log/dpkg.log | grep upgrade | \
                    grep "$2" -A10000000 | \
                    grep "$3" -B10000000 | \
                    awk '{print $4"="$5}'
                ;;
          *)
                cat /var/log/dpkg.log
                ;;
        esac
    }
    Fair warning again BACKUPS BACKUPS BACKUPS Prevention is 90% of the cure.
    Last edited by 1fallen; February 13th, 2018 at 05:27 PM. Reason: fixed code
    With realization of one's own potential and self-confidence in one's ability, one can build a better world.
    Dalai Lama>>
    Code Tags | System-info | Forum Guide lines | Arch Linux, Debian Unstable, FreeBSD

  8. #8
    Join Date
    Dec 2017
    Location
    RockyMts
    Beans
    1,167

    Re: apt hell rollback

    ^^^+1 - an excellent post^^
    Last edited by cruzer001; February 13th, 2018 at 05:59 PM.

  9. #9
    Join Date
    Feb 2015
    Beans
    32

    Re: apt hell rollback

    The arguments $2 and $3 of the apt-history function are meant to contain dates to filter out upgrades in a specific period, right?
    Sorry for the late answer, I was out of town
    You rock, guys

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •