How to resume or abandon an apt-get dist-upgrade after connection reset?

12,454

You can kill apt-get and simply run it again after running dpkg --configure --pending to configure previously already installed packages.

If you are unable to continue because the system is broken, you could try to fix it with apt-get: apt-get --fix-broken install

See a similar question over at Unix & Linux, https://unix.stackexchange.com/questions/46534/how-to-safely-resume-an-aptitude-dist-upgrade-after-ssh-timeout.

Share:
12,454

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    In the middle of a "sudo apt-get dist-upgrade" on my Raspberry Pi, while waiting for user input, my ssh connection got reset. I was not running in a screen. The last few lines looked like this:

    Installing new version of config file /etc/init.d/procps ...
    
    Configuration file '/etc/sysctl.conf'
     ==> Modified (by you or by a script) since installation.
     ==> Package distributor has shipped an updated version.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
     The default action is to keep your current version.
    *** sysctl.conf (Y/I/N/O/D/Z) [default=N] ? Connection reset by <ip>
    

    "ps" still shows the old apt-get process running...

    $ ps -aux | grep apt
    root      2375  0.0  0.3   6008  1636 ?        S    03:03   0:00 sudo apt-get dist-upgrade
    root      2376  0.0  6.2  33428 27872 ?        S    03:03   0:18 apt-get dist-upgrade
    

    I've got 1.1G in /var/cache/apt/archives, and can't successfully try a new attempt to apt-get dist-upgrade.

    $ sudo apt-get dist-upgrade
    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
    

    What should I do now? Any way to resume the dist-upgrade in progress? If not, what's a good way to back out and try again?