Monday 7 March 2022

Configuring Hashicorp repositories in Linux Mint (and other Ubuntu based distributions)

Hashicorp distributes Packer and Terraform as both binaries and packages for popular Linux distributions.  

They also have a handy apt repository for use with Ubuntu and Debian, but it generates a 404 error during apt-get update with other derivatives:

e.g.
Err: 9 https://apt.releases.hashicorp.com ulyssa Release
404  Not Found [IP: 151.101.2.49 443]

The reason is the respository only appears to contain branches for the Ubuntu and Debian codenames.

The solution is to edit the sources list and change it to use the equivalent Ubuntu/Debian codename instead:

  • Edit /etc/apt/sources.list.d/additional-repositories.list with your text editor of choice
  • The line that contains apt.releases.hashicorp.com will have the distribution codename in it
    • e.g. for Linux Mint 20.1 which has codeame ulyssa:
    • deb [arch=amd64] https://apt.releases.hashicorp.com ulyssa main
    • (use lsb_release -a to identify the codename)
  • Change the codename in the entry to the equivalent Ubuntu or Debian codename
    • deb [arch=amd64] https://apt.releases.hashicorp.com focal main
Then update the apt repository list and it should find the packages when you try to install Terraform or Packer with apt-get install