Unable to add Hashicorp's repo corretly

Hello everyone!

I realise this is probably going to be a typical “newbie” question (and placed in the wrong category, but all the others are specific to Hashicorp product and my issue is more general than that, so I went for Terraform since this is what I’m trying to install).

I’m unable to follow the “Install Terraform” tutorial here. This isn’t a problem with terraform though. I’m unable to add Hashicorp’s source repository in my apt conf…

First off, I’m using Kali on Windows Subsystem for Linux (don’t ask…):
┌──(rolivier㉿local)-[/home/rolivier]
└─$ uname -a
Linux P43230316 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 GNU/Linux

I’m guessing all my problems stems for that, but if I could have a confirmation, and if the tutorial could be updated to mention the Linux distros that are supported and those that aren’t, that’ll be a small victory.

Then, onto my issue. First, step 2 of the tutorial says to use:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
This yields an error, since apt-key is deprecated. It use to work anyway… but it looks like it doesn’t (no update of my /etc/apt/source.list file).

So I followed the instructions of the blog post linked just above and imported the key manually and updated my /etc/apt/source.list file manually (bad idea, I know).

What I did:

  • Downloaded Hashicorp’s public key from https://apt.releases.hashicorp.com/gpg

  • Imported it in my keyrings:
    ┌──(rolivier㉿local)-[/home/rolivier]
    └─$ sudo gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --import /home/rolivier/downloads/gpg
    gpg: keybox '/usr/share/keyrings/hashicorp-archive-keyring.gpg' created
    gpg: key DA418C88A3219F7B: public key "HashiCorp Security (HashiCorp Package Signing) <security+packaging@hashicorp.com>" imported
    gpg: Total number processed: 1
    gpg: imported: 1

  • Added a line to my /etc/apt/source.list file:
    deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com kali-rolling main

Now, when I try to run “sudo apt update” I get the following:
┌──(rolivier㉿local)-[/home/rolivier/]
└─$ sudo apt update
Ign:1 https://apt.releases.hashicorp.com kali-rolling InRelease
Err:2 https://apt.releases.hashicorp.com kali-rolling Release
404 Not Found [IP: 151.101.122.49 443]
Hit:3 http://ftp.free.fr/pub/kali kali-rolling InRelease
Reading package lists... Done
E: The repository 'https://apt.releases.hashicorp.com kali-rolling Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

I tried looking at my apt config to disable signature verification (but idea, I know, but well…) but that doesn’t seem to get me anywhere… The issue seems more related to a specific release file not being present on apt.release.hashicorp.com. Maybe that’s because “kali-rolling” is not a supported distro?

Again, sorry for the noob question, again sorry for misplacing it here (I’m happy to move it anywhere you think it will be more relevant).

Also, I’m aware I could download Terraform directly from here (for example) but I’m actually more interested in installing it correctly…

Thanks in advance to anyone willing to help!
Regards,
Robin

Hi @ro-olivier,

Unfortunately the HashiCorp APT repository doesn’t have “kali-rolling” as an available distribution, which I think is why you saw this error.

You can refer to Supported Debian and Ubuntu releases to see which distributions have packages available. Since Terraform CLI on Linux is just a statically-compiled executable with no dependencies on system-specific libraries, it might work to just replace kali-rolling with one of the supported distributions, since the resulting executable should still be compatible with the Kali Linux kernel, unless they’ve changed the system call interface in some breaking way.

1 Like

Hi @apparentlymart ,
That’s great to know. As a newer user to debian-based linux systems… could you help out and explain how to do that? I have the same error message, and would really like to use terraform on my PureOS machine (10.0, byzantium), but get the same issue described.
What command do I use to force it to try to use some other release file, e.g. for Ubuntu 20.04 etc?
Thanks!

I’m not sure but my guess would be to replace the “kali-rolling” portion of the source entry with one of the supported distribution names.

This is not a supported configuration in the sense that if it doesn’t work today or stops working in the future that would not be something we’re committed to “fix”, but I’m offering it as a workaround for those who wish to use unsupported Linux distributions that happen to be binary compatible enough for what Terraform is doing.

One caveat with this approach is that by default you will also be adding the packages for all of the other HashiCorp products to your set of available packages to install, and I can’t promise that all of them are similarly statically linked executables that would be portable to other Linux distributions. However, that’s a moot point if you aren’t intending to install those other products anyway.