Debian : Resume apt-get after SSH timeout

By | July 17, 2013

Your SSH connection get cut or timeout while you were either updating or installing an application with apt-get? Don’t worry, these easy steps will get you out of trouble!

1. Try to run your command again :

root@server:~# apt-get install <app_name>
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?

2. Okay, the process is locked, find out the process ID :

ps -A | grep apt-get
0000 pts/0 00:00:00 apt-get

3. KILL IT, the hard way :

kill -9 <0000>

(replace <0000> with the the process ID)

4. Run your command again :

root@server:~# apt-get install <app_name>
E: dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a’ to correct the problem.

Just do :

sudo dpkg –configure -a