Could not get lock /var/lib/dpkg/lock-frontend解决

Posted lgjlife

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Could not get lock /var/lib/dpkg/lock-frontend解决相关的知识,希望对你有一定的参考价值。

 

在安装软件包时如果出现Could not get lock /var/lib/dpkg/lock-frontend,说明之前使用apt时出现异常,没有正常关闭,还在运行。

[email protected]:~$ sudo apt-get install alien
[sudo] password for lgj: 
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?

解决,使用ps 和 grep查找apt的pid,并使用kill杀死掉。

[email protected]:~$  ps afx|grep apt
16214 ?        S      0:00  \_ sudo apt install rpm
16215 ?        S      0:01  |   \_ apt install rpm
16721 pts/3    S+     0:00          \_ grep --color=auto apt
[email protected]-Lenovo-G470:~$ kill 16214
bash: kill: (16214) - Operation not permitted
[email protected]-Lenovo-G470:~$ sudo kill 16214
[email protected]-Lenovo-G470:~$ sudo kill 16215

执行安装指令

[email protected]:~$ sudo apt-get install alien
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?

 

  如果仍然出现,需要手动删除 /var/lib/dpkg/lock即可。

[email protected]:~$ rm -rf /var/lib/dpkg/lock

 

以上是关于Could not get lock /var/lib/dpkg/lock-frontend解决的主要内容,如果未能解决你的问题,请参考以下文章

E: Could not get lock /var/lib/dpkg/lock

could not get lock /var/lib/dpkg/lock

解决:E: Could not get lock /var/lib/dpkg/lock

UBUNTU Could not get lock /var/lib/apt/lists/lock

Could not get lock /var/lib/dpkg/lock的解决方法

linux 遇见错误Could not get lock /var/lib/dpkg/lock