Open
Description
On the latest 9.0.0-SNAPSHOT, if you attempt to install an agent as a Fleet Server but do not specify the servers flavor, you get a very vague and unhelpful message. We should detect use of the --fleet-server-*
options at install time and immediately error if --install-servers
was not also provided on the command line.
Here is example error output:
sudo ./elastic-agent install \
--fleet-server-es=http://localhost:9200 \
--fleet-server-service-token=XXXXXXXX \
--fleet-server-policy=fleet-server-policy \
--fleet-server-port=8220 --develop
Installing into development namespace; this is an experimental and currently unsupported feature.
Elastic Agent will be installed at /Library/Elastic/Agent-Development and will run as a service. Do you want to continue? [Y/n]:y
[ ] Service Started [3s] Elastic Agent successfully installed, starting enrollment.
[ ] Waiting For Enroll... [8s] {"log.level":"info","@timestamp":"2025-01-30T13:13:38.943-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).prepareFleetTLS","file.name":"cmd/enroll_cmd.go","file.line":437},"message":"Generating self-signed certificate for Fleet Server","ecs.version":"1.6.0"}
[= ] Waiting For Enroll... [8s] {"log.level":"info","@timestamp":"2025-01-30T13:13:39.598-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.(*enrollCmd).daemonReloadWithBackoff","file.name":"cmd/enroll_cmd.go","file.line":483},"message":"Restarting agent daemon, attempt 0","ecs.version":"1.6.0"}
[ ===] Waiting For Enroll... [10s] {"log.level":"info","@timestamp":"2025-01-30T13:13:41.613-0500","log.origin":{"function":"github.com/elastic/elastic-agent/internal/pkg/agent/cmd.waitForFleetServer.func1","file.name":"cmd/enroll_cmd.go","file.line":794},"message":"Waiting for Elastic Agent to start Fleet Server","ecs.version":"1.6.0"}
[= ] Waiting For Enroll... [2m8s] Error: fleet-server failed: timed out waiting for Fleet Server to start after 2m0s
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.0/fleet-troubleshooting.html
[====] Uninstalled [2m9s] Error uninstalling. Printing logs
2025-01-30T18:15:39.902Z DEBUG [install] Loaded configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml
2025-01-30T18:15:39.902Z DEBUG [install] Merged configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml into result
2025-01-30T18:15:39.902Z DEBUG [install] Merged all configuration files from [/Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml], no external input files
2025-01-30T18:15:40.060Z DEBUG [install] Loaded configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml
2025-01-30T18:15:40.060Z DEBUG [install] Merged configuration from /Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml into result
2025-01-30T18:15:40.060Z DEBUG [install] Merged all configuration files from [/Users/cmackenzie/Downloads/builds/elastic-agent-9.0.0-SNAPSHOT-darwin-aarch64/elastic-agent.yml], no external input files
2025-01-30T18:15:40.060Z DEBUG [install.composable] Starting controller for composable inputs
2025-01-30T18:15:40.060Z DEBUG [install.composable] Started controller for composable inputs
2025-01-30T18:15:40.060Z DEBUG [install.composable] Computing new variable state for composable inputs
2025-01-30T18:15:40.060Z DEBUG [install.composable] Stopping controller for composable inputs
2025-01-30T18:15:40.060Z DEBUG [install.composable] Stopped controller for composable inputs
Error: enroll command failed for unknown reason: exit status 1
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.0/fleet-troubleshooting.html