Debian – /etc/apt/sources.list won’t accept URLs with https connection

aptdebianhttps

In Debian Wheezy, my /etc/apt/sources.list file looks like this:

deb https://mirrors.kernel.org/debian/ wheezy main contrib non-free
deb-src https://mirrors.kernel.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/debian/ wheezy main contrib non-free
deb-src http://security.debian.org/debian/ wheezy main contrib non-free

deb https://mirrors.kernel.org/debian/ wheezy-updates main contrib non-free
deb-src https://mirrors.kernel.org/debian/ wheezy-updates main contrib non-free

When I do a sudo apt-get update the following error message appears:

E: The method driver /usr/lib/apt/methods/https could not be found

What is the fix for it?

Best Answer

My issue was somewhat similar. My /etc/apt/sources.list file did not contain any repo reading https. Yet, I could not install the package. The error I got when I ran the command sudo apt-get install apt-transport-https was this:

Err http://ftp.us.debian.org/debian/ testing/main apt-transport-https amd64 1.0.9.5  404  Not Found [IP: 64.50.236.52 80]
E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/a/apt/apt-transport-https_1.0.9.5_amd64.deb  404  Not Found [IP: 64.50.236.52 80]

On close observation of the error, I thought maybe apt was pointing me to an obsolete package. So I manually tracked the package by browsing http://ftp.us.debian.org/debian/pool/main/a/apt/. There I found that the version apt-transport-https_1.0.9.5_amd64.deb did not exist and hence apt failed to fetch the package.

In order to fix the issue, I downloaded apt-transport-https_1.0.9.6_amd64.deb from the link and installed the deb package using dpkg -i apt-transport-https*. After that, when I ran sudo apt-get update, it worked fine.

If in case the source file is fine but apt fails to fetch a package, manually tracking the package might provide a solution.

Related Question