首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >apt更新:无法握手:收到意外的TLS数据包

apt更新:无法握手:收到意外的TLS数据包
EN

Ask Ubuntu用户
提问于 2018-03-14 19:24:58
回答 3查看 61.6K关注 0票数 16

我在手工添加存储库时做sudo apt update ( nodejsdocker有问题)在运行在VirtualBox中的Ubuntu 17.10 VM时有问题。我得到的错误是Could not handshake: An unexpected TLS packet was received

下面是我在尝试添加docker存储库和输出时所采取的步骤。在我尝试添加nodejs时,也发生了同样的事情。

代码语言:javascript
运行
复制
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) 
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.

下面是我设置的详细信息:

代码语言:javascript
运行
复制
   VM: Ubuntu 17.10
   VirtualBox 5.2.8 r121009 (Qt5.6.2)
   I am behind corporate proxy.

有人知道怎么解决这个问题吗?

EN

回答 3

Ask Ubuntu用户

回答已采纳

发布于 2018-03-14 19:57:36

检查是否也为https设置了代理。由于curl正在使用https,所以我假设,在某个地方设置了一个https_proxy变量(例如~/.bashrc)。apt需要/etc/apt/apt.conf/etc/apt/apt.conf.d/中的代理配置。您需要为所有协议指定代理:

代码语言:javascript
运行
复制
# 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向根用户公开环境。

票数 18
EN

Ask Ubuntu用户

发布于 2020-11-04 22:15:01

在使用Ubuntu20.04LTS时,我在使用apt-get update时也遇到了同样的错误。我在安装过程中配置了代理,这样代理urls就在/etc/apt/apt.conf.d/05proxy中了。

在我的例子中,我错误地配置了代理URL (用于我的组织),需要编辑05proxy并将https://proxy.mydom.it更改为http://proxy.mydom.it

配置错误:

代码语言:javascript
运行
复制
Acquire::http::proxy "https://proxy.mydom.it:8080";
Acquire::https::proxy "https://proxy.mydom.it:8080";

配置良好:

代码语言:javascript
运行
复制
Acquire::http::proxy "http://proxy.mydom.it:8080";
Acquire::https::proxy "http://proxy.mydom.it:8080";

将https转换为http,在我的例子中,修复了TLS错误。

票数 7
EN

Ask Ubuntu用户

发布于 2020-08-26 15:13:16

这个答案在我的案例中解决了:https://stackoverflow.com/a/60274085/486564

如果您在代理服务器后面,请将代理设置为curl。curl无法连接到服务器,因此显示错误的版本号。通过打开subl ~/..curlrc或使用任何其他文本编辑器来设置代理。然后将以下行添加到文件中: proxy= proxyserver:proxyport,例如proxy = 10.8.0.1:8080,如果您不在代理后面,请确保curlrc文件不包含代理设置。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1014973

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档