Debian:在SSH超时后恢复apt-get

时间:2020-02-23 14:44:06  来源:igfitidea点击:

使用apt-get更新或者安装应用程序时,SSH连接会断开或者超时。

1.尝试再次运行命令:

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.好的,进程已锁定,找出进程ID:

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

3.杀死进程:

kill -9 <0000>

(用进程ID替换<0000>)

4.再次运行命令:

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

然后运行

sudo dpkg configure -a