elastic / elastic-agent

Elastic Agent - single, unified way to add monitoring for logs, metrics, and other types of data to a host.
Other
17 stars 144 forks source link

Installation failed to start Elastic Agent service #5280

Open studyworker opened 3 months ago

studyworker commented 3 months ago

[====] Start Service failed, exiting... [10s] Installation failed to start Elastic Agent service. [ =] Uninstalled [10s] Error uninstalling. Printing logs {debug 2024-08-10 11:45:35.831937 +0800 CST m=+10.166573626 processes Error fetching PID info for 517, skipping: FillPidMetrics: error fetching string data from process: error reading process information from KERN_PROCARGS2: %!w() github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.843582 +0800 CST m=+10.178218376 processes Error fetching PID info for 4830, skipping: GetInfoForPid: could not read process info for pid 0: proc_pidinfo returned 4830 github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.843596 +0800 CST m=+10.178232042 processes Error fetching PID info for 4829, skipping: GetInfoForPid: could not read process info for pid 0: proc_pidinfo returned 4829 github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.843598 +0800 CST m=+10.178234751 processes Error fetching PID info for 4779, skipping: GetInfoForPid: could not read process info for pid 0: proc_pidinfo returned 4779 github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.8436 +0800 CST m=+10.178236834 processes Error fetching PID info for 4778, skipping: GetInfoForPid: could not read process info for pid 0: proc_pidinfo returned 4778 github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.843603 +0800 CST m=+10.178239167 processes Error fetching PID info for 2623, skipping: GetInfoForPid: could not read process info for pid 0: proc_pidinfo returned 2623 github.com/elastic/elastic-agent-system-metrics@v0.9.1/metric/system/process/process.go:173 } {debug 2024-08-10 11:45:35.8555 +0800 CST m=+10.190136542 Loaded configuration from /Users/amber/Downloads/elastic-agent-8.12.2-darwin-aarch64/elastic-agent.yml github.com/elastic/elastic-agent/internal/pkg/config/loader.go:45 } {debug 2024-08-10 11:45:35.855519 +0800 CST m=+10.190155751 Merged configuration from /Users/amber/Downloads/elastic-agent-8.12.2-darwin-aarch64/elastic-agent.yml into result github.com/elastic/elastic-agent/internal/pkg/config/loader.go:57 } {debug 2024-08-10 11:45:35.855524 +0800 CST m=+10.190160501 Merged all configuration files from [/Users/amber/Downloads/elastic-agent-8.12.2-darwin-aarch64/elastic-agent.yml], no external input files github.com/elastic/elastic-agent/internal/pkg/config/loader.go:64 } {debug 2024-08-10 11:45:35.855664 +0800 CST m=+10.190300209 composable Starting controller for composable inputs github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:112 } {debug 2024-08-10 11:45:35.85572 +0800 CST m=+10.190356876 composable Started controller for composable inputs github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:155 } {debug 2024-08-10 11:45:35.855881 +0800 CST m=+10.190517001 composable Variable state changed for composable inputs; debounce started github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:191 } {debug 2024-08-10 11:45:35.8559 +0800 CST m=+10.190536751 composable.providers.kubernetes Kubernetes provider for resource pod skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable github.com/elastic/elastic-agent/internal/pkg/composable/providers/kubernetes/kubernetes.go:106 } {debug 2024-08-10 11:45:35.855956 +0800 CST m=+10.190592376 composable Kubernetes_secrets provider skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable github.com/elastic/elastic-agent/internal/pkg/composable/providers/kubernetessecrets/kubernetes_secrets.go:97 } {debug 2024-08-10 11:45:35.856 +0800 CST m=+10.190636001 composable.providers.kubernetes Kubernetes provider for resource node skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable github.com/elastic/elastic-agent/internal/pkg/composable/providers/kubernetes/kubernetes.go:106 } {debug 2024-08-10 11:45:35.855948 +0800 CST m=+10.190584876 docker Docker client will negotiate the API version on the first request. github.com/elastic/elastic-agent-autodiscover@v0.6.6/docker/client.go:49 } {debug 2024-08-10 11:45:35.856051 +0800 CST m=+10.190687667 composable Kubernetes leaderelection provider skipped, unable to connect: unable to build kube config due to error: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable github.com/elastic/elastic-agent/internal/pkg/composable/providers/kubernetesleaderelection/kubernetes_leaderelection.go:53 } {info 2024-08-10 11:45:35.856207 +0800 CST m=+10.190842959 composable.providers.docker Docker provider skipped, unable to connect: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? github.com/elastic/elastic-agent/internal/pkg/composable/providers/docker/docker.go:44 } {debug 2024-08-10 11:45:35.956791 +0800 CST m=+10.291426709 composable Computing new variable state for composable inputs github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:207 } {debug 2024-08-10 11:45:35.956863 +0800 CST m=+10.291498917 composable Stopping controller for composable inputs github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:159 } {debug 2024-08-10 11:45:36.057103 +0800 CST m=+10.391738542 composable Stopped controller for composable inputs github.com/elastic/elastic-agent/internal/pkg/composable/controller.go:188 } Error: error starting service: failed to start service (co.elastic.elastic-agent): "launchctl" failed with stderr: Load failed: 5: Input/output error Try running launchctl bootstrap as root for richer errors.

For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.12/fleet-troubleshooting.html

studyworker commented 3 months ago

What can I do to fix this error?

pierrehilbert commented 3 months ago

Hello @studyworker What are the permission of the elastic-agent folder and its content? What command did you run when you got this error?

ThomasLeisi-RTS commented 2 months ago

Hello @pierrehilbert It looks like we have the same error : image

The permission on the folder : drwxr-xr-x. 3 root root 4096 Aug 14 17:53 elastic-agent-8.12.2-linux-x86_64 -rw-r--r--. 1 root root 579270426 Aug 14 17:52 elastic-agent-8.12.2-linux-x86_64.tar.gz

And the content : drwxr-xr-x. 3 root root 52 Jul 29 15:27 data lrwxrwxrwx. 1 root root 39 Feb 19 18:03 elastic-agent -> data/elastic-agent-de80b0/elastic-agent -rw-r--r--. 1 root root 11401 Feb 19 18:00 elastic-agent.reference.yml -rw-------. 1 root root 11056 Feb 19 18:00 elastic-agent.yml -rw-------. 1 root root 0 Aug 14 17:53 fleet.enc.lock -rw-r--r--. 1 root root 13675 Feb 19 17:57 LICENSE.txt -rw-r--r--. 1 root root 1047128 Feb 19 17:57 NOTICE.txt -rw-r--r--. 1 root root 302 Feb 19 18:03 README.md

And we ran this command to get this error : sudo ./elastic-agent install --url= https://xxelk04:8220/ --fleet-server-es= https://xxelk04:9200/ --fleet-server-service-token=xxxxxxxxxxx --fleet-server-policy=fleet-server-policy --certificate-authorities=/etc/elasticsearch/certificates/elasticsearch-ca.pem --fleet-server-es-ca=/etc/elasticsearch/certificates/elasticsearch-ca.pem --fleet-server-cert=/etc/elastic-agent/certificates/fleet-server.crt --fleet-server-cert-key=/etc/elastic-agent/certificates/fleet-server.key --fleet-server-port=8220

Thanks for your help

pierrehilbert commented 2 months ago

We got an issue that we fixed in 8.13.0: https://www.elastic.co/guide/en/beats/libbeat/current/release-notes-8.13.0.html I would recommend to use a more up to date Agent to get the fix and therefore no more facing this issue.

0xCyberY commented 1 month ago

Hi @pierrehilbert ,

I'm encountering the same issue while installing Elastic Agent version 8.13.4 on macOS (Darwin 15.0.1). Do you have any suggestions on how to resolve this?