/etc/apt/sources.list 不接受带有 https 连接的 URL

use*_*229 6 debian apt https

在 Debian Wheezy 中,我的/etc/apt/sources.list文件如下所示:

deb https://mirrors.kernel.org/debian/ wheezy main contrib non-free
deb-src https://mirrors.kernel.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/debian/ wheezy main contrib non-free
deb-src http://security.debian.org/debian/ wheezy main contrib non-free

deb https://mirrors.kernel.org/debian/ wheezy-updates main contrib non-free
deb-src https://mirrors.kernel.org/debian/ wheezy-updates main contrib non-free
Run Code Online (Sandbox Code Playgroud)

当我执行sudo apt-get update以下错误消息时出现:

E: The method driver /usr/lib/apt/methods/https could not be found
Run Code Online (Sandbox Code Playgroud)

它的修复方法是什么?

Ant*_*hon 7

您应该安装该软件包apt-transport-https。您可能需要临时编辑该 sources.list 以读取http而不是https:下载该软件包。


小智 3

我的问题有点相似。我的/etc/apt/sources.list文件不包含任何阅读 https 的存储库。然而,我无法安装该软件包。我运行命令时遇到的错误sudo apt-get install apt-transport-https是这样的:

Err http://ftp.us.debian.org/debian/ testing/main apt-transport-https amd64 1.0.9.5  404  Not Found [IP: 64.50.236.52 80]
E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/a/apt/apt-transport-https_1.0.9.5_amd64.deb  404  Not Found [IP: 64.50.236.52 80]
Run Code Online (Sandbox Code Playgroud)

仔细观察该错误,我认为 apt 可能将我指向一个过时的包。于是我通过浏览手动追踪包裹http://ftp.us.debian.org/debian/pool/main/a/apt/。在那里我发现该版本apt-transport-https_1.0.9.5_amd64.deb不存在,因此 apt 无法获取包。

为了解决这个问题,我apt-transport-https_1.0.9.6_amd64.deb从链接下载并使用dpkg -i apt-transport-https*. 之后,当我跑步时sudo apt-get update,效果很好。

如果源文件正常但 apt 无法获取包,手动跟踪包可能会提供解决方案。