我sudo apt update
在终端中运行了等等,然后出现了这个错误。我无法复制和粘贴这个错误代码,所以我想知道问题可能出在哪里。是权限问题还是其他问题?
An error occurred, please run Package Manager from the right-click menu
or apt-get in a terminal to see what is wrong
错误信息:
Error: Opening the cache (E:can not open /var/lib/apt/lists/download.docker.com linux_ubuntu_dists_focal InRelease
- fopen (13: Permission denied),
E:The package lists or status file could not be parsed or opened.
This usually means that your installed packages have unmet dependencies.
答案1
我从一些旧帖子中找到了一个旧答案,只需运行以下命令:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
它对我有用!
答案2
我遇到的问题是(出于某种原因)错误消息中特定文件的权限设置为 600,而所有者是 _apt:root
我将其更改为 644 root:root,它与该目录中的其余文件匹配,并且成功了。(使用问题文件名)我所做的是:
sudo chown root:root /var/lib/apt/lists//var/lib/apt/lists/download.docker.com_linux_ubuntu_dists_focal_InRelease
sudo chmod 644 /var/lib/apt/lists//var/lib/apt/lists/download.docker.com_linux_ubuntu_dists_focal_InRelease
我不确定将所有者保留为 _apt 是否更正确,但我想发生这种情况是因为我通常以 root 身份从终端运行更新命令,而不是允许软件更新程序运行它,所以这可能会影响权限。