关于Git的安装

关于Git的安装

我当时正在使用 Ubuntu 16.04.2 sudo apt install git。我收到以下错误:

$ sudo apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  snap-confine snapd-login-service
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  git-man liberror-perl
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 55 not upgraded.
Need to get 3,932 kB of archives.
After this operation, 25,6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 git-man all 1:2.7.4-0ubuntu1.6 [736 kB]
Ign:2 http://in.archive.ubuntu.com/ubuntu xenial-updates/main i386 git-man all 1:2.7.4-0ubuntu1.6
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 git amd64 1:2.7.4-0ubuntu1.6 [3,176 kB]
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Err:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.6
  502  Invalid headers in response [IP: 103.123.234.254 80]
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.6 [3,176 kB]
Ign:1 http:/in.archive.ubuntu.com/ubuntu xenial/main i386 liberror-perl all 0.17-1.2
Ign:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git-man all 1:2.7.4-0ubuntu1.6
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/main i386 liberror-perl all 0.17-1.2 [19.6 kB]
Err:1 http://in.archive.ubuntu.com/ubuntu xenial/main i386 liberror-perl all 0.17-1.2
  Undertermined Error [IP: 103.123.234.254 80]
Ign:2 http://security.ubuntu.com/ubuntu xenial-security/main i386 git-man all 1:2.7.4-0ubuntu1.6
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.6 [3,176 kB]
Err:2 http://security.ubuntu.com/ubuntu xenial-security/main i386 git-man all 1:2.7.4-0ubuntu1.6
  Connection failed [IP: 103.123.234.254 80]
Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.6 [3,176 kB]
Err:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 git amd64 1:2.7.4-0ubuntu1.6
  Error reading from server. Remote end closed connection [IP: 91.189.91.23 80]
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/libe/liberror-perl/liberror-perl_0.17-1.2_all.deb  Undetermined Error [IP: 103.123.234.254 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/git/git-man_2.7.4-0ubuntu1.6_all.deb  Connection failed [IP: 103.123.234.254 80]


E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/git/git_2.7.4-0ubuntu1.6_amd64.deb  Error reading from server. Remote end closed connection [IP: 91.189.91.23 80]

答案1

前三个apt错误均发生在 IP 地址 103.123.234.254、端口 80 上。

事实上,该地址在连接时被使用in.archive.ubuntu.com,并且security.ubuntu.com该 IP 的 DNS 反向查找声称它是,anycast.estointernet.in而不是任何*.ubuntu.com表明这可能是内容交付网络或您的互联网服务提供商的某种安排。

$ dig +short -x 103.123.234.254
anycast.estointernet.in.

第四个错误涉及 的 IP 地址 91.189.91.23 security.ubuntu.com

$ dig +short -x 91.189.91.23
economy.canonical.com.

$ dig +short security.ubuntu.com
91.189.91.26
91.189.91.23    <-- note: here it is!
91.189.88.149
91.189.88.31
91.189.88.24
91.189.88.162

看起来 Canonical(构建 Ubuntu 的公司)在security.ubuntu.com...上有多个服务器,正如预期的那样,因为它的流量可能很大。除了“伞”之外,这些服务器中的每一个都有一个“正确的名称” security.ubuntu.com,并且您的连接恰好最终到达名为 的服务器economy.canonical.com。但看起来由于某种原因连接失败了。

我不太喜欢这样的想法estointernet.in(我认为是你的 ISP)似乎在前面添加了另一层反向代理/缓存/CDN 技术security.ubuntu.com:如果这不能完美工作,则可能会延迟重要的安全补丁。但也许这是他们处理所获得的流量的唯一方法security.ubuntu.com

总结一下:它看起来像是estointernet.in将某种缓存/代理/CDN 技术应用于到 Ubuntu 存储库服务器的连接,并且在连接时,该技术看起来效果不太好,并且回退到直接连接也失败,可能是因为您和您之间的某处网络拥挤security.ubuntu.com

您的选择可能仅限于向您的互联网连接提供商报告问题和/或等待他们修复问题,或者尝试其他网络连接提供商。

相关内容