我知道如果有人在 Google 上搜索上述错误,那么他会得到大量结果。然而,在尝试了许多建议的解决方案,并全职处理这个错误大约一周后,是时候寻求帮助了。
我在 Windows 10 机器上使用 Oracle VirtualBox。作为客户操作系统,我安装了 Ubuntu 16.04.04。
这是我尝试过的:
如上所述这里, 我有
deb https://apt.dockerproject.org/repo ubuntu-xenial main
在我的源列表中。我如何检查?通过运行
find /etc/apt/ -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;
在命令行中,结果为:
`/etc/apt/sources.list.d/docker.list
1 deb https://apt.dockerproject.org/repo ubuntu-xenial main
/etc/apt/sources.list
1 deb http://de.archive.ubuntu.com/ubuntu/ xenial main universe restricted multiverse
2 deb-src http://de.archive.ubuntu.com/ubuntu/ xenial main universe restricted multiverse #Added by software-properties
3 deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe restricted main multiverse
4 deb http://security.ubuntu.com/ubuntu/ xenial-security universe restricted main multiverse
5 deb https://packages.ubuntu.com/xenial/screen/ubuntu xenial main
6 deb-src https://packages.ubuntu.com/xenial/screen/ubuntu xenial main
7 deb-src https://apt.dockerproject.org/repo ubuntu-xenial main`
但是,这并没有解决错误,甚至之后还sudo apt-get update
出现:
Reading package lists... Done
W: The repository 'http://de.archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://de.archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://security.ubuntu.com/ubuntu xenial-security Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Failed to fetch https://packages.ubuntu.com/xenial/screen/ubuntu/dists/xenial/InRelease Could not resolve host: packages.ubuntu.com
W: Failed to fetch https://apt.dockerproject.org/repo/dists/ubuntu-xenial/InRelease Could not resolve host: apt.dockerproject.org
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/xenial/main/source/Sources Something wicked happened resolving 'de.archive.ubuntu.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/binary-amd64/Packages Something wicked happened resolving 'de.archive.ubuntu.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/universe/binary-amd64/Packages Something wicked happened resolving 'security.ubuntu.com:http' (-5 - No address associated with hostname)
W: Some index files failed to download. They have been ignored, or old ones used instead.
- 我应该提到,当我将新源添加到列表中,并在以下弹出窗口中按“重新加载”时
尽管我确定互联网可以正常工作,但我还是收到以下错误。
每当我想要安装新包时都会发生错误E: Unable to locate package XXX
,不仅仅是screen
。
因此现在当我尝试screen
使用安装时sudo apt-get install screen
,我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package screen
值得注意的是,我正在使用代理人。
由于这个错误已经让我不知所措,我非常感谢任何帮助
答案1
解决方案是必须使用代理进行更正配置,这必须在/etc/environment
和中完成/etc/apt/apt.conf
例如,在/etc/environment
我应该有这样的内容:
http_proxy="http://XXX.XX.XXX.XX:XX"
https_proxy="http://XXX.XX.XXX.XX:XX"
no_proxy=1,2,3,4,5,6,7,8,9,0
而/etc/apt/apt.conf
Acquire::http::Proxy "http://XXX.XX.XXX.XX:XX";
Acquire::http::proxy::XX.XXX.X.XXX "DIRECT";
Acquire::https::Proxy "http://XXX.XX.XXX.XX:XX";
当然,X 将被正确的数字替换。