diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ad4ba70cd..2a56e2382a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ CHANGELOG - Reduce EFA installation time for Ubuntu by ~20 minutes by only holding kernel packages for the installed kernel. - 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. +- 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..eb25b13bda 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 ]] && command -v snap &>/dev/null; then + snap watch --last=auto-refresh 2>/dev/null || true + snap refresh --hold && mkdir -p /opt/parallelcluster && touch /opt/parallelcluster/pcluster_build_image_snap_hold + fi + # Initialize system information and URLs - name: SystemInfo action: ExecuteBash @@ -260,6 +273,11 @@ phases: echo "SSM agent is installed by default" fi + if [[ -f /opt/parallelcluster/pcluster_build_image_snap_hold ]]; then + snap refresh --unhold 2>/dev/null || true + rm -rf /opt/parallelcluster/pcluster_build_image_snap_hold + fi + # Final cleanup rm -f /opt/parallelcluster/system_info /usr/local/sbin/ami_cleanup.sh "${CfnParamIsOfficialAmiBuild}"