Mounting file volumes for containerized Lambda running inside Greengrass v2

0

I have my containerized Lambda function running well inside Greengrass v2.

I already use a file volume mounted as below I was wrong, this was in fact a directory

            {
              "sourcePath": "/local/path/to/my/file",
              "destinationPath": "/file",
              "addGroupOwner": true,
              "permission": "rw"
            }

but when I try to mount additional file volumes for certain libraries I need in /usr/lib/ it won't work. The files won't show up when listed.

            {
              "sourcePath": "/local/path/to/my/library/librfidapi32.so",
              "destinationPath": "/usr/lib/librfidapi32.so",
              "addGroupOwner": true,
              "permission": "ro"
            }

Can you spot what I'm doing wrong? Thank you.

  • Please make sure that you reset the configuration in the deployment after changing it: https://docs.aws.amazon.com/greengrass/v2/developerguide/troubleshooting.html#update-component-configuration-to-default-configuration.

    I would recommend using native Greengrass components instead of lambda if you are not migrating from Greengrass v1. Native components allow you to do anything at all.

  • We are indeed migrating from Greengrass v1...

  • Ok that's great then. Please make sure you follow the troubleshooting entry to use reset when changing configuration. After you do that, please report back if the issue is resolved.

  • I did notice configuration not updating but don't quite understand. Every time I make a change to the lambda function or component configuration I use a different version for the component. Then I deploy this new version of the component. So, do I need both "reset" and "merge" in the "configurationUpdate" in order to force greengrass to pick it up?

2개 답변
1
수락된 답변

Answering this myself since although helpful @MichaelDombrowski-AWS's answer does not respond the original question directly.

First of all I think it's not possible to mount a file as I'm getting permission denied errors even when using a dir that does not exist:

error mounting "/local/path/to/my/library/librfidapi32.so" to rootfs at "/usr/zebra_lib/librfidapi32.so": mkdir /path/to/greengrass/v2/work/component-name/work/worker/2m7-vhzx_NF0BmR4iCS-VDoZAh5eZ1Ct5D5BcWk_duQ/rootfs/merged/usr/zebra_lib: permission denied. {serviceInstance=0, serviceName=component-name, currentState=STARTING}

The workaround was to mount the underlying directory and set LD_LIBRARY_PATH environment variable to it:

      "linuxProcessParams": {
        "containerParams": {
          "volumes": [
            {
              "sourcePath": "/local/path/to/my/libraries",
              "destinationPath": "/zebra_libs",
              "addGroupOwner": false,
              "permission": "ro"
            }
          ]
        }
      },
      "environmentVariables": {
        "LD_LIBRARY_PATH": "/zebra_libs"
      }
답변함 2달 전
profile picture
전문가
검토됨 2달 전
1

Hi,

When you make a new component version that has a changed DefaultConfiguration (this includes anytime you make a new Lambda component with different settings), you must use RESET: [""] in the deployment to use the new defaults. Reset will remove the configuration currently on the device and instead use the new default values. Default configuration is only applied when there is no configuration present (eg. you're deploying the component for the first time on a given device).

Use MERGE to update the configuration without making a new component version and changing the defaults.

Read more in:

Cheers,

Michael

AWS
전문가
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠