apt update && apt upgrade 在 Ubuntu 22.04 上出现锁定错误

apt update && apt upgrade 在 Ubuntu 22.04 上出现锁定错误

我输入了以下命令:

$ apt update && apt upgrade

我收到错误:

Reading package lists... Done
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)

请有人指导我。

祖尔菲。

答案1

作为普通用户,您没有权限成功运行这些命令,您需要 root 权限。为此,您需要sudo在命令前面添加 -command:

$ sudo apt update && sudo apt upgrade

然后系统将提示您输入密码。

相关内容