[转]解决ubuntu16.04 ‘E: 没法得到锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用) ’ 问题

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

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

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?  

出现这个问题的缘由多是:bash

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

因此,第一种方法,咱们只须要杀死以前的进程,释放系统锁就能够了:ui

ps -e|grep apt-get  

显示.net

6965 ? 00:00:01 apt-get  

而后执行blog

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资源

相关文章
相关标签/搜索