警告:root:无法打开文件'/etc/apt

警告:root:无法打开文件'/etc/apt
vegan@vegan:~$ yo -v
WARNING:root:could not open file '/etc/apt/sources.list.d/midori-ubuntu-ppa-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/git.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/yandex-browser-beta.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/webupd8team-ubuntu-java-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/yandex-browser.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/nodesource.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/google-chrome.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/apandada1-ubuntu-brightness-controller-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/opera-stable.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/justinludwig-ubuntu-tzdata-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/maarten-baert-ubuntu-simplescreenrecorder-xenial.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/docker.list'
WARNING:root:could not open file '/etc/apt/sources.list.d/slack.list'
yo: command not found

那些来自update

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

vegan@vegan:~$ sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Ign:2 http://archive.ubuntu.com/ubuntu precise InRelease
Get:3 http://security.ubuntu.com/ubuntu precise-security InRelease [55,7 kB]
Hit:4 http://dl.google.com/linux/chrome/deb stable Release                     
Get:5 http://archive.ubuntu.com/ubuntu precise-updates InRelease [55,7 kB]       
Hit:6 https://deb.nodesource.com/node_5.x xenial InRelease                       
Hit:8 http://archive.ubuntu.com/ubuntu precise-backports InRelease               
Hit:9 http://archive.ubuntu.com/ubuntu precise Release
Fetched 111 kB in 0s (115 kB/s)
Reading package lists... Done
W: http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
W: http://archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
W: http://archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
W: http://archive.ubuntu.com/ubuntu/dists/precise/Release.gpg: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
vegan@vegan:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  tzdata-java
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

这是/etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu precise main universe restricted multiverse
deb-src http://archive.ubuntu.com/ubuntu precise universe main multiverse restricted

deb http://security.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-updates universe main multiverse restricted
deb http://archive.ubuntu.com/ubuntu precise-backports universe main multiverse restricted

# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

# deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main

这也是

    vegan@vegan:~$ ls -l /etc/apt/sources.list.d
ls: cannot access '/etc/apt/sources.list.d/nodesource.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/git.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/google-chrome.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/midori-ubuntu-ppa-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/opera-stable.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/git.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/webupd8team-ubuntu-java-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/yandex-browser.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/yandex-browser-beta.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/yandex-browser-beta.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/webupd8team-ubuntu-java-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/yandex-browser.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/nodesource.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/google-chrome.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/midori-ubuntu-ppa-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/maarten-baert-ubuntu-simplescreenrecorder-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/apandada1-ubuntu-brightness-controller-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/docker.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/opera-stable.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/justinludwig-ubuntu-tzdata-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/apandada1-ubuntu-brightness-controller-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/slack.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/notepadqq-team-ubuntu-notepadqq-xenial.list.save': Permission denied
ls: cannot access '/etc/apt/sources.list.d/justinludwig-ubuntu-tzdata-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/maarten-baert-ubuntu-simplescreenrecorder-xenial.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/docker.list': Permission denied
ls: cannot access '/etc/apt/sources.list.d/slack.list': Permission denied
total 0
-????????? ? ? ? ?            ? apandada1-ubuntu-brightness-controller-xenial.list
-????????? ? ? ? ?            ? apandada1-ubuntu-brightness-controller-xenial.list.save
-????????? ? ? ? ?            ? docker.list
-????????? ? ? ? ?            ? docker.list.save
-????????? ? ? ? ?            ? git.list
-????????? ? ? ? ?            ? git.list.save
-????????? ? ? ? ?            ? google-chrome.list
-????????? ? ? ? ?            ? google-chrome.list.save
-????????? ? ? ? ?            ? justinludwig-ubuntu-tzdata-xenial.list
-????????? ? ? ? ?            ? justinludwig-ubuntu-tzdata-xenial.list.save
-????????? ? ? ? ?            ? maarten-baert-ubuntu-simplescreenrecorder-xenial.list
-????????? ? ? ? ?            ? maarten-baert-ubuntu-simplescreenrecorder-xenial.list.save
-????????? ? ? ? ?            ? midori-ubuntu-ppa-xenial.list
-????????? ? ? ? ?            ? midori-ubuntu-ppa-xenial.list.save
-????????? ? ? ? ?            ? nodesource.list
-????????? ? ? ? ?            ? nodesource.list.save
-????????? ? ? ? ?            ? notepadqq-team-ubuntu-notepadqq-xenial.list
-????????? ? ? ? ?            ? notepadqq-team-ubuntu-notepadqq-xenial.list.save
-????????? ? ? ? ?            ? opera-stable.list
-????????? ? ? ? ?            ? opera-stable.list.save
-????????? ? ? ? ?            ? slack.list
-????????? ? ? ? ?            ? slack.list.save
-????????? ? ? ? ?            ? webupd8team-ubuntu-java-xenial.list
-????????? ? ? ? ?            ? webupd8team-ubuntu-java-xenial.list.save
-????????? ? ? ? ?            ? yandex-browser-beta.list
-????????? ? ? ? ?            ? yandex-browser-beta.list.save
-????????? ? ? ? ?            ? yandex-browser.list
-????????? ? ? ? ?            ? yandex-browser.list.save

vegan@vegan:~$ ls -l /etc/apt
total 92
drwxr-xr-x 2 root root  4096 Oca 18 10:14 apt.conf.d
-rw-r--r-- 1 root root  2144 Şub 18  2016 apt-file.conf
drwxr-xr-x 2 root root  4096 Nis 14  2016 preferences.d
-rw-r--r-- 1 root root   668 Oca 29 17:52 sources.list
drw-r--r-- 2 root root  4096 Oca 25 15:22 sources.list.d
-rw-rw-r-- 1 root root  2979 Oca  2 09:37 sources.list.save
-rw-r--r-- 1 root root 31967 Oca 18 09:59 trusted.gpg
-rw-r--r-- 1 root root 31594 Kas 30 10:23 trusted.gpg~
drwxr-xr-x 2 root root  4096 Oca  2 09:37 trusted.gpg.d

答案1

目录/etc/apt/sources.list.d缺少执行权限 ( x)。打开目录需要该权限。使用以下命令恢复目录:

sudo chmod +x /etc/apt/sources.list.d

也可以看看

答案2

如果您可以访问/etc/apt/sources.list.d但是您仍然会收到该文件夹​​内文件的警告,例如WARNING:root:could not open file '/etc/apt/sources.list.d/yarn.list',您必须将该特定文件的权限更改为-rw-r--r--,您可以使用来执行此操作sudo chmod 644 /etc/apt/sources.list.d/nodesource.list

相关内容