热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Couldnotgetlock/var/lib/dpkg/lockfrontend

在安装软件包时如果出现Couldnotgetlockvarlibdpkglock-frontend,说明之前使用apt时出现异常,没有正常关闭ÿ

 

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

lgj@lgj-Lenovo-G470:~$ 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杀死掉。

lgj@lgj-Lenovo-G470:~$ 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
lgj@lgj-Lenovo-G470:~$ kill 16214
bash: kill: (16214) - Operation not permitted
lgj@lgj-Lenovo-G470:~$ sudo kill 16214
lgj@lgj-Lenovo-G470:~$ sudo kill 16215

 

执行安装指令

lgj@lgj-Lenovo-G470:~$ 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即可。

sudo rm -rf /var/lib/dpkg/lock

sudo rm -rf /var/lib/dpkg/lock-frontend


推荐阅读
author-avatar
Mars丶fasfa
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有