参考博客:https://blog.csdn.net/shimadear/article/details/90598646

问题描述:

解决方法:

第一种情况:

进程中存在与apt相关的正在运行的进程:

首先检查是否在运行apt,apt-get相关的进程

ps aux | grep -i apt

如果存在与apt相关的正在运行的进程,kill掉进程;

sudo kill -9 <process id>   //process id 代表的是进程的名字,你需要根据自己情况写

或者直接简单粗暴的:

sudo killall apt apt-get 
如果进行完上面的步骤还是无法顺利执行apt-get 操作,则属于第二种情况:
第二种情况:
进程列表中已经没有与apt,apt-get相关的进程在运行,但依然报错,在这种情况下,产生错误的根本原因是lock file。 loack file用于防止两个或多个进程使用相同的数据。 当运行apt或apt-commands时,它会在几个地方创建lock files。 当前一个apt命令未正确终止时,lock file未被删除,因此它们会阻止任何新的apt / apt-get命令实例,比如正在执行apt-get upgrade,在执行过程中直接ctrl+c取消了该操作,很有可能就会造成这种情况。
要解决此问题,首先要删除lock file。
 
使用lsof命令获取持有lock file的进程的进程ID,依次运行如下命令:
 
lsof /var/lib/dpkg/lock

lsof /var/lib/apt/lists/lock

lsof /var/cache/apt/archives/lock

需要注意的是,以上命令执行结果如果无返回,说明没有正在运行的进程;如果返回了相应的进程,需要kill掉。

删除所有的lock file

sudo rm /var/lib/apt/lists/lock

sudo rm /var/cache/apt/archives/lock

sudo rm /var/lib/dpkg/lock

最后重新配置一下dpkg:

sudo dpkg --configure -a

报错

执行配置命令时可能会出现以下错误:

dpkg: error: dpkg frontend is locked by another process

这需要我们额外进行一些操作:

找出正在锁定lock file的进程:

lsof /var/lib/dpkg/lock-frontend

kill掉输出的进程(如果输出为空则忽略)

sudo kill -9 PID

删除lock file并重新配置dpkg:

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

sudo dpkg --configure -a

我之前是用的虚拟机报的错,这些方法都试过了。安装软件还是报这个错。就直接重启就完事了。。。。。(太尴尬了)

Ubuntu中Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend)问题的解决的更多相关文章

  1. 解决Ubuntu中Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another proce...

    解决Ubuntu中Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another proce... ...

  2. ubuntu 报错E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unav E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process us

    1.配置xshell,查看虚拟机中ubuntu中网络ip ifconfig 报错 Command 'ifconfig' not found, but can be installed with: su ...

  3. E: could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporary unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it

    1. 问题详细提示如下: E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarly unava ...

  4. Ubuntu中针对问题 E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)的解决方案

    一.问题描述: 在ubuntu中有时因为错误的操作,而导致在执行 sudo apt-get install xxxx出现如下错误: E: Could not get lock /var/lib/dpk ...

  5. 关于Ubuntu中Could not get lock /var/lib/dpkg/lock解决方案

    在Ubuntu中,有时候运用sudo  apt-get install 安装软件时,会出现一下的情况 E: Could not get lock /var/lib/dpkg/lock - open ( ...

  6. VMwareWorkstations中安装ubuntu,apt install报E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)

    ubuntu中apt安装软件python时报: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily un ...

  7. 关于Ubuntu 16.04中E: Could not get lock /var/lib/dpkg/lock - open的三种解决方案

    问题 在Ubuntu中,有时候运用sudo  apt-get install 安装软件时,会出现如下的情况: E: Could not get lock /var/lib/dpkg/lock - op ...

  8. 23. 关于Ubuntu中Could not get lock /var/lib/dpkg/lock解决方案

    原文:https://blog.csdn.net/u011596455/article/details/60322568 版权声明:本文为博主原创文章,转载请附上博文链接! 在Ubuntu中,有时候运 ...

  9. Ubuntu中出现“Could not get lock /var/lib/dpkg/lock”的解决方法

    在运行Ubuntu安装软件,使用命令sudo  apt-get install时,有时会出现以下的错误: E: Could not get lock /var/lib/dpkg/lock - open ...

随机推荐

  1. Java 在windows中配置Maven环境和阿里云镜像

    目录 1. 下载Maven 2. 配置环境变量 3. 配置镜像 4. 配置本地仓库 1. 下载Maven 官网:https://maven.apache.org/ 下载:apache-maven-3. ...

  2. memcached+magent的集群部署详细过程

    问题描述 Memcached在实现分布集群部署时, Memcached服务端的之间是没有通讯的,服务端是伪分布式,实现分布式是由客户端实现的,客户端实现了分布式算法把数据保存到不同的Memcached ...

  3. 【Spring】创建一个Spring的入门程序

    3.创建一个Spring的入门程序 简单记录 - Java EE企业级应用开发教程(Spring+Spring MVC+MyBatis)- Spring的基本应用 Spring与Spring MVC的 ...

  4. 【Linux】rsync中sending incremental file list时间优化

    每次使用rsync的时候,前面出现sending incremental file list 这句之后要等待很长时间 查了很多帖子和官方文档后,发现是-c这个选项的问题, -v, --verbose ...

  5. Oracle 10g 如何调整 sga_max_size 与 sga_target

    sga_max_size是相对于操作系统来讲的,当启动oracle时,一次性分配给oracle实例的sga不会超过sga_max_size值:而sga_target是相对于oracle这个正在运行的应 ...

  6. 在Jetbrain IDE中自定义TODO功能

    好的IDE能为开发以及学习源码带来效率的提升,今天要介绍的就是Jetbrain家族中IDE自带的TODO功能,我认为利用好它,能够大大的提升阅读源码的效率. 假设我现在需要去阅读源代码,看了半天我终于 ...

  7. 敏感信息泄露 - Pikachu

    概述: 由于后台人员的疏忽或者不当的设计,导致不应该被前端用户看到的数据被轻易的访问到. 比如:---通过访问url下的目录,可以直接列出目录下的文件列表;---输入错误的url参数后报错信息里面包含 ...

  8. MySQL增删改操作

    增删改操作 增加 看语法 1. 插入完整数据(顺序插入) 语法一: INSERT INTO 表名(字段1,字段2,字段3-字段n) VALUES(值1,值2,值3-值n); #指定字段来插入数据,插入 ...

  9. linux静态库

    库文件可以理解为别人写好的现成的代码,但是看不见源码,只提供程序入口.库又分为动态库和静态库,静态库是在编译的时候将库编译进可执行程序中,运行时不再依赖库文件,而动态库是在运行时加载,运行时需要依赖库 ...

  10. Docker逃逸

    初识Docker逃逸 - FreeBuf网络安全行业门户 https://www.freebuf.com/articles/container/242763.html