aws-samples / aws-greengrass-samples

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

cgroups check does not work with cgroups2 #41

Closed convexset closed 2 years ago

convexset commented 2 years ago

At: https://github.com/aws-samples/aws-greengrass-samples/blob/master/greengrass-dependency-checker-GGCv1.11.x/check_cgroups.sh#L202

... the check looks for mounts of type cgroup but not cgroup2.

For example, lines in /proc/mounts like:

cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)

The check for memory and devices cgroups also will not work properly for cgroups 2. (The memory one passes accidentally.)

convexset commented 2 years ago

A quick fix for the memory check would use the documented interface files: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#memory

convexset commented 2 years ago

As for devices... It's going to be a little harder: https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#device-controller

Cgroup v2 device controller has no interface files and is implemented on top of cgroup BPF. To control access to device files, a user may create bpf programs of type BPF_PROG_TYPE_CGROUP_DEVICE and attach them to cgroups with BPF_CGROUP_DEVICE flag. On an attempt to access a device file, corresponding BPF programs will be executed, and depending on the return value the attempt will succeed or fail with -EPERM.

convexset commented 2 years ago

Here's a potential fix, but it would be good to have someone knowledgable validate it:

Check for v1 support:

$ grep cgroup /proc/filesystems
nodev   cgroup
nodev   cgroup2

Then try to mount the controllers.

See: https://man7.org/linux/man-pages/man7/cgroups.7.html under Mounting v1 controllers.

mkdir ./cgroups1-devices/
sudo mount -t cgroup -o devices none ./cgroups1-devices/

$ ls -lah cgroups1-devices/
total 4.0K
dr-xr-xr-x 2 root root    0 Nov 21 18:07 .
drwxr-xr-x 3 pi   pi   4.0K Nov 21 18:07 ..
-rw-r--r-- 1 root root    0 Nov 21 18:07 cgroup.clone_children
-rw-r--r-- 1 root root    0 Nov 21 18:07 cgroup.procs
-r--r--r-- 1 root root    0 Nov 21 18:07 cgroup.sane_behavior
--w------- 1 root root    0 Nov 21 18:07 devices.allow
--w------- 1 root root    0 Nov 21 18:07 devices.deny
-r--r--r-- 1 root root    0 Nov 21 18:07 devices.list
-rw-r--r-- 1 root root    0 Nov 21 18:07 notify_on_release
-rw-r--r-- 1 root root    0 Nov 21 18:07 release_agent
-rw-r--r-- 1 root root    0 Nov 21 18:07 tasks

In the failure case...

$ cat /proc/cgroups 
#subsys_name    hierarchy   num_cgroups enabled
cpuset  0   53  1
cpu 0   53  1
cpuacct 0   53  1
blkio   0   53  1
memory  0   53  1
devices 0   53  1
freezer 0   53  1
net_cls 0   53  1
perf_event  0   53  1
net_prio    0   53  1
pids    0   53  1

Note the absence of the rdma controller.

$ sudo mount -t cgroup -o rdma none ./cgroups1-rdma/
mount: /home/pi/install/greengrass-dependency-checker-GGCv1.11.x/cgroups1-rdma: wrong fs type, bad option, bad superblock on none, missing codepage or helper program, or other error.
MikeDombo commented 2 years ago

Hi Jeremy, Thank you for filing the issue. Greengrass is not written with cgroup2 support, so as far as I am aware, all the checks here are still accurate as we require and are checking for cgroup v1.

convexset commented 2 years ago

Is there any way to instruct a Raspberry Pi to use cgroup v1?

MikeDombo commented 2 years ago

If you are new to Greengrass, we highly recommend that you use Greengrass V2.

Have you tried just running Greengrass already and ignoring the dependency checker's results?

For RPi setup and installation, see https://docs.aws.amazon.com/greengrass/v1/developerguide/setup-filter.rpi.html

convexset commented 2 years ago

Ah... so the dependency checker is for v1? That leaves me with other problems where GG is working with cgroup v1 devices and not with the cgroup v2 ones... ¯_(ツ)_/¯

MikeDombo commented 2 years ago

Yes, the dependency checker is for V1 only.

In GG V2, cgroups are potentially used for 2 optional features. 1) System resource limits, 2) Lambda in container support (lambda running in NO_CONTAINER mode does not utilize cgroups)

If you are not using either of these features, then the cgroup configuration does not matter to Greengrass.

convexset commented 2 years ago

Thanks.

convexset commented 2 years ago

Just a follow up on this...

One of the BROKEN components is aws.greengrass.SNS. Here are the logs following a deploy...

... well excerpt first, then the logs...

2021-11-21T15:40:46.250Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:46.410Z [INFO] (pool-2-thread-34) aws.greengrass.SNS: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.411Z [INFO] (pool-2-thread-34) aws.greengrass.SNS: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.412Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:46 unable to setup worker process factories: The following cgroup subsystems are not mounted: devices, memory. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}

Here's what is mounted:

# mount | grep cgroup
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)

The error doesn't seem to implicate cgroups, but one wonders if anything happened along the way because this is not the sort of bug that one would expect from AWS. Any immediate thoughts? (Or just close this.)

2021-11-21T15:40:47.920Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:48.322Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:48 could not read process state file /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: open /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: no such file or directory. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN}
2021-11-21T15:40:51.051Z [ERROR] (pool-2-thread-46) aws.greengrass.SNS: error while removing dir    {"path": "/greengrass/v2/work/aws.greengrass.SNS/work/worker/0", "errorString": "unlinkat /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/overlays: device or resource busy"}. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN}

and before that...

2021-11-21T15:40:44.563Z [INFO] (Copier) aws.greengrass.SNS: Startup script exited. {exitCode=1, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:44.576Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:44.874Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:44 could not read process state file /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: open /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: no such file or directory. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}
2021-11-21T15:40:45.209Z [ERROR] (pool-2-thread-32) aws.greengrass.SNS: error while removing dir    {"path": "/greengrass/v2/work/aws.greengrass.SNS/work/worker/0", "errorString": "unlinkat /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/overlays: device or resource busy"}. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}

... now the full logs...

(py3.9) root@rpi-3b-000:/greengrass/v2/logs# cat aws.greengrass.SNS.log 
2021-11-21T15:40:37.995Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:38.586Z [INFO] (pool-2-thread-31) aws.greengrass.SNS: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:44.528Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:44 unable to setup worker process factories: The following cgroup subsystems are not mounted: devices, memory. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:44.552Z [INFO] (pool-2-thread-31) aws.greengrass.SNS: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:44.563Z [INFO] (Copier) aws.greengrass.SNS: Startup script exited. {exitCode=1, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:44.576Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:44.874Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:44 could not read process state file /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: open /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: no such file or directory. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}
2021-11-21T15:40:45.209Z [ERROR] (pool-2-thread-32) aws.greengrass.SNS: error while removing dir    {"path": "/greengrass/v2/work/aws.greengrass.SNS/work/worker/0", "errorString": "unlinkat /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/overlays: device or resource busy"}. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}
2021-11-21T15:40:46.250Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:46.410Z [INFO] (pool-2-thread-34) aws.greengrass.SNS: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.411Z [INFO] (pool-2-thread-34) aws.greengrass.SNS: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.412Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:46 unable to setup worker process factories: The following cgroup subsystems are not mounted: devices, memory. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.428Z [INFO] (Copier) aws.greengrass.SNS: Startup script exited. {exitCode=1, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:46.435Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:46.883Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:46 could not read process state file /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: open /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: no such file or directory. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}
2021-11-21T15:40:47.190Z [ERROR] (pool-2-thread-33) aws.greengrass.SNS: error while removing dir    {"path": "/greengrass/v2/work/aws.greengrass.SNS/work/worker/0", "errorString": "unlinkat /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/overlays: device or resource busy"}. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STOPPING}
2021-11-21T15:40:47.700Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:47.832Z [INFO] (pool-2-thread-44) aws.greengrass.SNS: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:47.832Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:47 unable to setup worker process factories: The following cgroup subsystems are not mounted: devices, memory. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:47.833Z [INFO] (pool-2-thread-44) aws.greengrass.SNS: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:47.912Z [INFO] (Copier) aws.greengrass.SNS: Startup script exited. {exitCode=1, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T15:40:47.920Z [INFO] (pool-2-thread-36) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T15:40:48.322Z [WARN] (Copier) aws.greengrass.SNS: stderr. 2021/11/21 23:40:48 could not read process state file /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: open /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/state.json: no such file or directory. {scriptName=services.aws.greengrass.SNS.lifecycle.shutdown.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN}
2021-11-21T15:40:51.051Z [ERROR] (pool-2-thread-46) aws.greengrass.SNS: error while removing dir    {"path": "/greengrass/v2/work/aws.greengrass.SNS/work/worker/0", "errorString": "unlinkat /greengrass/v2/work/aws.greengrass.SNS/work/worker/0/overlays: device or resource busy"}. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=BROKEN}
MikeDombo commented 2 years ago

The error is "The following cgroup subsystems are not mounted: devices, memory". So you need to configure your raspberry pi to enable the memory and device cgroup v1. Instructions to enable the memory cgroup are provided here: https://docs.aws.amazon.com/greengrass/v1/developerguide/setup-filter.rpi.html.

You may also configure that component to not use a container which then does not require any cgroups at all. See the configuration options in https://docs.aws.amazon.com/greengrass/v2/developerguide/sns-component.html#sns-component-configuration

If there are any further questions regarding enabling cgroups, I would suggest that you consider asking on the raspberry pi forums.

convexset commented 2 years ago

Yeah... well, my original /boot/cmdline.txt was:

console=serial0,115200 console=tty1 root=PARTUUID=1747a87f-02 rootfstype=ext4 fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

So that was correctly configured. I think that component was just doing the same cgroup v1 checks.

I'm rolling back to cgroup v1 by adding:

systemd.unified_cgroup_hierarchy=0

... and see what happens.

convexset commented 2 years ago

Ooooh yay...

It was a cgroup v1 v.s. cgroup v2 issue all along.

No more BROKEN components.

(py3.9) root@rpi-3b-000:/greengrass/v2/logs# cat aws.greengrass.SNS.log 
2021-11-21T16:04:52.114Z [INFO] (pool-2-thread-34) aws.greengrass.SNS: shell-runner-start. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T16:04:52.423Z [INFO] (pool-2-thread-39) aws.greengrass.SNS: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T16:04:52.443Z [INFO] (pool-2-thread-39) aws.greengrass.SNS: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T16:04:52.715Z [INFO] (Copier) aws.greengrass.SNS: stdout. Started process: 1764. {scriptName=services.aws.greengrass.SNS.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T16:04:52.733Z [INFO] (Copier) aws.greengrass.SNS: Startup script exited. {exitCode=0, serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=STARTING}
2021-11-21T16:04:53.893Z [INFO] (pool-2-thread-39) aws.greengrass.SNS: lambda_runtime.py:402,Status thread started. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=RUNNING}
2021-11-21T16:04:56.373Z [WARN] (pool-2-thread-38) aws.greengrass.SNS: ipc_client.py:163,deprecated arg port=8000 will be ignored. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=RUNNING}
2021-11-21T16:04:56.375Z [INFO] (pool-2-thread-39) aws.greengrass.SNS: lambda_runtime.py:154,Running [arn:aws:lambda:ap-southeast-1:aws:function:aws-greengrass-sns:4]. {serviceInstance=0, serviceName=aws.greengrass.SNS, currentState=RUNNING}
(py3.9) root@rpi-3b-000:/greengrass/v2/logs# cat aws.greengrass.KinesisFirehose.log 
2021-11-21T16:04:52.142Z [INFO] (pool-2-thread-27) aws.greengrass.KinesisFirehose: shell-runner-start. {scriptName=services.aws.greengrass.KinesisFirehose.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
2021-11-21T16:04:52.321Z [INFO] (pool-2-thread-35) aws.greengrass.KinesisFirehose: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=STARTING}
2021-11-21T16:04:52.358Z [INFO] (pool-2-thread-35) aws.greengrass.KinesisFirehose: Finding mounted cgroups.. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=STARTING}
2021-11-21T16:04:52.635Z [INFO] (Copier) aws.greengrass.KinesisFirehose: stdout. Started process: 1749. {scriptName=services.aws.greengrass.KinesisFirehose.lifecycle.startup.script, serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=STARTING}
2021-11-21T16:04:52.660Z [INFO] (Copier) aws.greengrass.KinesisFirehose: Startup script exited. {exitCode=0, serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=STARTING}
2021-11-21T16:04:53.900Z [INFO] (pool-2-thread-35) aws.greengrass.KinesisFirehose: lambda_runtime.py:402,Status thread started. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=RUNNING}
2021-11-21T16:04:56.381Z [WARN] (pool-2-thread-37) aws.greengrass.KinesisFirehose: ipc_client.py:163,deprecated arg port=8000 will be ignored. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=RUNNING}
2021-11-21T16:04:56.383Z [WARN] (pool-2-thread-37) aws.greengrass.KinesisFirehose: ipc_client.py:163,deprecated arg port=8000 will be ignored. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=RUNNING}
2021-11-21T16:04:56.384Z [INFO] (pool-2-thread-35) aws.greengrass.KinesisFirehose: lambda_runtime.py:154,Running [arn:aws:lambda:ap-southeast-1:aws:function:aws-greengrass-kinesisfirehose:4]. {serviceInstance=0, serviceName=aws.greengrass.KinesisFirehose, currentState=RUNNING}
convexset commented 2 years ago

I'll send a note to the documentation pages for aws.greengrass.SNS and aws.greengrass.KinesisFirehose.

edreinoso commented 1 year ago

Hey there, I'm reinitiating this thread. I'm having issues deploying a Lambda function with Greengrass container in my Raspberry Pi 4.

The issue effectively points out that the cgroups subsystems are not mounting devices and memory.

I already modified the /boot/cmdline.txt file, by adding the following: cgroup_memory=1 cgroup_enable=devices systemd.unified_cgroup_hierarchy=0 as per instructed here in this thread and also in https://docs.aws.amazon.com/greengrass/v1/developerguide/setup-filter.rpi.html

console=tty1 console=serial0,115200 root=PARTUUID=bab074d2-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cgroup_enable=memory cgroup_memory=1 cgroup_enable=devices
systemd.unified_cgroup_hierarchy=0

However, when I'm trying to deploy the component, it still fails with the same issue as presented above:

2023-10-28T06:24:57.665Z [INFO] (pool-2-thread-42) signal_processing_greengrass_lambda: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=signal_processing_greengrass_lambda, currentS
tate=STARTING}
2023-10-28T06:24:57.665Z [WARN] (Copier) signal_processing_greengrass_lambda: stderr. 2023/10/28 08:24:57 unable to setup worker process factories: The following cgroup subsystems are not mounted: d
evices, memory. {scriptName=services.signal_processing_greengrass_lambda.lifecycle.startup.script, serviceInstance=0, serviceName=signal_processing_greengrass_lambda, currentState=STARTING}
2023-10-28T06:24:57.666Z [INFO] (pool-2-thread-42) signal_processing_greengrass_lambda: Finding mounted cgroups.. {serviceInstance=0, serviceName=signal_processing_greengrass_lambda, currentState=ST
ARTING}
2023-10-28T06:24:57.724Z [INFO] (Copier) signal_processing_greengrass_lambda: Startup script exited. {exitCode=1, serviceInstance=0, serviceName=signal_processing_greengrass_lambda, currentState=STA
RTING}

This is the output of my cgroups configuration in the kernel

#subsys_name  hierarchy  num_cgroups  enabled
cpuset        0          97           1
cpu           0          97           1
cpuacct       0          97           1
blkio         0          97           1
memory        0          97           1
devices       0          97           1
freezer       0          97           1
net_cls       0          97           1
perf_event    0          97           1
net_prio      0          97           1
pids          0          97           1

Hope you're able to help me since I've facing this issue for some days now 🙏

MikeDombo commented 1 year ago

@edreinoso Please make sure that systemd.unified_cgroup_hierarchy=0 is on the same line as the rest of everything.

https://raspberrypi.stackexchange.com/questions/133781/enable-cgroups-v1-in-raspberrypi-os

Also, we do not recommend using Lambda on Greengrass V2 unless you are migrating from Greengrass V1. I would recommend that you use native Greengrass V2 components: https://docs.aws.amazon.com/greengrass/v2/developerguide/create-components.html.

You can also disable containerization of the lambda which will also work.

edreinoso commented 1 year ago

Thanks for the assit @MikeDombo. That was really helpful.