错误笔记: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration di

alexander@alexander-virtual-machine:~$ sudo apt-get install -y httpd
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?

解决方案:

其实这是因为有另外一个程序在运行,导致锁不可用。原因可能是上次运行更新或安装没有正常完成。解决办法是杀死此进程
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

但是这样不能解决问题:可能还会出现问题,解决方案:

1,sudo dpkg –configure -a

2,sudo apt-get update