调用 '/usr/lib/apt/methods/http' 时 openhabian 上的 apt-get 错误

调用 '/usr/lib/apt/methods/http' 时 openhabian 上的 apt-get 错误

我希望我在这里,几天前 apt-get 在我的 Raspberry Pi Model B rev. 2(运行 Openhabian)上坏了。我还不知道为什么,而且无法自己修复它。

当我尝试apt-get update以 root 身份执行操作时,得到以下输出:

[15:58:05] root@openHABianPi:/home/openhabian# apt-get update
Reading package lists... Done
E: Method http has died unexpectedly!
E: Sub-process http received signal 4.
E: Method /usr/lib/apt/methods/http did not start correctly
E: Method https has died unexpectedly!
E: Sub-process https received signal 4.
E: Method /usr/lib/apt/methods/https did not start correctly
E: Method https has died unexpectedly!
E: Sub-process https received signal 4.
E: Method /usr/lib/apt/methods/https did not start correctly
E: Method https has died unexpectedly!
E: Sub-process https received signal 4.
E: Method /usr/lib/apt/methods/https did not start correctly
E: Method https has died unexpectedly!
E: Sub-process https received signal 4.
E: Method /usr/lib/apt/methods/https did not start correctly
E: Method http has died unexpectedly!
E: Sub-process http received signal 4.
E: Method /usr/lib/apt/methods/http did not start correctly
E: Method http has died unexpectedly!
E: Sub-process http received signal 4.
E: Method /usr/lib/apt/methods/http did not start correctly
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/dists/stretch/InRelease
E: Failed to fetch https://apt.homegear.eu/Raspbian/stretch/InRelease
E: Failed to fetch https://deb.debian.org/debian/dists/stretch-backports/InRelease
E: Failed to fetch https://mirrordirector.raspbian.org/raspbian/dists/testing/InRelease
E: Failed to fetch https://dl.bintray.com/openhab/apt-repo2/dists/stable/InRelease
E: Failed to fetch http://archive.raspberrypi.org/debian/dists/stretch/InRelease
E: Failed to fetch http://repos.azulsystems.com/debian/dists/stable/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead.

当我尝试检查版本/usr/lib/apt/methods/http(https 是指向该版本的链接)时,我得到以下输出:

[15:59:05] root@openHABianPi:/home/openhabian# /usr/lib/apt/methods/http
Illegal instruction

我已经apt-transport-https安装了。我也安装了apt-get autoremove,可能缺少软件包/usr/lib/apt/methods/http所属的某些依赖项,尽管据我所知这不应该发生。

感谢您的帮助!

编辑1:

[23:11:36] root@openHABianPi:/home/openhabian# dpkg -i apt_1.4.9_armhf.deb
dpkg: warning: downgrading apt from 1.8.0 to 1.4.9
(Reading database ... 47399 files and directories currently installed.)
Preparing to unpack apt_1.4.9_armhf.deb ...
Unpacking apt (1.4.9) over (1.8.0) ...
dpkg: dependency problems prevent configuration of apt:
 libapt-pkg5.0:armhf (1.8.0) breaks apt (<< 1.6~) and is installed.
  Version of apt to be configured is 1.4.9.

dpkg: error processing package apt (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.28-8) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 apt

我安装了libapt-gpu-pkg5.0_1.4.9_armhf.deb然后就可以安装apt_1.4.9_armhf.deb

我仍然有 apt-get update 在一个源上冻结的问题0% [Working],这仍然可能是由不兼容的源引起的。

修改 2:
问题是由 letsencrypt/certbot-setup 的错误源引起的,我通过删除源、将我的软件包固定到稳定版本(很多软件包使用“现在”)并基本上非常小心地进行apt-get dist-upgrade大量手动检查,解决了所有剩余问题。即使安装了 apt-transport-https,您可能也必须暂时排除 https 源,因为它对我来说也不起作用(/usr/lib/apt/methods/https由于依赖关系,调用时出现“非法指令”失败)。

答案1

我希望你dpkg还能正常工作...在我的 Debian/MX 系统(也基于 Debian stretch)上,该/usr/lib/apt/methods/http文件是软件包的一部分apt,已用 进行检查dpkg -S /usr/lib/apt/methods/http

浏览可能是你的主存储库http://raspbian.raspberrypi.org/raspbian/dists/stretch/InRelease并特别关注http://raspbian.raspberrypi.org/raspbian/dists/stretch/main/binary-armhf/Packages(是 59M)我看到它有

Package: apt
Version: 1.4.9

版本号也和我的一样。所以我猜你的apt软件包不知怎么搞砸了,也许是另一个来源的不兼容版本“升级”了它?你可以用以下方法之一检查你的 apt 版本:

  • apt-cache showpkg apt
  • apt-cache show apt如果 apt-cache 仍然有效,或者
  • dpkg -s apt
  • dpkg-query --show apt

希望它不是 1.4.9,所以你可以尝试安装这个版本。浏览存储库中的更多内容, http://raspbian.raspberrypi.org/raspbian/pool/main/a/apt/apt_1.4.9_armhf.deb文件。

[它是镜像列表在这里,以及其他下载链接。

如果你下载 .deb 文件,并使用

dpkg -i apt_1.4.9_armhf.deb

这应该可以安装一个希望好的 apt 版本。

注意不要再次“升级” apt 到可能损坏的版本,我会检查任何候选者的来源并apt-cache policy apt可能删除“坏”来源,或考虑apt仅固定到好的来源(参见man apt_preferences)或锁定其版本。

相关内容