如何修復“apt-get install -f apt-transport-https”錯誤:404 Not Found?
我們有一對負載平衡的託管虛擬機,它們安裝 apt-transport-https 作為啟動腳本的一部分。
但是最近伺服器進入錯誤狀態,因為在啟動時它們無法再下載所需的軟體包版本(1.0.9.8.3),因為它不再存在於鏡像中:http: //httpredir.debian.org/ debian/池/主/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?
嘗試的建議
--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
接下來我手動下載了更高版本的apt-transport-https (1.0.9.8.4) 錯誤由於對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.
誰能幫我解決這個問題?升級 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?
這就是我的
/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
先感謝您
我似乎通過將目錄符號連結到
https
目錄/usr/lib/apt/methods
來解決了這個問題http
。root@validator-dev-group-c2v4:~# cd /usr/lib/apt/methods root@validator-dev-group-c2v4:/usr/lib/apt/methods# ln -s http https
由於我實際上沒有
https://
配置任何源,因此它看起來是無害的,然後在apt-get install apt-transport-https
執行時它實際上會用正確的文件覆蓋符號連結。
一般的解決方案是更新
apt
的索引,以便它知道哪些版本可用:apt-get update
然後安裝
apt-transport-https
將在儲存庫中找到適當的版本。每次要安裝新軟體包時都應執行此操作,除非您最近(通常在最後一天)完成此操作。
apt-get update
如果您因為需要而無法執行apt-transport-https
,您可以通過(暫時)將您的https://
URL 切換到http://
in/etc/apt/sources.list
(可能還有文件 in/etc/apt/sources.list.d
)來修復問題。使用 HTTP 下載包不會降低您的安全性,它只會降低您的機密性(您的電腦和儲存庫之間的系統可以看到您正在檢索哪些包)。如果這不起作用,您可以嘗試選擇一個特定的鏡像,這應該避免任何重定向到 HTTPS URL;查看列表,選擇靠近您的鏡子並使用它而不是
httpredir.debian.org
在您的來源中。在您的特定情況下,手動下載所需的軟體包可能會更簡單(並將它們與您的設置腳本一起發送,以便它們繼續工作) :,
apt-transport-https
以及libapt-pkg4.12
其他任何必要的東西。(您可能最終需要同時升級apt
。)