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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ