From e60786dbfe49e92df0cb79f07ae02088c0322bdb Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Thu, 18 Dec 2025 13:13:03 -0500 Subject: [PATCH] [BuildImage] On Ubuntu, disable snap refresh during AMI build process to prevent background updates of SSM agent that could lead to reboot failures. --- CHANGELOG.md | 1 + .../resources/imagebuilder/parallelcluster.yaml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b78134f882..1d17525bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ CHANGELOG - Add GetFunction and GetPolicy permissions to PClusterBuildImageCleanupRole to prevent AccessDenied errors during build image stack deletion. - Fix validation error messages when `DevSettings` is null or `DevSettings/InstanceTypesData` is missing required fields. - Fix an issue where cfn-hup enters an endless loop on the head node after a rollback to a cluster state older than 24 hours, caused by cfn-signal failing to signal an expired wait condition handle. +- Disable snap auto-refresh on Ubuntu during build image to prevent intermittent reboot failures. 3.14.0 ------ diff --git a/cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml b/cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml index 70b66cde2c..56296f73cf 100644 --- a/cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml +++ b/cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml @@ -34,6 +34,19 @@ phases: *) echo "Unsupported OS: $RELEASE" && exit {{ FailExitCode }} ;; esac + # Disable snap refresh to prevent background updates during build (Ubuntu only) + - name: DisableSnapRefresh + action: ExecuteBash + inputs: + commands: + - | + set -x + OS="{{ build.OperatingSystemName.outputs.stdout }}" + if [[ $OS =~ ^ubuntu ]]; then + snap watch --last=auto-refresh 2>/dev/null || true + snap refresh --hold + fi + # Initialize system information and URLs - name: SystemInfo action: ExecuteBash @@ -260,6 +273,10 @@ phases: echo "SSM agent is installed by default" fi + if [[ $OS =~ ^ubuntu ]]; then + snap refresh --unhold + fi + # Final cleanup rm -f /opt/parallelcluster/system_info /usr/local/sbin/ami_cleanup.sh "${CfnParamIsOfficialAmiBuild}"