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?
Best Answer
You can
kill
apt-get and simply run it again after runningdpkg --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.