Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GGIpd only creates the socket at /var/lib/greengrass directory instead of root dir #752

Open
rawalexe opened this issue Dec 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rawalexe
Copy link
Member

rawalexe commented Dec 16, 2024

Problem statement

When rootPath is set to a different directory /var/run/greengrass/root

---
system:
  privateKeyPath: "/etc/greengrass/private.pem.key"
  rootCaPath: "/etc/greengrass/AmazonRootCA1.pem"
  certificateFilePath: "/etc/greengrass/device.pem.crt"
  rootPath: "/var/run/greengrass/root"
  thingName: "GreengrassCore"
services:
  aws.greengrass.Nucleus-Lite:
    componentType: "NUCLEUS"
    configuration:
      awsRegion: "us-east-1"
      iotCredEndpoint: "c36pqgka8u7mfv.credentials.iot.us-east-1.amazonaws.com"
      iotDataEndpoint: "a1vhby2320em2m-ats.iot.us-east-1.amazonaws.com"
      iotRoleAlias: "GreengrassCoreTokenExchangeRoleAlias"
      runWithDefault:
        posixUser: "root:root"
      greengrassDataPlanePort: "8443"
      tesCredUrl: "http://127.0.0.1:8080/"

ggipcd logs the correct path,

Dec 12 21:54:59 ip-172-31-18-78 ggipcd[94082]: I[ggipcd] entry.c:46: gg-ipc.socket
Dec 12 21:54:59 ip-172-31-18-78 ggipcd[94082]: I[ggipcd] entry.c:47: /var/run/greengrass/root/gg-ipc.socket

But the socket is created in /var/lib/greengrass instead of /var/run/greengrass/root

ubuntu@ip-172-31-18-78:~$ ls /var/lib/greengrass/
config.db  gg-ipc.socket
ubuntu@ip-172-31-18-78:~$ ls /var/run/greengrass/root/
ggl.com.example.ExportVars.install.service  ggl.com.example.ExportVars.script.run  packages
ggl.com.example.ExportVars.script.install   ggl.com.example.ExportVars.service     work

The problem is that the systemd file for the component has the wrong location set in AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT

[Unit]
StartLimitInterval=3600
StartLimitBurst=3
Description=A component that only export the vars passed to it.
Wants=ggl.core.ggipcd.service
After=ggl.core.ggipcd.service

[Service]
Restart=on-failure
RestartSec=1
WorkingDirectory=/run/greengrass/root/work/com.example.ExportVars
Environment="AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT=/run/greengrass/root/gg-ipc.socket"
Type=exec
ExecStart=/usr/local/bin/recipe-runner -n com.example.ExportVars -v 1.0.11 -p /run/greengrass/root/ggl.com.example.ExportVars.script.run
User=root
Group=root

[Install]
WantedBy=greengrass-lite.target

Remediation

Always set root directory as /var/lib/greengrass

@rawalexe rawalexe added bug Something isn't working and removed bug Something isn't working labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant