【问题标题】:E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? raspberry piE: 无法锁定管理目录 (/var/lib/dpkg/),你是 root 吗?树莓派
【发布时间】:2018-07-20 09:37:04
【问题描述】:

我正在尝试在树莓派 3 中安装 nginx。 当我运行“sudo apt-get update”命令时,出现以下错误。

W: 无法读取 /etc/apt/apt.conf.d/ - DirectoryExists (2: 没有这样的文件或目录) W:无法读取 /etc/apt/sources.list.d/ - DirectoryExists(2:没有这样的文件或目录) W:无法读取 /etc/apt/sources.list - RealFileExists(2:没有这样的文件或目录) E: 无法打开锁定文件 /var/lib/dpkg/lock - open (2: 没有这样的文件或目录) E: 无法锁定管理目录(/var/lib/dpkg/),你是root吗?

我不知道确切的问题是什么。 请帮帮我。提前致谢!

【问题讨论】:

    标签: nginx raspberry-pi directory apt dpkg


    【解决方案1】:

    我认为错误消息已经可以解释问题所在

    W: Unable to read /etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory) 
    W: Unable to read /etc/apt/sources.list.d/ - DirectoryExists (2: No such file or directory) 
    W: Unable to read /etc/apt/sources.list - RealFileExists (2: No such file or directory) 
    E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory) 
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
    

    当对应的目录不存在或无法访问时弹出前三行(供参考:https://askubuntu.com/questions/1031891/unable-to-read-etc-apt-apt-conf-d-directoryexists-2-no-such-file-or-direct

    当 /var/lib/dpkg 不存在或无法访问 https://askubuntu.com/questions/223484/permission-denied-are-you-root 时,会弹出最后两行。

    在最坏的情况下,您会意外删除一些重要目录。

    另一种选择是 sudo 根本不起作用 - 然后您将以非特权用户身份执行该命令,并最终得到您当前拥有的错误消息。

    【讨论】:

      猜你喜欢
      • 2022-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-30
      • 2021-01-12
      • 1970-01-01
      相关资源
      最近更新 更多