我在运行时遇到了sudo apt update
手动添加存储库的问题(我在nodejs
和 方面遇到了问题docker
)。我得到的错误是。Ubuntu 17.10 VM
VirtualBox
Could not handshake: An unexpected TLS packet was received
以下是我尝试添加docker
存储库时采取的步骤和输出。当我尝试添加时nodejs
也发生了同样的事情。
sdnc-dev@sdncdev-VirtualBox:~/tools/idea-IC-173.4674.33/bin$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
sdnc-dev@sdncdev-VirtualBox:~/tools/idea-IC-173.4674.33/bin$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]
sdnc-dev@sdncdev-VirtualBox:~/tools/idea-IC-173.4674.33/bin$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
[sudo] password for sdnc-dev:
sdnc-dev@sdncdev-VirtualBox:~/tools/idea-IC-173.4674.33/bin$ sudo apt update
Ign:1 https://download.docker.com/linux/ubuntu artful InRelease
Err:2 https://download.docker.com/linux/ubuntu artful Release
Could not handshake: An unexpected TLS packet was received.
Hit:3 http://us.archive.ubuntu.com/ubuntu artful InRelease
Get:4 http://security.ubuntu.com/ubuntu artful-security InRelease [78.6 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu artful-backports InRelease [72.2 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages [226 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu artful-updates/main i386 Packages [222 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu artful-updates/main Translation-en [101 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu artful-updates/universe i386 Packages [91.9 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu artful-updates/universe amd64 Packages [92.8 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu artful-updates/universe Translation-en [52.9 kB]
Reading package lists... Done
E: The repository 'https://download.docker.com/linux/ubuntu artful Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
以下是我的设置细节:
VM: Ubuntu 17.10
VirtualBox 5.2.8 r121009 (Qt5.6.2)
I am behind corporate proxy.
有谁知道如何解决这一问题?
答案1
检查是否也为 https 设置了代理。由于curl
使用的是 https,我假设在某处https_proxy
设置了一个变量(例如~/.bashrc
)。需要在或apt
中进行代理配置。您需要为/etc/apt/apt.conf
/etc/apt/apt.conf.d/
全部协议:
# e.g. in file /etc/apt/apt.conf.d/05proxy
Acquire::http::proxy "http://192.168.0.1:3128/";
Acquire::https::proxy "http://192.168.0.1:3128/";
Acquire::ftp::proxy "http://192.168.0.1:3128/";
还要记住,如果仅为用户设置了代理配置sdnc-dev
,则需要sudo -E
向 root 用户公开环境。
答案2
我在使用 Ubuntu 20.04 LTS 时遇到了同样的错误apt-get update
。我在安装过程中配置了代理,这样代理 URL 就/etc/apt/apt.conf.d/05proxy
就我而言,我错误地配置了代理 URL(针对我的组织),需要编辑05proxy
并更改https://proxy.mydom.it
为http://proxy.mydom.it
错误配置:
Acquire::http::proxy "https://proxy.mydom.it:8080";
Acquire::https::proxy "https://proxy.mydom.it:8080";
良好的配置:
Acquire::http::proxy "http://proxy.mydom.it:8080";
Acquire::https::proxy "http://proxy.mydom.it:8080";
在我的例子中,将 https 转换为 http 修复了 TLS 错误
答案3
这个答案解决了我的问题:https://stackoverflow.com/a/60274085/486564
简单答案
如果您使用代理服务器,请为 curl 设置代理。curl 无法连接到服务器,因此显示错误的版本号。通过打开 subl ~/.curlrc 或使用任何其他文本编辑器来设置代理。然后将以下行添加到文件:proxy=proxyserver:proxyport 例如 proxy = 10.8.0.1:8080
如果您没有使用代理,请确保 curlrc 文件不包含代理设置。