Skip to content

Commit 8ad0549

Browse files
committed
[BuildImage] On Ubuntu, disable snap refresh during AMI build process
to prevent background updates of SSM agent that could lead to reboot failures.
1 parent 820e0d9 commit 8ad0549

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CHANGELOG
2525
- Add GetFunction and GetPolicy permissions to PClusterBuildImageCleanupRole to prevent AccessDenied errors during build image stack deletion.
2626
- Fix validation error messages when `DevSettings` is null or `DevSettings/InstanceTypesData` is missing required fields.
2727
- 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.
28+
- Disable snap auto-refresh on Ubuntu during build image to prevent intermittent reboot failures.
2829

2930
3.14.0
3031
------

cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ phases:
3434
*) echo "Unsupported OS: $RELEASE" && exit {{ FailExitCode }} ;;
3535
esac
3636
37+
# Disable snap refresh to prevent background updates during build (Ubuntu only)
38+
- name: DisableSnapRefresh
39+
action: ExecuteBash
40+
inputs:
41+
commands:
42+
- |
43+
set -x
44+
OS="{{ build.OperatingSystemName.outputs.stdout }}"
45+
if [[ $OS =~ ^ubuntu ]] && command -v snap &>/dev/null; then
46+
snap watch --last=auto-refresh 2>/dev/null || true
47+
snap refresh --hold && mkdir -p /opt/parallelcluster && touch /opt/parallelcluster/pcluster_build_image_snap_hold
48+
fi
49+
3750
# Initialize system information and URLs
3851
- name: SystemInfo
3952
action: ExecuteBash
@@ -260,6 +273,11 @@ phases:
260273
echo "SSM agent is installed by default"
261274
fi
262275
276+
if [[ -f /opt/parallelcluster/pcluster_build_image_snap_hold ]]; then
277+
snap refresh --unhold 2>/dev/null || true
278+
rm -rf /opt/parallelcluster/pcluster_build_image_snap_hold
279+
fi
280+
263281
# Final cleanup
264282
rm -f /opt/parallelcluster/system_info
265283
/usr/local/sbin/ami_cleanup.sh "${CfnParamIsOfficialAmiBuild}"

0 commit comments

Comments
 (0)