[Error: fail to enroll: acquiring metadata failed: failed to create new agent info: could not get agent info from store: fail to read configuration /Library/Elastic/Agent/fleet.enc for the agent: fail to decode bytes: cipher: message authentication failed
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.14/fleet-troubleshooting.html](<{"log.level":"info","@timestamp":"2024-06-06T22:05:59.706-0700","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":506},"message":"Starting enrollment to URL: https://a8ef7f060207437a961f91ef9c7b3f42.fleet.us-central1.gcp.cloud.es.io:443/","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2024-06-06T22:05:59.933-0700","log.origin":{"file.name":"cmd/enroll_cmd.go","file.line":512},"message":"1st enrollment attempt failed, retrying enrolling to URL: https://a8ef7f060207437a961f91ef9c7b3f42.fleet.us-central1.gcp.cloud.es.io:443/ with exponential backoff (init 1s, max 10s)","ecs.version":"1.6.0"}
Error: fail to enroll: acquiring metadata failed: failed to create new agent info: could not get agent info from store: fail to read configuration /Library/Elastic/Agent/fleet.enc for the agent: fail to decode bytes: cipher: message authentication failed
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.14/fleet-troubleshooting.html>)
Version: 8.14.0
Operating System: macos sonoma v14.5
Platform: arm64
While working on this issue comparing root and unprivileged elastic agents, I encountered an error with the
enrollcommand when using unprivileged agent.Steps to Reproduce:
sudo ./elastic-agent install --unprivileged --url=<fleet url> --enrollment-token=<token>sudo elastic-agent enroll --url=<fleet url> --enrollment-token=<token>You should see an error similar what's shown below