aws-samples / aws-greengrass-samples

Samples for AWS Greengrass
MIT No Attribution
96 stars 68 forks source link

runtime error: invalid memory address or nil pointer dereference #19

Closed xbwei closed 4 years ago

xbwei commented 5 years ago

Hi everyone, I am trying greengrass following this tutorial on my Raspberry Pi (a new SD card with the latest Raspbian Stretch). I did all the steps and passed the dependency check.

When I tried to start the greengrass by: cd /greengrass/ggc/core/ sudo ./greengrassd start

I got the following error:

Setting up greengrass daemon
Validating hardlink/softlink protection
Waiting for up to 40s for Daemon to start
runtime error: invalid memory address or nil pointer dereference
The Greengrass daemon process with [pid = #my pid#] died

Any help is highly appreciated!

panjinbo commented 5 years ago

Hi can you make sure all ca path in confit.json is valid path?

xbwei commented 5 years ago

Hi @panjinbo, thanks for your reply. Bellow is the confit.json, and all the folders (certs, config, ggc, ota) are in the home\pi\greengrass\greengrass folder. It looks right to me.

{
  "coreThing" : {
    "caPath" : "root.ca.pem",
    "certPath" : "7###2.cert.pem",
    "keyPath" : "7###2.private.key",
    "thingArn" : "arn:aws:iot:us-east-1:4###3:thing/MyFirstGroup_Core",
    "iotHost" : "a###v-ats.iot.us-east-1.amazonaws.com",
    "ggHost" : "greengrass-ats.iot.us-east-1.amazonaws.com",
    "keepAlive" : 600
  },
  "runtime" : {
    "cgroup" : {
      "useSystemd" : "yes"
    }
  },
  "managedRespawn" : false,
  "crypto" : {
    "principals" : {
      "SecretsManager" : {
        "privateKeyPath" : "file:///greengrass/certs/7###2.private.key"
      },
      "IoTCertificate" : {
        "privateKeyPath" : "file:///greengrass/certs/7###2.private.key",
        "certificatePath" : "file:///greengrass/certs/7###2.cert.pem"
      }
    },
    "caPath" : "file:///greengrass/certs/root.ca.pem"
  }
}
panjinbo commented 5 years ago

Please just use the correct path in all certificate path ( your path should look like /home/pi/greengrass/greengrass/certs/... )

And we encourage to install greengrass at location /greengrass. https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-device-start.html Please refer to this tutorial.

xbwei commented 5 years ago

Thanks, @panjinbo , it is working now. Cheers!

amenzhinsky commented 5 years ago

Seeing the same problem but with the latest docker image:

docker run --rm --init -it --name aws-iot-greengrass --entrypoint /greengrass-entrypoint.sh -v $PWD/certs:/greengrass/certs -v $PWD/config:/greengrass/config -p 8883:8883 amazon/aws-iot-greengrass

Setting up greengrass daemon
Validating hardlink/softlink protection
Waiting for up to 40s for Daemon to start
runtime error: invalid memory address or nil pointer dereference
The Greengrass daemon process with [pid = 11] died

certs and config dirs and their content are untouched after extracting them from the resources archive that I downloaded after a core creation.

amenzhinsky commented 5 years ago

Figured that out, root.ca.crt was missing in certs dir, the error is kind of confusing though.