找回密码
 注册
查看: 5465|回復: 0

[教程分享] Linux常见错误之Could not get lock /var/lib/dpkg/lock - open

[複製鏈接]
LinuxIDC 發表於 2017-6-11 09:35:11 | 顯示全部樓層 |閱讀模式
Linux常见错误之Could not get lock /var/lib/dpkg/lock - open
在Ubuntu系统上安装vim是遇到的问题:

root@ubuntu:/# vim
The program 'vim' can be found in the following packages:
* vim
* vim-gnome
* vim-tiny
* vim-athena
* vim-athena-py2
* vim-gnome-py2
* vim-gtk
* vim-gtk-py2
* vim-gtk3
* vim-gtk3-py2
* vim-nox
* vim-nox-py2
Try: apt install <selected package>
root@ubuntu:/# apt install vim
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?
root@ubuntu:/#

出现这个问题可能是有另外一个程序正在运行,导致资源被锁不可用。而导致资源被锁的原因可能是上次运行安装或更新时没有正常完成,进而出现此状况,解决的办法其实很简单:
在终端输入以下两句命令:
root@ubuntu:/# sudo rm /var/cache/apt/archives/lock
root@ubuntu:/# sudo rm /var/lib/dpkg/lock
执行之后即可再次安装vim文本编辑器了。
您需要登錄後才可以回帖 登录 | 注册

本版積分規則

手机版|小黑屋|Linux公社论坛

GMT+8, 2024-5-23 12:13 , Processed in 0.062500 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表