當 openhabian 上呼叫 '/usr/lib/apt/methods/http' 時的 apt-get 錯誤

當 openhabian 上呼叫 '/usr/lib/apt/methods/http' 時的 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-pkg5.0_1.4.9_armhf.deb然後就可以安裝了apt_1.4.9_armhf.deb

我仍然遇到 apt-get update 在一個來源上凍結的問題0% [Working],這可能仍然是由不相容的來源引起的。

編輯2:
這些問題是由來自letencrypt/certbot-setup的錯誤源引起的,我通過刪除源、將我的包固定到穩定狀態來擺脫所有剩餘的問題(對很多包使用“now”)並且基本上是非常仔細地進行了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)或鎖定其版本。

相關內容