“找不到方法驱动程序 /usr/lib/apt/methods/https”更新错误

“找不到方法驱动程序 /usr/lib/apt/methods/https”更新错误
sudo apt-get update
E: The method driver /usr/lib/apt/methods/https could not be found.
michael@Ubuntu:~$ sudo apt-get clean
michael@Ubuntu:~$ cd /var/lib/apt
michael@Ubuntu:/var/lib/apt$ sudo mv lists lists.old
michael@Ubuntu:/var/lib/apt$ sudo mkdir -p lists/partial
michael@Ubuntu:/var/lib/apt$ sudo apt-get clean
michael@Ubuntu:/var/lib/apt$ sudo apt-get update
E: The method driver /usr/lib/apt/methods/https could not be found.
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
michael@Ubuntu:/var/lib/apt$ sudo apt-get update
E: The method driver /usr/lib/apt/methods/https could not be found.

为什么我在执行 apt-get update 时会出现这些错误?

答案1

尝试:

sudo apt-get install apt-transport-https

答案2

我也遇到了这个问题。我无法通过安装来修复它apt-transport-https,因为我已经有一段时间没有在有问题的机器上进行任何软件包更新了,而我需要的那个软件包的版本在软件包存储库中不再可用。(要获得可用的版本,我首先必须能够apt-get update成功。)因此,我不得不找出 apt-get 突然尝试使用 HTTPS 的原因,并阻止它这样做。

就我而言,事实证明,目录中的配置文件中列出的第三方 apt 源之一/etc/apt/sources.list.d已切换为使用 HTTPS 进行所有下载,并且它们已开始将 URL 重定向http://https://URL。这使得 apt 尝试使用 HTTPS,尽管我的源配置均未要求使用 HTTPS。(我在 Web 浏览器中打开源存储库 URL 发现了这一点,并注意到地址栏中的 URL 在https://页面加载时更改为。)

由于这是第三方存储库,因此不是必需的,我只是暂时禁用了该源,然后重新运行,apt-get update它就正常工作了。 和 之后apt-get updateapt-get upgradeapt-get install apt-transport-https能够重新启用该第三方 apt 源,从此一切正常。

答案3

检查该目录中的文件:/etc/apt/sources.list.d

其中一个文件指向以 HTTPS 开头的存储库。通过在开头添加 # 来注释该行,然后尝试: apt-get update

相关内容