zoukankan      html  css  js  c++  java
  • [转]解决ubuntu16.04 ‘E: 无法获得锁 /var/lib/dpkg/lock-frontend

    当运行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?
    

    本人出现的现象如下:

    fanbi@ubuntu:~$/ sudo apt install npm
    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?  

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

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

    所以,第一种方法,我们只需要杀死之前的进程,释放系统锁就可以了:

    ps -e|grep apt-get  

    显示

    6965 ? 00:00:01 apt-get  

    然后执行

    sudo kill 6965

    第二种方法,强制解锁

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

    ————————————————
    版权声明:本文为CSDN博主「CLAY-Z」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/qq_38019633/article/details/84024309

  • 相关阅读:
    笔记12:maven项目管理工具
    笔记11:Oracle基础
    笔记10:springMVC
    笔记9:spring
    笔记8:mybatis
    Bad Sequence
    Optimal Currency Exchange
    Two Small Strings
    Equalizing by Division (easy version)&&(hard version)
    Codeforce 1096:D. Easy Problem(DP,思维)
  • 原文地址:https://www.cnblogs.com/fanbi/p/11506555.html
Copyright © 2011-2022 走看看