aws/amazon-cloudwatch-agent

Failed to start CloudWatch agent on ubuntu22.04

tangzhiqiangh opened this issue · 2 comments

Software package download

wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb

amazon-cloudwatch-agent version

dpkg: version 1.300032.2b361-1 of amazon-cloudwatch-agent already installed, skipping

Run the installation command

sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json

processing amazon-cloudwatch-agent 2024/01/08 09:45:20 E! Failed to open Common Config: open /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml: no such file or directory

No errors occurred while installing the software. There is only an empty directory amazon-cloudwatch-agent.d in the etc directory. After manually editing the configuration file amazon-cloudwatch-agent.json and starting the agent, an error is reported but there is no "/opt/aws/amazon-cloudwatch-agent/etc/common-config.toml" ” Is it a problem with this version?

I was not able to reproduce the issue with on a new EC2 instance and downloading version 1.300032.2b361-1 or the latest release.

> ubuntu@:/tmp$ wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/1.300032.2b361/amazon-cloudwatch-agent.deb

> ubuntu@:/tmp$ sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
Selecting previously unselected package amazon-cloudwatch-agent.
(Reading database ... 66035 files and directories currently installed.)
Preparing to unpack ./amazon-cloudwatch-agent.deb ...
Unpacking amazon-cloudwatch-agent (1.300032.2b361-1) ...
Setting up amazon-cloudwatch-agent (1.300032.2b361-1) ...

> ubuntu@:/tmp$ sudo dpkg -l amazon-cloudwatch-agent
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture Description
+++-=======================-================-============-=================================
ii  amazon-cloudwatch-agent 1.300032.2b361-1 arm64        Amazon CloudWatch Agent

> ubuntu@:/opt/aws/amazon-cloudwatch-agent/etc$ ls
amazon-cloudwatch-agent.d  common-config.toml

If the common-config.toml file was deleted, running sudo dpkg -i -E ./amazon-cloudwatch-agent.deb will not recreate it. You will need to do a fresh re-install (sudo dpkg -P amazon-cloudwatch-agent to purge the package before reinstalling). Would recommend moving your JSON configuration file outside of the agent directories as well.