Skip to content

Move node bootstrap files from /tmp to /opt/parallelcluster/tmp#7481

Merged
hanwen-cluster merged 2 commits into
aws:developfrom
hanwen-cluster:developjun30
Jul 13, 2026
Merged

Move node bootstrap files from /tmp to /opt/parallelcluster/tmp#7481
hanwen-cluster merged 2 commits into
aws:developfrom
hanwen-cluster:developjun30

Conversation

@hanwen-cluster

@hanwen-cluster hanwen-cluster commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Description of changes

  • Some custom AMIs mount /tmp with noexec, and create-cluster wrote and consumed bootstrap files under /tmp. Move them under /opt/parallelcluster/tmp instead so create-cluster works on such AMIs.

Tests

  • pcluster build-image and pcluster create-cluster succeeded
  • We will add a check in integration tests to use noexec on/tmp after Nvidia and efs-utils are moved to repo based installation
  • The following tests have passed
test_hit_no_cluster_dns_mpi[af-south-1-c5.xlarge-rhel8-slurm-None-official] – dns.test_dns25m 44s
test_console_output_with_monitoring_disabled[ap-east-1-c5.xlarge-ubuntu2404-slurm-None-official] – cloudwatch_logging.test_compute_console_output_logging47m 8s
test_fast_capacity_failover[ap-east-1-c5.xlarge-ubuntu2204-slurm-None-official-best-effort] – schedulers.test_slurm43m 22s
test_cloudwatch_logging[ap-east-1-c5.xlarge-rocky9-slurm-None-official] – cloudwatch_logging.test_cloudwatch_logging30m 54s
test_fast_capacity_failover[ap-east-1-c5.xlarge-ubuntu2204-slurm-None-official-greedy-all-or-nothing] – schedulers.test_slurm43m 54s
test_slurm_protected_mode_on_cluster_create[ap-east-1-c5.xlarge-rocky8-slurm-None-official] – schedulers.test_slurm21m 32s
test_custom_action_error[ap-east-1-c5.xlarge-rhel8-slurm-None-official] – cloudwatch_logging.test_compute_console_output_logging28m 9s
test_expedited_requeue[ap-east-1-c5.xlarge-ubuntu2204-slurm-None-official] – schedulers.test_slurm30m 2s
test_slurm_config_update[ap-east-1-c5.xlarge-ubuntu2404-slurm-None-official] – schedulers.test_slurm36m 27s
test_fast_capacity_failover[ap-east-1-c5.xlarge-ubuntu2204-slurm-None-official-all-or-nothing] – schedulers.test_slurm43m 22s
test_slurm_memory_based_scheduling[ap-east-1-c5.xlarge-alinux2023-slurm-None-official] – schedulers.test_slurm44m 31s
test_monitoring[ap-northeast-2-c5.xlarge-rocky9-slurm-None-official-True-True-True] – monitoring.test_monitoring57m 8s
test_slurm_custom_partitions[ap-northeast-2-c5.xlarge-ubuntu2404-slurm-None-official] – schedulers.test_slurm29m 59s
test_create_disable_sudo_access_for_default_user[ap-northeast-2-c5.xlarge-rhel8-slurm-None-official] – create.test_create49m 10s
test_slurm_cli_commands[ap-northeast-2-c5.xlarge-ubuntu2404-slurm-None-official-False] – cli_commands.test_cli_commands55m 12s
test_cluster_creation_with_problematic_preinstall_script[ap-south-1-m6g.xlarge-rocky9-slurm-None-official] – create.test_create18m 26s
test_update_instance_list[ap-south-1-c5.xlarge-ubuntu2404-slurm-None-official] – update.test_update1h 18m 46s
test_slurm_accounting[ap-south-1-c5.xlarge-rhel8-slurm-None-official] – schedulers.test_slurm_accounting1h 8m 5s
test_slurm_accounting_external_dbd[ap-south-1-c5.xlarge-rocky8-slurm-None-official] – schedulers.test_slurm_accounting1h 15m 56s
test_ad_integration[ap-southeast-1-c5.xlarge-ubuntu2404-slurm-None-official-MicrosoftAD-ldaps-True] – ad_integration.test_ad_integration1h 44m 29s
test_ad_integration[ap-southeast-1-c5.xlarge-rhel9-slurm-None-official-MicrosoftAD-ldaps-True] – ad_integration.test_ad_integration1h 31m 56s
test_ad_integration[ap-southeast-1-c5.xlarge-alinux2023-slurm-None-official-MicrosoftAD-ldaps-True] – ad_integration.test_ad_integration1h 30m 19s
test_ad_integration[ap-southeast-1-c5.xlarge-rhel9-slurm-None-official-SimpleAD-ldap-False] – ad_integration.test_ad_integration1h 0m 3s
test_ad_integration[ap-southeast-1-c5.xlarge-rocky9-slurm-None-official-MicrosoftAD-ldaps-True] – ad_integration.test_ad_integration1h 31m 28s
test_ad_integration[ap-southeast-1-c5.xlarge-alinux2023-slurm-None-official-SimpleAD-ldap-False] – ad_integration.test_ad_integration59m 1s
test_ad_integration[ap-southeast-1-c5.xlarge-rocky9-slurm-None-official-SimpleAD-ldap-False] – ad_integration.test_ad_integration1h 2m 6s
test_slurm_custom_config_parameters[ap-southeast-3-c5.xlarge-ubuntu2204-slurm-None-official] – schedulers.test_slurm22m 55s
test_job_level_scaling[ap-southeast-3-m6g.xlarge-rocky8-slurm-None-official-best-effort-scaling_behaviour_by_capacity1] – scaling.test_scaling46m 32s
test_job_level_scaling[ap-southeast-3-m6g.xlarge-rocky8-slurm-None-official-all-or-nothing-scaling_behaviour_by_capacity0] – scaling.test_scaling44m 22s
test_job_level_scaling[ap-southeast-3-m6g.xlarge-rocky8-slurm-None-official-greedy-all-or-nothing-scaling_behaviour_by_capacity2] – scaling.test_scaling44m 52s
test_proxy[ap-southeast-5-m6i.xlarge-ubuntu2404-slurm-None-official] – proxy.test_proxy32m 43s
test_cloudwatch_logging[ap-southeast-7-m6g.xlarge-alinux2023-slurm-None-official] – cloudwatch_logging.test_cloudwatch_logging34m 14s
test_efs_compute_az[ca-central-1-c5.xlarge-ubuntu2404-slurm-None-official] – storage.test_efs58m 48s
test_slurm_protected_mode[ca-central-1-c5.xlarge-rhel8-slurm-None-official-greedy-all-or-nothing] – schedulers.test_slurm55m 2s
test_efs_same_az[ca-central-1-c5.xlarge-alinux2023-slurm-None-official] – storage.test_efs30m 59s
test_multiple_efs[ca-central-1-m6g.xlarge-rhel9-slurm-None-official] – storage.test_efs47m 46s
test_slurm_protected_mode[ca-central-1-c5.xlarge-rhel8-slurm-None-official-best-effort] – schedulers.test_slurm56m 33s
test_slurm_protected_mode[ca-central-1-c5.xlarge-rhel8-slurm-None-official-all-or-nothing] – schedulers.test_slurm56m 44s
test_update_slurm[eu-central-1-c5.xlarge-rocky8-None-official] – update.test_update59m 33s
test_slurm[eu-central-1-c5.xlarge-alinux2023-slurm-None-official-True] – schedulers.test_slurm1h 10m 25s
test_file_cache[eu-north-1-m6g.xlarge-rocky8-slurm-None-official] – storage.test_fsx_lustre33m 2s
test_fsx_lustre_dra[eu-north-1-m6g.xlarge-rocky9-slurm-None-official] – storage.test_fsx_lustre1h 9m 3s
test_fsx_lustre[eu-north-1-m6g.xlarge-rhel8-slurm-None-official] – storage.test_fsx_lustre39m 43s
test_slurm_rest_api[eu-north-1-c5.xlarge-alinux2023-slurm-None-official] – schedulers.test_slurm_rest_api51m 21s
test_create_imds_secured[eu-south-1-c5.xlarge-rocky9-slurm-None-official-False-users_allow_list1] – create.test_create30m 19s
test_create_imds_secured[eu-south-1-c5.xlarge-rocky9-slurm-None-official-True-users_allow_list0] – create.test_create20m 39s
test_existing_hosted_zone[eu-south-1-c5.xlarge-rocky8-slurm-None-official] – dns.test_dns27m 22s
test_pyxis[eu-west-1-c5.xlarge-alinux2023-slurm-None-official-False] – pyxis.test_pyxis1h 3m 47s
test_slurm_from_login_nodes_in_private_network[eu-west-1-c5.xlarge-rhel9-slurm-None-official] – schedulers.test_slurm54m 54s
test_custom_munge_key[eu-west-1-c5.xlarge-alinux2023-slurm-None-official] – schedulers.test_custom_munge_key45m 4s
test_multiple_fsx[eu-west-2-m6g.xlarge-rhel9-slurm-None-official] – storage.test_fsx_lustre1h 53m 53s
test_multi_az_fsx[eu-west-2-c5.xlarge-rhel8-slurm-None-official] – storage.test_fsx_lustre2h 27m 17s
test_fsx_lustre_dra[eu-west-2-c5.xlarge-rocky8-slurm-None-official] – storage.test_fsx_lustre1h 8m 38s
test_dynamic_file_systems_update[eu-west-2-c5.xlarge-rhel9-slurm-None-official] – update.test_update2h 12m 10s
test_fsx_lustre[eu-west-2-c5.xlarge-rhel9-slurm-None-official] – storage.test_fsx_lustre33m 5s
test_multiple_fsx[eu-west-2-c5.xlarge-alinux2023-slurm-None-official] – storage.test_fsx_lustre1h 47m 42s
test_dynamic_file_systems_update_data_loss[eu-west-2-c5.xlarge-rocky9-slurm-None-official] – update.test_update1h 8m 1s
test_multi_az_create_and_update[eu-west-2-c5.xlarge-rhel8-slurm-None-official] – update.test_update28m 38s
test_cluster_in_private_subnet[il-central-1-c5.xlarge-ubuntu2404-slurm-None-official] – networking.test_cluster_networking51m 11s
test_update_race_conditions[us-east-1-c5.xlarge-rhel9-slurm-None-official] – update.test_update_race_conditions1h 7m 40s
test_scontrol_reboot[us-east-1-c5.xlarge-rhel9-slurm-None-official] – schedulers.test_slurm38m 37s
test_dcv_configuration[us-east-1-g5g.2xlarge-ubuntu2404-slurm-use1-az6-official] – dcv.test_dcv54m 24s
test_update_rollback_failure[us-east-1-c5.xlarge-rhel9-slurm-None-official] – update.test_update_rollback_failure1h 12m 32s
test_head_node_stop[us-east-1-m5d.xlarge-ubuntu2204-slurm-use1-az4-official] – storage.test_ephemeral25m 18s
test_cluster_in_no_internet_subnet[us-east-1-m6g.xlarge-ubuntu2404-slurm-None-official] – networking.test_cluster_networking1h 7m 25s
test_slurm_scaling[us-east-2-c5.xlarge-rocky9-slurm-None-official] – schedulers.test_slurm1h 1m 15s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-PERSISTENT_1-40-None-HDD-None-1800-512-LZ4] – storage.test_fsx_lustre45m 50s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-SCRATCH_1-None-NEW-None-None-1200-1024-LZ4] – storage.test_fsx_lustre51m 22s
test_efs_access_point[us-east-2-c5.xlarge-ubuntu2404-slurm-None-official] – storage.test_efs41m 26s
test_ebs_multiple[us-east-2-c5.xlarge-alinux2023-slurm-None-official] – storage.test_ebs44m 50s
test_cluster_with_subnet_prioritization[us-east-2-t3.large-rhel8-slurm-None-official] – networking.test_cluster_networking27m 9s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-SCRATCH_2-None-NEW_CHANGED_DELETED-None-None-1200-1024-LZ4] – storage.test_fsx_lustre50m 43s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-PERSISTENT_1-50-NEW_CHANGED-None-None-1200-1024-None] – storage.test_fsx_lustre53m 56s
test_scontrol_reboot_ec2_health_checks[us-east-2-t3.medium-rocky9-slurm-None-official] – schedulers.test_slurm36m 0s
test_launch_template_overrides[us-east-2-c5n.18xlarge-alinux2023-slurm-use2-az1-official] – launch_template_overrides.test_launch_template_overrides22m 49s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-PERSISTENT_1-12-None-HDD-READ-6000-1024-LZ4] – storage.test_fsx_lustre39m 9s
test_fsx_lustre_configuration_options[us-east-2-c5.xlarge-rocky8-slurm-None-official-PERSISTENT_2-250-None-SSD-None-1200-2048-LZ4] – storage.test_fsx_lustre31m 39s
test_login_nodes_update[us-east-2-c5.xlarge-rocky8-slurm-None-official] – update.test_update1h 28m 37s
test_shared_home[us-west-1-c5.xlarge-alinux2023-slurm-None-official-FsxOpenZfs-Efs] – storage.test_shared_home1h 50m 16s
test_clustermgtd_instance_id_matching[us-west-1-c5.xlarge-rocky9-slurm-None-official] – schedulers.test_slurm23m 40s
test_fsx_lustre_backup[us-west-1-m6g.xlarge-alinux2023-slurm-None-official] – storage.test_fsx_lustre1h 3m 23s
test_shared_home[us-west-1-c5.xlarge-alinux2023-slurm-None-official-Ebs-Efs] – storage.test_shared_home1h 15m 32s
test_slurm_overrides[us-west-1-c5.xlarge-ubuntu2404-slurm-None-official] – schedulers.test_slurm17m 49s
test_shared_home[us-west-1-c5.xlarge-alinux2023-slurm-None-official-FsxLustre-Efs] – storage.test_shared_home1h 25m 33s
test_shared_home[us-west-1-c5.xlarge-alinux2023-slurm-None-official-FsxOntap-Efs] – storage.test_shared_home1h 47m 53s
test_shared_home[us-west-1-c5.xlarge-alinux2023-slurm-None-official-Efs-Efs] – storage.test_shared_home1h 14m 3s
test_existing_eip[us-west-1-c5.xlarge-rhel8-slurm-None-official] – networking.test_cluster_networking15m 39s
test_internal_efs[us-west-2-m6g.xlarge-ubuntu2404-slurm-None-official] – storage.test_internal_efs57m 24s
test_default_user_local_home[us-west-2-c5.xlarge-ubuntu2204-slurm-None-official] – users.test_default_user_home36m 40s
test_internal_efs[us-west-2-c5.xlarge-ubuntu2404-slurm-None-official] – storage.test_internal_efs

References

Checklist

  • Make sure you are pointing to the right branch.
  • If you're creating a patch for a branch other than develop add the branch name as prefix in the PR title (e.g. [release-3.6]).
  • Check all commits' messages are clear, describing what and why vs how.
  • Make sure to have added unit tests or integration tests to cover the new/modified code.
  • Check if documentation is impacted by this change.

Please review the guidelines for contributing and Pull Request Instructions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

all: "| tee -a /var/log/cloud-init-output.log | logger -t user-data -s 2>/dev/ttyS0"
write_files:
- path: /tmp/dna.json
- path: /opt/parallelcluster/tmp/dna.json

@himani2411 himani2411 Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we convert this into a variable which can be replaced by Fn::Sub as this keeps being repeated in all user_data files?

@hanwen-cluster hanwen-cluster Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern in this file uses paths with literal strings. So I'd recommend to keep the code as is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concern isn't the style of a single literal — it's that the same path is now repeated ~7× within this file and across all three user_data files (compute/head/login) plus cluster_stack.py. That's the duplication I'd like to remove: one path change (or a typo in one copy) has to be kept in sync everywhere, and a single wrong copy silently breaks bootstrap. If this change was already in-place it would have made this PR easier and smaller.

On "the pattern uses literal strings" — that's true for paths that appear once or are smaller like /tmp was, but this one doesn't; and we already use Fn::Sub variables throughout these files (${DnaJson}, ${Timeout}, ${AWS::Region}…), so a ${PclusterTmpDir} var fits the existing pattern rather than breaking it. It also has a concrete advantage a shell variable can't offer: Fn::Sub substitutes into the write_files: - path: keys too (cloud-init YAML, where a shell var wouldn't interpolate), so the same token covers
both the YAML paths and the script body.

Cleanest form: define the path once as a CLI constant, feed it into the Fn::Sub mapping (get_common_user_data_env, so all three node types get it), and reference the same constant in cluster_stack.py's cfn-init files keys. Then the path is defined
in exactly one place for all four files. Given we're moving this path specifically to make bootstrap robust, having it defined once seems worth it — can we do that rather than N literal copies?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# [B108:hardcoded_tmp_directory] Probable insecure usage of temp file/directory.
"/tmp/dna.json": { # nosec B108
# Staged under the ParallelCluster-managed directory (not /tmp) so bootstrap works
# on STIG/CIS-hardened AMIs that mount /tmp with noexec (PCLUSTER-3858). cfn-init

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove internal Task IDs and remove the mention of STIG/CIS-hardened AMIs as we are not supporting them yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

[ -f /etc/parallelcluster/pcluster_cookbook_environment.sh ] && . /etc/parallelcluster/pcluster_cookbook_environment.sh

cd /tmp
mkdir -p -m 0755 /opt/parallelcluster/tmp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why are we creating this directory again if its already created as part of Build Image?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now the only place the directory is created is in cookbook "directories.rb"

vendor_cookbook
fi
cd /tmp
mkdir -p -m 0755 /opt/parallelcluster/tmp

@himani2411 himani2411 Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Blocking] Why are we creating this directory in user-data and not in cookbook? Do we not plan on retaining it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are making sure the directory exists in multiple places. This is defensive program

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Some custom AMIs mount /tmp with noexec, and create-cluster wrote and consumed bootstrap files under /tmp. Move them under /opt/parallelcluster/tmp instead so create-cluster works on such AMIs.
@hanwen-cluster hanwen-cluster enabled auto-merge (rebase) July 13, 2026 19:39
@hanwen-cluster hanwen-cluster merged commit c26bcef into aws:develop Jul 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants