debian用apt-get install安装时报错Could not get lock /var/lib/dpkg/lock

这是我在安装apache时遇到的问题,敲apt-get install apache2,就报错下面的内容

root@fff:~# apt-get install apache2
E: Could not get lock /var/lib/dpkg/lock-frontend – open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

E:无法获得锁/ var / lib / dpkg / lock-frontend-打开(11:资源暂时不可用)
E:无法获取dpkg前端锁(/ var / lib / dpkg / lock-frontend),是否正在使用另一个进程?

用rm命令删除

rm /var/cache/apt/archives/lock

rm /var/lib/dpkg/lock

经测试,这两条命令下去了,再安装,还是报错

root@fff:~# rm /var/cache/apt/archives/lock
root@fff:~# rm /var/lib/dpkg/lock
root@fff:~# apt-get install apache2      安装了报错
E: Could not get lock /var/lib/dpkg/lock-frontend – open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
root@fff:~# rm /var/lib/dpkg/lock-frontend      然后又来一道命令

root@fff:~# apt-get install apache2               再安装
E: dpkg was interrupted, you must manually run ‘dpkg –configure -a’ to correct the problem.
root@fff:~# dpkg –configure -a       这次可以了
root@fff:~# apt-get install apache2    成功
Reading package lists… Done
Building dependency tree
Reading state information… Done
apache2 is already the newest version (2.4.25-3+deb9u9).
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y

以上只是个人实测的一个笔记

版权声明:
作者:ivpsr.com
链接:https://ivpsr.com/266.html
来源:VPS部落
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>