From a401d1328f0516022f54e3ae51bb50f5da8b7625 Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Wed, 17 Dec 2025 18:04:45 -0500 Subject: [PATCH 1/3] [BuildImage] Prevent service restarts during installation of ubuntu-desktop, required by DCV, to avoid SSM agent connecgtivity issue. In particular: * Add NEEDRESTART_MODE=l environment variable to suppress needrestart prompts during installation --- .../resources/dcv/partial/_ubuntu_common.rb | 1 + .../aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb index 4c490468f8..00e9b38e72 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb @@ -45,6 +45,7 @@ def pre_install code <<-PREREQ set -e DEBIAN_FRONTEND=noninteractive + NEEDRESTART_MODE=l apt -y install whoopsie apt -y install ubuntu-desktop && apt -y install mesa-utils || (dpkg --configure -a && exit 1) apt -y purge ifupdown diff --git a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb index 2ca8cb6d06..904ba2c311 100644 --- a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb @@ -472,6 +472,7 @@ def self.nothing(chef_run) when 'ubuntu' is_expected.to periodic_apt_update('') is_expected.to run_bash('install pre-req').with_cwd(Chef::Config[:file_cache_path]).with_retries(10).with_retry_delay(5) + .with_code(/NEEDRESTART_MODE=l/) .with_code(/apt -y install whoopsie/) .with_code(/apt -y install ubuntu-desktop && apt -y install mesa-utils || (dpkg --configure -a && exit 1)/) .with_code(/apt -y purge ifupdown/) From cb3cbb5d393cc407dd3082b19be94c9fdfcd99ce Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Thu, 18 Dec 2025 16:28:25 -0500 Subject: [PATCH 2/3] fix(dcv): Prevent systemd restart during ubuntu-desktop installation on Ubuntu - Add apt-mark hold for systemd before installing ubuntu-desktop to prevent service restarts - Remove the hold on systemd after installation completes - Prevents SSM agent connectivity issues caused by systemd restart during DCV setup - Aligns with existing pattern of preventing service restarts during ubuntu-desktop installation --- .../resources/dcv/partial/_ubuntu_common.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb index 00e9b38e72..c3e97cbb72 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb @@ -46,11 +46,13 @@ def pre_install set -e DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l + apt-mark hold systemd apt -y install whoopsie apt -y install ubuntu-desktop && apt -y install mesa-utils || (dpkg --configure -a && exit 1) apt -y purge ifupdown wget https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY gpg --import NICE-GPG-KEY + apt-mark unhold systemd PREREQ retries 10 retry_delay 5 From 116d3d7f1f4e3697af27464545aa88f622c1890e Mon Sep 17 00:00:00 2001 From: Giacomo Marciani Date: Thu, 18 Dec 2025 17:13:05 -0500 Subject: [PATCH 3/3] fix(dcv): Replace systemd hold with SSM agent restart on Ubuntu - Remove apt-mark hold/unhold of systemd package during ubuntu-desktop installation - Add explicit sudo snap restart of amazon-ssm-agent after desktop installation - Ensures SSM agent connectivity is restored after ubuntu-desktop installation completes - Simplifies systemd management by avoiding package holds in favor of direct service restart --- .../resources/dcv/partial/_ubuntu_common.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb index c3e97cbb72..476847009c 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_ubuntu_common.rb @@ -46,13 +46,12 @@ def pre_install set -e DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l - apt-mark hold systemd apt -y install whoopsie apt -y install ubuntu-desktop && apt -y install mesa-utils || (dpkg --configure -a && exit 1) apt -y purge ifupdown wget https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY gpg --import NICE-GPG-KEY - apt-mark unhold systemd + sudo snap restart amazon-ssm-agent PREREQ retries 10 retry_delay 5