Skip to content

Commit f04f94f

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 0bd80e8 commit f04f94f

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
@@ -32,6 +32,7 @@ CHANGELOG
3232
- Reduce EFA installation time for Ubuntu by ~20 minutes by only holding kernel packages for the installed kernel.
3333
- Add GetFunction and GetPolicy permissions to PClusterBuildImageCleanupRole to prevent AccessDenied errors during build image stack deletion.
3434
- Fix validation error messages when `DevSettings` is null or `DevSettings/InstanceTypesData` is missing required fields.
35+
- Disable snap auto-refresh on Ubuntu during build image to prevent intermittent reboot failures.
3536

3637
3.14.0
3738
------

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)