Hashicorp - vault service fails to start

2.9k Views Asked by At

I have setup Hashicorp - vault (Vault v1.5.4) on Ubuntu 18.04. My backend is Consul (single node running on same server as vault) - consul service is up.

My vault service fails to start

systemctl list-units --type=service | grep "vault"
vault.service                        loaded failed failed  vault service  

journalctl -xe -u vault
Oct 03 00:21:33 ubuntu2 systemd[1]: vault.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
- Unit vault.service has finished shutting down.
Oct 03 00:21:33 ubuntu2 systemd[1]: vault.service: Start request repeated too quickly.
Oct 03 00:21:33 ubuntu2 systemd[1]: vault.service: Failed with result 'exit-code'.
Oct 03 00:21:33 ubuntu2 systemd[1]: Failed to start vault service.
-- Subject: Unit vault.service has failed

vault config.json

 "api_addr": "http://<my-ip>:8200",
  storage "consul" {
   address = "127.0.0.1:8500"
    path    = "vault"
  },

Service config

StandardOutput=/opt/vault/logs/output.log
StandardError=/opt/vault/logs/error.log


cat /opt/vault/logs/error.log
cat: /opt/vault/logs/error.log: No such file or directory
cat /opt/vault/logs/output.log
cat: /opt/vault/logs/output.log: No such file or directory
sudo tail -f /opt/vault/logs/error.log  
tail: cannot open '/opt/vault/logs/error.log' for reading: No such file or 
directory


:/opt/vault/logs$ ls -al
total 8
drwxrwxr-x 2 vault vault 4096 Oct  2 13:38 .
drwxrwxr-x 5 vault vault 4096 Oct  2 13:38 ..
1

There are 1 best solutions below

0
On

After much debugging, the issue was silly goofup mixing .hcl and .json (they are so similar - but different) - cut-n-paste between stuff the storage (as posted) needs to be in json format. The problem is of course compounded when the error message saying nothing and there is nothing in the logs.

"storage": {
    "consul": {
        "address": "127.0.0.1:8500",
         "path" : "vault"
    }
 },

There were a couple of other additional issues to sort out to get it going- disable_mlock : true, opening the firewall for 8200: sudo ufw allow 8200/tcp.

Finally got done (rather started).