(Re)initializing vault

2,307 views
Skip to first unread message

wagh...@gmail.com

unread,
Mar 17, 2016, 10:24:36 AM3/17/16
to Vault
Hi,

I'm playing with `vault`
  • creating **deb** package
  • installing / removing
  • create `systemd` script
  • ...
I have built and

linux/amd64

version and packed it into a deb package (backend => file).

After removing / (re)installing my package, I have an error on initialization

VAULT_ADDR='http://127.0.0.1:8200' vault init





Error initializing Vault: Error making API request.

URL
: PUT http://127.0.0.1:8200/v1/sys/init
Code: 400. Errors:

* Vault is already initialized

How vault could be initialized, since I have removed it (remove directory) ?

Regards,

Jeff Mitchell

unread,
Mar 17, 2016, 10:27:24 AM3/17/16
to vault...@googlegroups.com
Hi,

You probably are not removing the path given to the file backend, so
when you uninstall and reinstall the package, the data is still there.
Uninstalling debs usually doesn't remove data that are not part of the
package, even if the directory itself was originally created by the
deb.

Best,
Jeff
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/hashicorp/vault/issues
> IRC: #vault-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vault" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vault-tool+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vault-tool/0e48174a-b183-4c5c-b398-cf2904d54508%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Michael Fischer

unread,
Mar 17, 2016, 11:02:00 AM3/17/16
to vault...@googlegroups.com
The "purge" action (as opposed to the "remove" action) is supposed to remove package-related data.  If you're building your own Debian packages, you'll want your post-remove script to handle that.

Best regards,

--Michael

Sas

unread,
Jul 28, 2017, 9:10:45 PM7/28/17
to Vault
I have similar issue while reinstalling Vault . I am not installing from package. I am using Vault binary and run it as service. Before stop service , I make vault unmount for requires path and then stop service and remove directories and files for Vault.

Still at second installation I am getting error saying Vault is initialized. There is not a single process and file exist which is related to Vault. Also I restarted the VM . Still same error.

Sas

unread,
Jul 30, 2017, 1:43:58 AM7/30/17
to Vault
Found solution . If Vault is already installed then just removing directories and remove service will not help. Need to clean consul if consul is installed . In my case we installed Vault with consul and it was creating problem. Need to clean all Vault data before reinstall and initiate .


Command 1: Check Vault values inside Consul
curl http://127.0.0.1:8500/v1/kv/?recurse | jq .

Command 2: Delete all Consul values for /Vault . Which makes Vault clean for next installation
curl -X DELETE 'http://localhost:8500/v1/kv/vault?recurse'

Reply all
Reply to author
Forward
0 new messages