asdf and terraform (or vault or packer)

Using the asdf version manager to manage versions of various binaries like terraform, vault or packer is easily done by following the instructions below:

  1. Download and install asdf if you haven’t got it already (
  2. If you want to install the latest version of terraform for example do the following:
asdf plugin add terraform
asdf install terraform latest
asdf global terraform 0.14.9
asdf list
terraform --version
Terraform v0.14.9

Get/Set platform information

To get or set in environment variables the platform information of a system you can use the following:

export ARCH=$(case $(arch) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(arch) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')

Taken from the installation instructions of the Operator SKD here:

Failed to start docker.service: Unit is masked


Trying to start the docker service after some upgrades fails with the following message:

Failed to start docker.service: Unit is masked.


It turns out that after upgrading or more specifically removing and then upgrading the docker installation in ubuntu (in this particular case in raspberry 4 with Ubuntu 20.04 installed), results in this error.

A search brings up the following:

and from that the following bug post:

So the solution is to run the following to be able to start the docker service (described in the first link above):

sudo systemctl unmask docker
sudo systemctl start docker

Getting detailed information about your Linux distribution

To be able to get a more detailed information about your current linux distribution, including the code names use the following:

kosmas:$ cat /etc/os-release
VERSION="18.04.5 LTS (Bionic Beaver)"
PRETTY_NAME="Ubuntu 18.04.5 LTS"

SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch


Trying to configure and use an nginx server that uses intermediate certifcates, you get the error about values mismatch and nginx does not start

2020/09/23 09:49:38 [emerg] 20958#20958: SSL_CTX_use_PrivateKey("/etc/ssl/private/cakey.pem") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch)


It seems that this is a common mistake and it is mentioned here: In order to fix this you will need to change/reverse the original order that you have concatenated the chain, as in:

cat certs/cacert.pem intermediate/certs/intermediate.cacert.pem > intermediate/certs/ca-chain-bundle.cert_new.pem

Decode access secret key from Terraform IAM user creation


You want to use the pgp encryption when using Terraform to create an AWS IAM user, and you have the secret access token returned as an output but encoded.


Use the following to get the actual secret key decoded (after copying your encoded key to a file encrypted_key.txt:

$ cat encrypted_key.txt | base64 --decode | gpg -d

Raspberry, Ubuntu and Megatools

To install megtools (command line utilities for, in your raspberry with ubuntu installed follow the steps below (thanks to the instructions from here:

  • Install the necessary packages
sudo apt-get -y install build-essential libglib2.0-dev libssl-dev libcurl4-openssl-dev libgirepository1.0-dev 

You may also need to add some additional packages if there is an error about the documentation.

  • Get the latest source code from
  • Compile and install them
tar xvfz megatools-1.10.3.tar.gz
cd megatools-1.10.3
sudo make install
sudo ldconfig
  • Add your Mega account credentials in ~/.megarc like:
Username = my_mega@email
Password = mypassword
  • use the mega tools commands (megacopy, megals, megaget etc.