Unable to acquire the dpkg frontend lock

时间:2019-08-18
本文章向大家介绍Unable to acquire the dpkg frontend lock,主要包括Unable to acquire the dpkg frontend lock使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

当运行sudo apt-get install/update/其他命令时,会出现如下提示:

E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

出现这个问题的原因可能是:

在ubuntu系统的termial下,用apt-get install 安装软件的时候,如果在未完成下载的情况下将terminal close。此时 apt-get进程可能没有结束。结果,如果再次运行apt-get install 命令安装软件时,出现如上错误。即有另一个程序正在占用apt-get install进程,由于它在运行时,会占用软件源更新时的系统锁(简称‘系统更新锁’),此时资源被锁。

我们只需要杀死之前的进程,释放系统锁就可以了:

ps -A|grep apt
显示

921 ? 00:00:01 apt
然后执行

sudo kill 921
————————————————
ps -A 显示所有进程,

grep apt 查找包含字符apt的进程

wczlinux@ubuntu:~/test$ sudo apt install gcc
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?
wczlinux@ubuntu:~/test$ ps -A|grep apt
   921 ?        00:00:00 apt.systemd.dai
   961 ?        00:00:00 apt.systemd.dai
wczlinux@ubuntu:~/test$ sudo kill 921
wczlinux@ubuntu:~/test$ sudo kill 961
kill: (961): No such process
wczlinux@ubuntu:~/test$ gcc

原文地址:https://www.cnblogs.com/chenzhong-w/p/11371870.html