如何修复“apt-get install -f apt-transport-https”错误:404 Not Found?

Ric*_*eld 4 debian apt package-management deb

我们有一对负载平衡的托管 VM,它们安装 apt-transport-https 作为启动脚本的一部分。

但是最近服务器进入错误状态,因为在启动时他们无法再下载所需的软件包版本(1.0.9.8.3),因为它不再存在于镜像中:http ://httpredir.debian.org/ debian/pool/main/a/apt

root@validator-dev-group-c2v4:/etc# apt-get install -f apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
Need to get 138 kB of archives.
After this operation, 195 kB of additional disk space will be used.
Err http://httpredir.debian.org/debian/ jessie/main apt-transport-https amd64 1.0.9.8.3
  404  Not Found
E: Failed to fetch http://httpredir.debian.org/debian/pool/main/a/apt/apt-transport-https_1.0.9.8.3_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Run Code Online (Sandbox Code Playgroud)

尝试的建议--fix-missing无济于事。

root@validator-dev-group-c2v4:/etc# apt-get install --fix-missing apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 27 not upgraded.
Need to get 138 kB of archives.
After this operation, 195 kB of additional disk space will be used.
Err http://httpredir.debian.org/debian/ jessie/main apt-transport-https amd64 1.0.9.8.3
  404  Not Found
E: Failed to fetch http://httpredir.debian.org/debian/pool/main/a/apt/apt-transport-https_1.0.9.8.3_amd64.deb  404  Not Found
E: Internal Error, ordering was unable to handle the media swap
Run Code Online (Sandbox Code Playgroud)

接下来我手动下载了更高版本的apt-transport-https (1.0.9.8.4) bug 我无法直接安装它,因为依赖于libapt-pkg4.12。

root@validator-dev-group-c2v4:/home/<user># sudo dpkg -i ./apt-transport-https_1.0.9.8.4_amd64.deb 
Selecting previously unselected package apt-transport-https.
(Reading database ... 26719 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.0.9.8.4_amd64.deb ...
Unpacking apt-transport-https (1.0.9.8.4) ...
dpkg: dependency problems prevent configuration of apt-transport-https:
 apt-transport-https depends on libapt-pkg4.12 (>= 1.0.9.8.4); however:
  Version of libapt-pkg4.12:amd64 on system is 1.0.9.8.3.
Run Code Online (Sandbox Code Playgroud)

谁能帮我解决这个问题?是升级 libapt-pkg4.12 这么简单吗?如果是这样,我该怎么做?

编辑:我也无法运行apt-get update......因为我还没有apt-transport-https安装。我认为他们称之为 Catch-22!

root@validator-dev-group-c2v4:/home/<user># apt-get update
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
Run Code Online (Sandbox Code Playgroud)

这是我的/etc/apt/sources.list样子:

deb http://httpredir.debian.org/debian/ jessie main
deb-src http://httpredir.debian.org/debian/ jessie main
deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
deb http://httpredir.debian.org/debian/ jessie-updates main
deb-src http://httpredir.debian.org/debian/ jessie-updates main
Run Code Online (Sandbox Code Playgroud)

先感谢您

Ric*_*eld 17

我似乎通过符号链接的已经解决了这一问题,https在DIR/usr/lib/apt/methodshttpDIR。

root@validator-dev-group-c2v4:~# cd /usr/lib/apt/methods
root@validator-dev-group-c2v4:/usr/lib/apt/methods# ln -s http https
Run Code Online (Sandbox Code Playgroud)

由于我实际上没有https://配置任何源,因此它看起来无害,然后在apt-get install apt-transport-https运行时它实际上会用正确的文件覆盖符号链接。


Ste*_*itt 7

一般的解决方案是更新apt的索引,以便它知道哪些版本可用:

apt-get update
Run Code Online (Sandbox Code Playgroud)

然后安装apt-transport-https将在存储库中找到适当的版本。

每次要安装新软件包时都应该这样做,除非您最近(通常在最后一天内)这样做过。

如果您apt-get update因为需要而无法运行,则apt-transport-https可以通过(暂时)将https://URL切换到http://in /etc/apt/sources.list(可能还有 中的文件/etc/apt/sources.list.d)来解决问题。使用 HTTP 下载包不会降低您的安全性,只会降低您的机密性(您的计算机和存储库之间的系统可以看到您正在检索哪些包)。

如果不起作用,您可以尝试选择一个特定的镜像,这样可以避免重定向到 HTTPS URL;查看列表,选择靠近您的镜子并使用它而不是httpredir.debian.org您的来源。

在您的特定情况下,手动下载所需的包(并将它们与安装脚本一起发送,以便它们继续工作)可能更简单:apt-transport-httpslibapt-pkg4.12以及其他任何必要的东西。(您可能最终需要同时升级apt。)

  • 我无法运行 `apt-get update`,因为我还没有安装 `apt-transport-https`! (4认同)