Greengrass Fleet Provisioning error

0

Hi, I went through all path of setting up a Fleet: https://docs.aws.amazon.com/greengrass/v2/developerguide/fleet-provisioning-setup.html https://docs.aws.amazon.com/greengrass/v2/developerguide/fleet-provisioning.html

This is the error log I am getting:

2024-03-13T15:41:52.174Z [INFO] (pool-3-thread-1) com.aws.greengrass.lifecyclemanager.KernelLifecycle: Running provisioning plugin: aws.greengrass.FleetProvisioningByClaim. {}
2024-03-13T15:41:52.182Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=aws.greengrass.Nucleus}
2024-03-13T15:41:52.246Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=main}
2024-03-13T15:41:52.275Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=UpdateSystemPolicyService}
2024-03-13T15:41:52.283Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=DeploymentService}
2024-03-13T15:41:52.392Z [WARN] (main) com.aws.greengrass.status.FleetStatusService: Device not configured to talk to AWS IoT cloud. FleetStatusService is offline. {errorMessage=[thingName cannot be empty, certificateFilePath cannot be empty, privateKeyPath cannot be empty, rootCaPath cannot be empty, iotDataEndpoint cannot be empty, iotCredEndpoint cannot be empty], serviceName=FleetStatusService, currentState=NEW}
2024-03-13T15:41:52.393Z [WARN] (main) com.aws.greengrass.status.FleetStatusService: Device not configured to talk to AWS IoT cloud. FleetStatusService is offline. {errorMessage=[thingName cannot be empty, certificateFilePath cannot be empty, privateKeyPath cannot be empty, rootCaPath cannot be empty, iotDataEndpoint cannot be empty, iotCredEndpoint cannot be empty], serviceName=FleetStatusService, currentState=NEW}
2024-03-13T15:41:52.406Z [WARN] (main) com.aws.greengrass.deployment.IotJobsHelper: Device not configured to talk to AWS Iot cloud. IOT job deployment is offline. {errorMessage=[thingName cannot be empty, certificateFilePath cannot be empty, privateKeyPath cannot be empty, rootCaPath cannot be empty, iotDataEndpoint cannot be empty, iotCredEndpoint cannot be empty]}
2024-03-13T15:41:52.414Z [WARN] (main) com.aws.greengrass.deployment.ShadowDeploymentListener: Device not configured to talk to AWS Iot cloud. Single device deployment is offline. {}
2024-03-13T15:41:52.415Z [INFO] (main) com.aws.greengrass.lifecyclemanager.Kernel: Attempt to load service from plugins. {serviceName=TelemetryAgent}
2024-03-13T15:41:52.478Z [WARN] (Thread-4) com.aws.greengrass.MqttConnectionHelper: Connection interrupted: . {errorCode=The connection was closed unexpectedly.}
2024-03-13T15:41:52.478Z [ERROR] (pool-3-thread-1) com.aws.greengrass.FutureExceptionHandler: Failed to subscribe to create keys and certificate accepted topic. {}
java.util.concurrent.ExecutionException: software.amazon.awssdk.crt.mqtt.MqttException: Old requests from the previous session are cancelled, and offline request will not be accept.

My config.yaml template seems fine (I replace before launching installation):

---
services:
  aws.greengrass.Nucleus:
    version: "REPLACE_NUCLEUS_VERSION"
    configuration:
      awsRegion: "eu-central-1"
  aws.greengrass.FleetProvisioningByClaim:
    configuration:
      rootPath: "/greengrass/v2"
      awsRegion: "eu-central-1"
      iotDataEndpoint: my-data-endpoint.iot.eu-central-1.amazonaws.com
      iotCredentialEndpoint: "my-cred-endpont.credentials.iot.eu-central-1.amazonaws.com"
      iotRoleAlias: "GreengrassCoreXGateTokenExchangeRoleAlias"
      provisioningTemplate: "GGXGateFleetProvisioningTemplate"
      claimCertificatePath: "/greengrass/v2/claim-certs/claim.pem.crt"
      claimCertificatePrivateKeyPath: "/greengrass/v2/claim-certs/claim.private.pem.key"
      rootCaPath: "/greengrass/v2/AmazonRootCA1.pem"
      templateParameters:
        ThingName: "REPLACE_THING_NAME"
        ThingGroupName: "xeye"

If I check the generated /greengrass/v2/config/effictiveConfig.yaml I see that system section values are empty as logged:

---
system:
  certificateFilePath: ""
  privateKeyPath: ""
  rootCaPath: ""
  rootpath: "/greengrass/v2"
  thingName: ""
services:
  aws.greengrass.FleetProvisioningByClaim:
    configuration:
      awsRegion: "eu-central-1"
      claimCertificatePath: "/greengrass/v2/claim-certs/claim.pem.crt"
      claimCertificatePrivateKeyPath: "/greengrass/v2/claim-certs/claim.private.pem.key"
      iotCredentialEndpoint: "my-cred-endpoint.credentials.iot.eu-central-1.amazonaws.com"
      iotDataEndpoint: "my-data-endpoint.iot.eu-central-1.amazonaws.com"
      iotRoleAlias: "GreengrassCoreXGateTokenExchangeRoleAlias"
      provisioningTemplate: "GGXGateFleetProvisioningTemplate"
      rootCaPath: "/greengrass/v2/AmazonRootCA1.pem"
      rootPath: "/greengrass/v2"
      templateParameters:
        ThingGroupName: "xgate"
        ThingName: "thinguniqueid"
  aws.greengrass.Nucleus:
    componentType: "NUCLEUS"
    configuration:
      awsRegion: "eu-central-1"
      componentStoreMaxSizeBytes: 10000000000
      deploymentPollingFrequencySeconds: 15
...

Any help will be appreciated, thanks!

Added: Installation script

#!/bin/bash
set -e # exit on non-zero command

echo "Script for Greengrass installation started"
# Copy on /etc/init.d/install_greengrass.sh
# and link on
# sudo ln -s /etc/init.d/install_greengrass.sh /etc/rc5.d/S99install_greengrass

GG_INSTALLER_FOLDER=/root/GreengrassInstaller

exit_if_empty() {
	# 1st arg: string to check
	# 2nd arg: error message
	if [[ -z "$1" ]]; then
		echo "Empty string error: $2"
		exit 1
	fi
}

file_yaml="/greengrass/v2/claim-certs/device-config.yaml"

# Id of device
if [ -e "/proc/device-tree/som/uniqueid" ]; then
	IDENTIFIER=$(cat /proc/device-tree/som/uniqueid)
else
	# fallback using mac address
	first_interface=$(ls /sys/class/net | sort | head -n 1)
	mac_address=$(cat /sys/class/net/${first_interface}/address)
	IDENTIFIER=${mac_address}
fi

exit_if_empty "$IDENTIFIER" "Cannot retrieve a valid identifier"
# replace thing name on template
sed -i "s/REPLACE_THING_NAME/xgate-$IDENTIFIER/g" "$file_yaml"

# replace nucleus version
NUCLEUS_VERSION=$(java -jar /root/GreengrassInstaller/lib/Greengrass.jar --version | grep -oP '(?<=v)\d+\.\d+\.\d+$')
exit_if_empty "$NUCLEUS_VERSION" "Cannot retrieve Nucleus version"
sed -i "s/NUCLEUS_VERSION/$NUCLEUS_VERSION/g" "$file_yaml"

sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE \
	-jar ${GG_INSTALLER_FOLDER}/lib/Greengrass.jar \
	--trusted-plugin /root/aws.greengrass.FleetProvisioningByClaim.jar \
	--init-config /greengrass/v2/claim-certs/device-config.yaml \
	--component-default-user ggc_user:ggc_group \
	--setup-system-service true

# Installation done, Remove init script
rm /etc/rc5.d/S99install_greengrass
rm /etc/init.d/install_greengrass.sh
rm -rf ${GG_INSTALLER_FOLDER}
echo "Script for Greengrass installation succeeded"
  • what command did you use to install gg? config looks good to me

  • Hi Joseph, I added the installation script with the command I perform to install GG, thanks for your help!

  • Can you share the output of the installation command if you're still facing the issue?

asked a month ago128 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions