检查 apt-get 更新锁文件

检查 apt-get 更新锁文件

apt-get update我在 Windows 上安装了双启动,现在我在输入时无法检查apt-get update结果。我不知道该怎么办

$ apt-get update  
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)  
E: Unable to lock directory /var/lib/apt/lists/  
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)  
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?  

$ apt-get upgrade  
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)  
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?  

答案1

你尝试过sudo在命令前面加上吗?像这样:

sudo apt-get update
sudo apt-get upgrade

这对于每个 apt 命令都是必需的,除了 apt-cache 之外。

sudo命令将暂时将您的权限设置为root 用户,这对于某些程序来说是必要的。

答案2

打开终端并运行以下命令:

sudo rm /var/lib/dpkg/lock
sudo apt-get update
sudo apt-get upgrade 

相关内容