Jtop and AWS Greengrass V2

Hi,

We are deploying a Greengrass v2 component formed by 2 python scripts. One of them uses jtop python module to read different values from hardware, for example CPU or GPU temperatures.

This is the Greengrass component recipe we are using:

{
  "RecipeFormatVersion": "2020-01-25",
  "ComponentName": "com.example.HelloWorld",
  "ComponentVersion": "1.1.2",
  "ComponentType": "aws.greengrass.generic",
  "ComponentDescription": "My first AWS IoT Greengrass component.",
  "ComponentPublisher": "Amazon",
  "ComponentConfiguration": {
    "DefaultConfiguration": {
      "Message": ""
    }
  },
  "Manifests": [
    {
      "Platform": {
        "os": "linux"
      },
      "Name": "Linux",
      "Lifecycle": {
        "Run": "python3 {artifacts:path}/aws_jetson_reporte_estado.py"
      },
      "Artifacts": [
        {
          "Uri": "s3://pruebagreengrass/aws_jetson_reporte_estado.py",
          "Digest": "",
          "Algorithm": "SHA-256",
          "Unarchive": "NONE",
          "Permission": {
            "Read": "OWNER",
            "Execute": "NONE"
          }
        },
        {
          "Uri": "s3://pruebagreengrass/utils.py",
          "Digest": "",
          "Algorithm": "SHA-256",
          "Unarchive": "NONE",
          "Permission": {
            "Read": "OWNER",
            "Execute": "NONE"
          }
        }
      ]
    }
  ],
  "Lifecycle": {}
}

However, when we deploy Greengrass component into the Jetson we get an error related to jtop:

[WARN] (Copier) com.example.HelloWorld: stderr. raise JtopException(“I can’t access to jetson_stats.service.\nPlease logout or reboot this board.”). {scriptName=services.com.example.HelloWorld.lifecycle.Run, serviceName=com.example.HelloWorld, currentState=RUNNING}
[WARN] (Copier) com.example.HelloWorld: stderr. jtop.core.exceptions.JtopException: I can’t access to jetson_stats.service… {scriptName=services.com.example.HelloWorld.lifecycle.Run, serviceName=com.example.HelloWorld, currentState=RUNNING}
[WARN] (Copier) com.example.HelloWorld: stderr. Please logout or reboot this board… {scriptName=services.com.example.HelloWorld.lifecycle.Run, serviceName=com.example.HelloWorld, currentState=RUNNING}

Do you know what is causing the problem or how to solve it?

Thanks in advanced.

Hi,

Do you meet the error=13 (Permission denied)?
If yes, please check if you have the required authority.

On Jetson, you will need root permission to get the data under /sys/...

Thanks.

Thank you very much! That was the problem.
Executing the script with root permission, it works.
I added a parameter called “RequiresPrivilege” to “Run” field on the Greengrass component recipe to execute the scripts with root permission:

"Run": {
    "Script": "python3 {artifacts:path}/aws_jetson_reporte_estado.py",
    "RequiresPrivilege": true
}