- Newest
- Most votes
- Most comments
As with many of these things, this was human error on my behalf.
I have an overlay on systemd so that I can keep my rootfs read only and store the greengrass systemd unit symlinks on a data partition so they survive OS updates.
This overlay was loading later than greengrass-lite.target, therefore it did not see the component unit at boot time.
I've fixed the timing of my overlay to run before greengrass-lite.target and things seem to be behaving now.
Apologies for the noise!
answered 9 months ago
To ensure your Greengrass v2 component starts automatically at boot time, you need to modify your component recipe to include a startup lifecycle step rather than just a run step.
In AWS IoT Greengrass v2, the startup lifecycle is specifically designed for processes that need to start when the component starts and must exit successfully (or update their status to RUNNING) before dependent components can start. The startup step is what ensures your component starts automatically at boot time.
Here's how you should modify your component recipe:
{
"RecipeFormatVersion": "2020-01-25",
"ComponentName": "com.rho.demo-app",
"ComponentVersion": "1.0.6",
"ComponentDescription": "RHO Demo App - Basic MQTT Publisher",
"ComponentPublisher": "Sensoteq",
"ComponentConfiguration": {
"DefaultConfiguration": {
"Debug": false
}
},
"Manifests": [
{
"Platform": {
"os": "linux",
"architecture": "aarch64",
"runtime": "aws_nucleus_lite"
},
"Lifecycle": {
"install": {
"Script": "chmod +x {artifacts:path}/rho-demo-app",
"RequiresPrivilege": true
},
"startup": {
"Script": "{artifacts:path}/rho-demo-app",
"RequiresPrivilege": false
}
},
"Artifacts": [
{
"Uri": "s3://rho-greengrass-components/rho-demo-app",
"Digest": "c0ee8796df3d4ba844cfff0f7085b6341451efcfef030714d5343d75d8e4e81b",
"Algorithm": "SHA-256",
"Unarchive": "NONE",
"Permission": {
"Execute": "OWNER"
}
}
]
}
]
}
The key change is replacing the run lifecycle step with a startup lifecycle step. This tells Greengrass to start your component when the Greengrass core starts, including at system boot.
After making this change, create a new version of your component and deploy it to your device. Your component should then start automatically when the device boots up.
Sources
AWS IoT Greengrass component recipe reference - AWS IoT Greengrass
answered 10 months ago
Hi - thanks for your response.
I tried startup before, and I ran into an issue where the deployment always said "In Progress" and never moved to "Succeeded" and also, I found that the component did not start on a reboot.
That said, I was working quickly so I will go back to the start and try it again on a clean device.
Ok - I switched to using startup as you suggested.
"Lifecycle": { "startup": "{artifacts:path}/rho-demo-app" },As before, this runs, but the deployment eventually fails:
Oct 30 17:23:38 rho-device-5d704731 ggdeploymentd[470]: E[ggdeploymentd] deployment_handler.c:2248: com.rho.demo-app is broken. Oct 30 17:23:38 rho-device-5d704731 ggdeploymentd[470]: E[ggdeploymentd] deployment_handler.c:2343: Failed waiting for com.rho.demo-app Oct 30 17:23:38 rho-device-5d704731 ggdeploymentd[470]: W[ggdeploymentd] deployment_handler.c:3355: Completed deployment processing and reporting job as FAILED. Oct 30 17:23:38 rho-device-5d704731 ggdeploymentd[470]: I[ggdeploymentd] iot_jobs_listener.c:172: Got message from IoT Core; topic: $aws/things/rho-device-5d704731/jobs/notify-next-namespace-aws-gg-deployment, payload: {"timestamp":1761845018}.Also, I noticed that while my binary is running, the service always stays in the
activatingstate:# systemctl status ggl.com.rho.demo-app.service * ggl.com.rho.demo-app.service - RHO Demo App Loaded: loaded (/etc/systemd/system/ggl.com.rho.demo-app.service; enabled; preset: disabled) Active: activating (start) since Thu 2025-10-30 17:21:35 UTC; 1min 48s ago Main PID: 759 (5) Tasks: 10 (limit: 466) Memory: 6.9M (peak: 7.6M) CPU: 219ms CGroup: /system.slice/ggl.com.rho.demo-app.service |-759 /bin/sh /dev/fd/5 `-761 /var/lib/greengrass/packages/artifacts/com.rho.demo-app/1.0.9//rho-demo-appsystemd restarts it every few mins.
Do I need to report my status via IPC for this to work? Or do I need to give my recipe permissions so that the recipe runner can do that for me?
Is there an example of a similar component with restart that you know of?
Relevant content
asked 2 years ago
asked 3 years ago
asked 2 years ago
asked 3 years ago
- AWS OFFICIALUpdated 9 months ago

After rebooting, is Greengrass running? The recipe looks fine and I'd expect the component to be started when rebooting.
On a side note, I don't think you need the install step as you have execute permissions on the artifact. Was the component not working without this step?
@PatrickZ-AWS yes greengrass is running. Regards the install step, I think I was just trying to be smarter than I am, I see how it's meaningless with the EXECUTE step
I saw from the other comment that you were going to retry with a fresh device--were you seeing the same behavior there or has the issue been resolved?
Sorry @PatrickZ-AWS - been on a few days vacation, going to try this in the next 24 hours so will feed back.
From the comment below, I think I need to use
startupinstead ofrun.As I am running a binary that does not exit, I either need to add a startup script that exits or use the UpdateState IPC operation. I will look into the latter.
@PatrickZ-AWS - is there a reference for the IPC? I am using Golang and I don't see SDK support for that.