apt-get 失敗:找不到方法驅動程式 /usr/lib/apt/methods/https

apt-get 失敗:找不到方法驅動程式 /usr/lib/apt/methods/https

我嘗試使用終端更新我的作業系統 Debian jessie,但出現錯誤:

“E: The method driver /usr/lib/apt/methods/https could not be found.” error?

我的來源列表:

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

# jessie-updates, previously known as 'volatile'
deb http://httpredir.debian.org/debian/ jessie-updates main
deb-src http://httpredir.debian.org/debian/ jessie-updates main

deb http://ftp.de.debian.org/debian jessie main 

如何修復apt-get updateaptitude update

答案1

聽起來您可能添加了一些 https 來源。由於您的 中沒有 https 來源sources.list,因此它將是/etc/apt/sources.list.d/.

您也可能正在處理始終重定向到 https 的代理程式。

您可以透過安裝幾個軟體包來新增對 https apt 來源的支援:

apt-get install apt-transport-https ca-certificates

如果你apt-get太崩潰而無法做到這一點,你可以直接下載包並安裝它dpkg -i。該套件的任何其他依賴項都可以類似地追蹤和獲取(dpkg如果有任何內容遺失,會讓您知道)。

如果仍然不起作用,您可以嘗試編輯來源條目以使用 http 而不是 https,或將其刪除並按照來源維護者的說明重新開始。

答案2

對我來說,發生這個問題是因為其中一個鏡像總是重定向到 https。所以我的來源都不是 https,但由於重定向,apt 最終會嘗試從 https 網站取得某些內容。為了解決這個問題,我必須手動下載並安裝:

  • libcurl3-gnutls
  • apt-transport-https

(apt-transport-https 依賴 libcurl3-gnutls)。

一旦安裝了這些,我就能夠成功安裝任何其他軟體包,即使鏡像位於 https 上。

答案3

導致此類問題的可能事件很少。最可能的解決方案是運行:

apt-get update
apt-get install apt-transport-https

您可以找到此問題的更多詳細資訊和可能的原因這裡

答案4

連結到https來源也可以來自 /etc/apt/sources.list 檔案中的 http 引用。

我的來源列表:

cat /etc/apt/sources.list
deb http://deb.debian.org/debian stretch main contrib non-free
deb http://deb.debian.org/debian stretch main contrib non-free
..
deb [arch=armhf] http://repos.rcn-ee.com/debian/ stretch main

包括對另一個來源的引用,而該來源又具有https參考。
註解掉以下內容:

deb [arch=armhf] http://repos.rcn-ee.com/debian/ stretch main

是對我有用的修復。

相關內容