Error while running the IoT Demo tutorial on Raspberry Pi4

0

I am going through the AWS IoT tutorial for Building Demos, using Raspberry Pi. I was able to successfully carry out steps till https://docs.aws.amazon.com/iot/latest/developerguide/iot-dc-install-configure.html whereas when I run the following commands from the turorial: cd ~/aws-iot-device-client/build ./aws-iot-device-client --config-file ~/dc-configs/dc-testconn-config.json

I get the following error:

2022-05-18T06:21:41.735Z [DEBUG] {Config.cpp}: Did not find a runtime configuration file, assuming Fleet Provisioning has not run for this device 2022-05-18T06:21:41.735Z [DEBUG] {EnvUtils.cpp}: Updated PATH environment variable to: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/pi/.local/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-05-18T06:21:41.736Z [INFO] {Main.cpp}: Now running AWS IoT Device Client version v1.6.7-532a710 2022-05-18T06:21:41.749Z [ERROR] {FileUtils.cpp}: Failed to create directory /var/log/aws-iot-device-client/ 2022-05-18T06:21:41.749Z [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

asked 2 years ago293 views
1 Answer
1
Accepted Answer

Hi. It's a permission issue. Assuming you are running Device Client as user pi, it doesn't have permissions to create the /var/log/aws-iot-device-client directory. (If you accepted the default configuration, that's where the log file will go.)

I have Device Client running on an RPi4. I can't remember if I took a few steps not documented in that tutorial. However, if you run the following commands, I think you will be able to progress (assuming you are user pi):

sudo mkdir /var/log/aws-iot-device-client
sudo chmod 745 /var/log/aws-iot-device-client
sudo chown pi:pi /var/log/aws-iot-device-client

That will create the directory and make pi the owner. The 745 is as documented here: https://github.com/awslabs/aws-iot-device-client/blob/main/docs/PERMISSIONS.md

Then Device Client will be able to write logs there if you run Device Client as user pi.

profile pictureAWS
EXPERT
Greg_B
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions