ubunt Could not open lock file/var/lib/dpkg/lock的解决办法

l2qq · 2020-04-16 15:55
字数 3136 评论 0 收藏 0 点赞 0

ubunt Could not open lock file/var/lib/dpkg/lock的解决办法?

在ubuntu系统中利用apt-get install something的时候,有时候会出现无法获得锁的权限问题。这是因为有另外一个进程在占用锁。类似以下的错误提示:

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
ubuntu@VM-0-5-ubuntu:~$ apt-get upgrade -y
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

解决办法:

sudo rm -rf /var/lib/dpkg/lock
sudo rm -rf /var/cache/apt/archives/lock
sudo apt-get update
sudo dpkg --configure -a

运行以上四条命令即可

安装git提示

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

原因:

输入命令: apt-get install git后提示权限不够


解决方法,在命令前加 sudo即可

sudo apt-get install git


最新评论 0