Aws Iot Device Client Setup not working

0

Hello, i have been trying to setup a rpi using the tutorials here and when i run the command ./aws-iot-device-client --config-file ~/dc-configs/dc-testconn-config.json i am getting errors on the terminal saying that the aws crt sdk is not found with a fatal error like this

2022-04-11T07:38:13.850Z [WARN]  {Config.cpp}: Key {template-name} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.850Z [WARN]  {Config.cpp}: Key {csr-file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.850Z [WARN]  {Config.cpp}: Key {device-key} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.850Z [WARN]  {Config.cpp}: Key {file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.850Z [WARN]  {Config.cpp}: Key {publish-file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.851Z [WARN]  {Config.cpp}: Key {subscribe-file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.851Z [WARN]  {Config.cpp}: Shadow Name {shadow-name} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.851Z [WARN]  {Config.cpp}: Input file {shadow-input-file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.851Z [WARN]  {Config.cpp}: Output file {shadow-output-file} was provided in the JSON configuration file with an empty value
2022-04-11T07:38:13.851Z [INFO]  {Config.cpp}: Successfully fetched JSON config file: {
  "endpoint": "a32vqcn021ykiy-ats.iot.ap-south-1.amazonaws.com",
  "cert": "~/certs/testconn/device.pem.crt",
  "key": "~/certs/testconn/private.pem.key",
  "root-ca": "~/certs/AmazonRootCA1.pem",
  "thing-name": "Triton_Dp_Office",
  "logging": {
    "enable-sdk-logging": true,
    "level": "DEBUG",
    "type": "STDOUT",
    "file": ""
  },
  "jobs": {
    "enabled": false,
    "handler-directory": ""
  },
  "tunneling": {
    "enabled": false
  },
  "device-defender": {
    "enabled": false,
    "interval": 300
  },
  "fleet-provisioning": {
    "enabled": false,
    "template-name": "",
    "template-parameters": "",
    "csr-file": "",
    "device-key": ""
  },
  "samples": {
    "pub-sub": {
      "enabled": true,
      "publish-topic": "test/dc/pubtopic",
      "publish-file": "",
      "subscribe-topic": "test/dc/subtopic",
      "subscribe-file": ""
    }
  },
  "config-shadow": {
    "enabled": false
  },
  "sample-shadow": {
    "enabled": false,
    "shadow-name": "",
    "shadow-input-file": "",
    "shadow-output-file": ""
  }
}

2022-04-11T07:38:13.851Z [DEBUG] {Config.cpp}: Did not find a runtime configuration file, assuming Fleet Provisioning has not run for this device
2022-04-11T07:38:13.852Z [DEBUG] {EnvUtils.cpp}: Updated PATH environment variable to: /home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/snap/bin:/home/pi/.aws-iot-device-client:/home/pi/.aws-iot-device-client/jobs:/home/pi/aws-iot-device-client/build:/home/pi/aws-iot-device-client/build/jobs
2022-04-11T07:38:13.852Z [INFO]  {Main.cpp}: Now running AWS IoT Device Client version v1.5.19-868465b
2022-04-11T07:38:13.860Z [ERROR] {FileUtils.cpp}: Failed to create empty file: /var/log/aws-iot-device-client/sdk.log errno: 17 msg: File exists
2022-04-11T07:38:13.860Z [ERROR] {Main.cpp}: *** AWS IOT DEVICE CLIENT FATAL ERROR: Failed to initialize AWS CRT SDK.
AWS IoT Device Client must abort execution, reason: Failed to initialize AWS CRT SDK
Please check the AWS IoT Device Client logs for more information
Aborted

I need this setup asap to work on deploying a fleet and test out AWS IOT Jobs. Any help is appreciated.

1 Resposta
0
Resposta aceita

Hi Subham. I followed the tutorial and it worked for me. The error you're suffering occurs here: https://github.com/awslabs/aws-iot-device-client/blob/main/source/SharedCrtResourceManager.cpp#L135

    if (!FileUtils::FileExists(logFilePath))
    {
        // Create an empty file with the expected permissions.
        if (!FileUtils::CreateEmptyFileWithPermissions(logFilePath, S_IRUSR | S_IWUSR))
        {
            return false;
        }
    }

FileExists() is returning false, but evidently the file does indeed exist. I think the FileExists() method is maybe hitting a failbit, badbit or eofbit.

I think you should reboot the RPi so it runs fsck. And if the problem persists, delete the log and try again: rm /var/log/aws-iot-device-client/sdk.log

You could also set enable-sdk-logging to false in the configuration, to bypass this file check and creation altogether.

profile pictureAWS
ESPECIALISTA
Greg_B
respondido há 2 anos
  • Hey Greg, the deleting the log worked for me and i can now run the client on the device and publish the jobs. Thanks much for the help

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas