4

We have a pair of load balanced managed VMs which install apt-transport-https as part of a startup script.

However recently the servers went into an error state because on startup they could no longer download the version of the package required (1.0.9.8.3) because it is no longer present on the mirror: http://httpredir.debian.org/debian/pool/main/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?

Trying the suggestion of --fix-missing does not help.

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

Next I manually downloaded the higher version of apt-transport-https (1.0.9.8.4) bug I was unable to install it directly because of a dependency on 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.

Can anyone help me resolve this problem? Is it as simple as upgrading libapt-pkg4.12? If so, how do I go about that?

EDIT: Also I am unable to run apt-get update ... because I haven't got apt-transport-https installed. Which I think they call 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?

This is what my /etc/apt/sources.list looks like:

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

Thank you in advance

migrated from askubuntu.com Jan 20 '17 at 16:20

This question came from our site for Ubuntu users and developers.

  • Have you run apt-get update recently? You should have an updated list of what's available from the repositories, before you try to install any given package. 404 is likely happening because you're trying to install a version of the package that is no longer on the repository servers. – Thomas Ward Jan 20 '17 at 16:21
  • Good question. I forgot to mention this, so I'll edit the question. I can't run apt-get update because I haven't got apt-transport-https installed!!! A nice Catch-22 – Richard Corfield Jan 20 '17 at 16:27
  • Better to have your own repo, so you don't depend on an external one. – ctrl-alt-delor Jan 20 '17 at 16:34
  • 1
    Indeed, perhaps the redirector is sending you to an HTTPS mirror... – Stephen Kitt Jan 20 '17 at 16:42
  • 1
    Renaming the http to https in /usr/lib/apt/methods/ solved my problem. – Bethwel Too May 26 '17 at 8:57
8

I appear to have fixed the issue by symlinking the https dir in /usr/lib/apt/methods to the http dir.

root@validator-dev-group-c2v4:~# cd /usr/lib/apt/methods
root@validator-dev-group-c2v4:/usr/lib/apt/methods# ln -s http https

Since I don't actually have any https:// sources configured it seems harmless and then when apt-get install apt-transport-https runs it actually overwrites the symlink with the correct files.

  • 1
    This is actually a good idea. Thank you for posting your solution. – senfo Apr 25 '18 at 13:04
7

The general solution is to update apt's indexes so it knows which versions are available:

apt-get update

Then installing apt-transport-https will find the appropriate versions on the repositories.

You should do this every time you want to install a new package, unless you've done it recently (within the last day typically).

If you can't run apt-get update because it needs apt-transport-https, you can fix things by (temporarily) switching your https:// URLs to http:// in /etc/apt/sources.list (and perhaps files in /etc/apt/sources.list.d). Using HTTP to download packages doesn't reduce your security, it only reduces your confidentiality (systems between your computer and the repositories can see what packages you're retrieving).

If that doesn't work, you can try picking a specific mirror, which should avoid any redirections to HTTPS URLs; look at the list, pick a mirror close to you and use that instead of httpredir.debian.org in your sources.

In your specific case it may well be simpler to manually download the required packages (and ship them alongside your setup scripts so that they continue working): apt-transport-https, libapt-pkg4.12 and whatever else is necessary. (You may end up needing to upgrade apt at the same time.)

  • 1
    I can't run apt-get update because I haven't got apt-transport-https installed! – Richard Corfield Jan 20 '17 at 16:28
  • Ah yes, see my update. – Stephen Kitt Jan 20 '17 at 16:29
  • None of the URLs in either sources.list or sources.list.d are HTTPS. – Richard Corfield Jan 20 '17 at 16:42
  • OK, you could try another mirror, or just manually download everything. – Stephen Kitt Jan 20 '17 at 16:47
0

There are a bunch of text files containing the URL for downloading apt packages within the folder /etc/apt/

Example name for those text files can be: /etc/apt/sources.list.d/mssql-release.list if you try to install packages from a Microsoft server.

And the content of /etc/apt/sources.list.d/mssql-release.list could be :

deb [arch=amd64] https://packages.microsoft.com/debian/8/prod jessie main

Sometimes the content from *.list files is downloaded via HTTPS instead of HTTP but if you have not installed the package apt-transport-https, you wouldn't be able to update your apt-get package manager. It will keep warning you about not being able to use the HTTPS sources.

What you can do then is to locate the offending *.list file(s) with HTTPS links and rename it: sudo mv /etc/apt/sources.list.d/mssql-release.list /etc/apt/sources.list.d/mssql-release.list1 sudo apt-get update sudo apt-get install -y apt-transport-https sudo mv /etc/apt/sources.list.d/mssql-release.list1 /etc/apt/sources.list.d/mssql-release.list sudo apt-get update Then you should be able to proceed with whatever apt-get operations you wish to perform.

Reference for coming up with this answer https://community.c9.io/t/installing-apt-transport-https-issue/10994/10

-1

You can execute following command:

apt-get update && apt-get -y install apt-transport-https curl
-2

you have to add your proxy settings in case absence of their settings are causing issues to get the package. you can set http_proxy, https_proxy, no_proxy in your system/shell settings. I myself was facing similar issue in installing apache superset.

  • 1
    Your last sentence seems to have been cut off. Also, the OP made no mention of a proxy...? – Jeff Schaller Feb 23 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.