Search code examples
terraformconsulhashicorp-vault

Consul service fails to start


Trying to setup a single node Consul on Ubuntu 18.04, using version: Consul v1.8.4. I am using my own user to start,

My consul.service file looks like this

[Service]
ExecStart=/opt/consul/bin/consul agent –server –ui  –data-dir=/temp/consul –bootstrap-expect=1 –node=vault –bind=192.168.37.128 –config-dir=/etc/consul.d

sudo systemctl daemon-reload
sudo systemctl start consul

The service fails to start - complaining about Unexpected extra arguments

journalctl -xe -u consul

Unexpected extra arguments: [–server –ui –data-dir=/temp/consul –bootstrap-expect=1 –node=vault –bind=192.168.37.128 –conf
Oct 02 23:50:25 ubuntu2 systemd[1]: consul.service: Main process exited, code=exited, status=1/FAILURE
Oct 02 23:50:25 ubuntu2 systemd[1]: consul.service: Failed with result 'exit-code'.

Update Issue 2

failed to parse /etc/consul.d/ui.json: invalid character 'â' looking for beginning of object key string

ui.json - the issue seems “ ” - they need to be " " - as below now:

{
"addresses": {
"http": "0.0.0.0"
  }
}

So these unicode chars need to be taken care of - cut-n-paste issues across editors - best use text editors or directly in console.

If anyone has best practice ideas.


Solution

  • The issue is that the options specified in your systemd unit are prefixed with a en dash (: Unicode 0x2013) instead of a hyphen (-: Unicode 0x2d). See Wikipedia: Hyphens and Dashes for more info.

    The proper syntax to specify the options is:

    [Service]
    ExecStart=/opt/consul/bin/consul agent -server -ui -data-dir=/temp/consul -bootstrap-expect=1 -node=vault -bind=192.168.37.128 -config-dir=/etc/consul.d