再进服务器使用apt-get安装时会出现


E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

错误

网上说是:

sudo dpkg --clear-avail

使用后,会报

dpkg: error: dpkg status database is locked by another process

错误,这时候要使用

sudo rm /var/lib/dpkg/lock

然后再使用

sudo dpkg --clear-avail

再运行apt-get时会出现

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

运行

sudo dpkg --configure -a

到这里如果之前下载的安装包没有出错,会接着安装

E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)

E: Unable to lock directory /var/cache/apt/archives/

报了上边的错,处理办法是:

sudo rm -rf /var/cache/apt/archives/lock
sudo apt-get update

如果报了

dpkg: error: parsing file '/var/lib/dpkg/updates/0006' near line 0: newline in field name `#padding'

错误,也是

sudo dpkg --clear-avail

如果是下边错误

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

则,删除

sudo rm -r /var/cache/debconf/*.dat