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

Phu*_*ang 12 apt virtualbox 17.10

我有问题做sudo apt update了手动添加存储库(我有问题,nodejsdocker)我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) <docker@docker.com>
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.
Run Code Online (Sandbox Code Playgroud)

这是我的设置的详细信息:

   VM: Ubuntu 17.10
   VirtualBox 5.2.8 r121009 (Qt5.6.2)
   I am behind corporate proxy.
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这一问题?

Sim*_*ler 17

检查是否也为 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/";
Run Code Online (Sandbox Code Playgroud)

还要记住,如果只为sdnc-dev用户设置了代理配置,则需要sudo -E将环境暴露给 root 用户。

  • 我确实在 `/etc/apt/apt.conf/ 文件中设置了 `https` 代理。原来是 `https` 设置设置错误。它被设置为“https://ip:port/”而不是“http://ip:port/”(没有`s`字符)。我改变了它,它现在可以工作了。不确定这是否是真正的原因,但至少我现在有一个工作 apt。 (5认同)

Fab*_*lao 10

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

就我而言,我错误地配置了代理 URL(对于我的组织),需要编辑05proxy并更改https://proxy.mydom.ithttp://proxy.mydom.it

错误的配置:

Acquire::http::proxy "https://proxy.mydom.it:8080";
Acquire::https::proxy "https://proxy.mydom.it:8080";
Run Code Online (Sandbox Code Playgroud)

好的配置:

Acquire::http::proxy "http://proxy.mydom.it:8080";
Acquire::https::proxy "http://proxy.mydom.it:8080";
Run Code Online (Sandbox Code Playgroud)

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