94

I tried to update my OS Debian jessie using the terminal and i get an error :

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

My 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

# 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 

How to fix apt-get update and aptitude update?

1
  • 1
    Keep in mind that there's no integrity benefit to using HTTPS since packages have signatures that are verified anyway - which is probably even better since you're not trusting many independent CAs. THere ay be some privacy benefit. See also: unix.stackexchange.com/questions/90227/…
    – Bob
    Commented Feb 18, 2016 at 0:07

5 Answers 5

168

Sounds like you may have added some https sources. Since there are no https sources in your sources.list, it would be something in /etc/apt/sources.list.d/.

You may also be dealing with a proxy that always redirects to https.

You can add support for https apt sources by installing a couple of packages:

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

If your apt-get is too broken to do this, you can download the package directly and install it with dpkg -i. Any additional dependencies of that package can be tracked down and fetched similarly (dpkg will let you know if anything is missing).

If it still doesn't work, you might try editing the source entry to use http instead of https, or just remove it and start over following the source maintainer's instructions.

7
  • For me, installing "apt-transport-https" and "ca-certificates" didn't fix the issue, but updating the files in "/etc/apt/sources.list.d/" (for me it was nodesource.list) to use http instead of https fixed it Commented Nov 28, 2018 at 9:44
  • sudo dpkg -i <deb for apt-transport-https> worked for me, but that install had dependencies that I had to fix with apt-get update, which the package install for apt-transport-https allowed me to perform. Commented Feb 20, 2019 at 20:55
  • 2
    "Unable to locate package apt-transport-https"
    – Anentropic
    Commented Mar 21, 2019 at 14:01
  • 1
    This totally fixed it for me! Thank you thank you thank you!
    – Mike Wills
    Commented Apr 3, 2019 at 1:53
  • 1
    For me it actually turned out that an http source was the cause of the above issue. Removing the corresponding file in /etc/apt/sources.list.d/ fixed it.
    – balu
    Commented Apr 30, 2019 at 9:01
9

For me this issue happened because one of the mirrors happened to always redirect to https. So none of my sources were https, but due to the redirect, apt would end up trying to fetch something off an https site. To resolve this, I had to manually download and install:

  • libcurl3-gnutls and
  • apt-transport-https

(apt-transport-https had a dependency on libcurl3-gnutls).

Once those were installed, I was able to successfully install any other package, even if the mirror was on https.

1
  • In particular if you already have something on the system that can do the https download (wget , curl, a browser), you can do e.g. apt install --print-uris apt-transport-https to show the package URI, download the URI with something to get the .deb, and then install the .deb with e.g. sudo dpkg -i apt-transport-https_1.0.9.8.6_amd64.deb.
    – rakslice
    Commented Jul 23, 2021 at 23:09
4

There are few possible incidents which lead to this type of issues. The most likely solution would be to run:

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

You can find more details and possible causes for this issue here.

1
  • 3
    In Docker when this comes up you'll often need to run this BEFORE you add the source which uses https, or the apt-get update and apt-get install will fail due to inability to read from https.
    – Owen Allen
    Commented Jul 30, 2020 at 18:20
3

First check

/etc/apt/sources.list.d# ls -l

insgesamt 16
-rw-r--r-- 1 root root 142 Okt 12 14:12 jtaylor-keepass-jessie.list
-rw-r--r-- 1 root root 332 Okt 12 14:07 sources.list
-rw-r--r-- 1 root root  85 Okt 12 14:13 ubuntuzilla.list
-rw-r--r-- 1 root root  78 Okt  8 09:13 ubuntuzilla.list.save

Remove all other let only sources.list

edit sources.list

/etc/apt/sources.list.d# cat sources.list 
deb http://security.debian.org/debian-security jessie/updates main    
deb http://ftp.debian.org/debian/ jessie-updates contrib main   
deb-src http://security.debian.org/ jessie/updates contrib main  
deb-src http://ftp.debian.org/debian/ jessie-updates contrib main 

try again:

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get upgrade

If this did't work then install over browser:

to select a package:

http://security-cdn.debian.org/debian-security/pool/updates/main/a/apt/

or

http://security-cdn.debian.org/debian-security/pool/updates/main/a/apt/apt-transport-https_1.0.9.8.5_amd64.deb
0

The link to an https source can also come from an http reference in your /etc/apt/sources.list file.

My sources.list :

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

included a reference to another source that in turn had an https reference.
Commenting out the following :

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

was the fix that worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .