From a69b4e66edb195a6ea5d7f32d8310762e0297970 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 26 Mar 2026 11:34:08 +0100 Subject: [PATCH 01/14] Use sandbox mode which is more robust in singularity cleanup phase --- eessi_container.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eessi_container.sh b/eessi_container.sh index 71b0fa41..12605a08 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1039,9 +1039,13 @@ for arg in "${PASS_THROUGH[@]}"; do ADDITIONAL_CONTAINER_OPTIONS+=(${arg}) done -echo "Launching container with command (next line):" -echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER} $@" -singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER} "$@" +# using a sandbox image mode is more robust at the cleanup phase at the end +CONTAINER_SANDBOX=CONTAINER.removesuffix(".sif") + ".sandbox" +echo "Building a sandbox image with command (next line):" +echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" +echo "Launching sandbox container with command (next line):" +echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" +singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" exit_code=$? # 6. save tmp if requested (arg -s|--save) From 47406aca28a94da7687d55672d60f6d3912022b8 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 26 Mar 2026 11:50:09 +0100 Subject: [PATCH 02/14] Now with correct bash syntax --- eessi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi_container.sh b/eessi_container.sh index 12605a08..c981e29e 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1040,7 +1040,7 @@ for arg in "${PASS_THROUGH[@]}"; do done # using a sandbox image mode is more robust at the cleanup phase at the end -CONTAINER_SANDBOX=CONTAINER.removesuffix(".sif") + ".sandbox" +CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" echo "Launching sandbox container with command (next line):" From 149dfaf968b410f96d1fdea07dd335122432af36 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 26 Mar 2026 12:58:13 +0100 Subject: [PATCH 03/14] Now with the singularity build command in place --- eessi_container.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/eessi_container.sh b/eessi_container.sh index c981e29e..956c9393 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1043,6 +1043,7 @@ done CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" +singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER} echo "Launching sandbox container with command (next line):" echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" From d06e00f9f13d116051701c66baf84172c1017029 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Tue, 31 Mar 2026 12:15:22 +0200 Subject: [PATCH 04/14] Make the use of sandbox optional through an environment variable --- eessi_container.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/eessi_container.sh b/eessi_container.sh index 956c9393..4dd9c9b4 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1039,15 +1039,23 @@ for arg in "${PASS_THROUGH[@]}"; do ADDITIONAL_CONTAINER_OPTIONS+=(${arg}) done -# using a sandbox image mode is more robust at the cleanup phase at the end -CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" -echo "Building a sandbox image with command (next line):" -echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" -singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER} -echo "Launching sandbox container with command (next line):" -echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" -singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" +# EESSI_SINGULARITY_SANDBOX is an environment variable (typically set in site_config.sh, if needed) +if [[ -n "$EESSI_SINGULARITY_SANDBOX" ]]; then + # using a sandbox image mode is more robust at the cleanup phase at the end + CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" + echo "Building a sandbox image with command (next line):" + echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" + singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER} + echo "Launching sandbox container with command (next line):" + echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" + singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" exit_code=$? +else + echo "Launching container with command (next line):" + echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER} $@" + singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER} "$@" +exit_code=$? +fi # 6. save tmp if requested (arg -s|--save) if [[ ! -z ${SAVE} ]]; then From 2f11ce2805e4d03f8244f21645890c5e02605f2e Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 9 Apr 2026 17:54:08 +0200 Subject: [PATCH 05/14] Add --force to avoid error if sandbox build target already exists --- eessi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi_container.sh b/eessi_container.sh index 4dd9c9b4..c23c2cdb 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1045,7 +1045,7 @@ if [[ -n "$EESSI_SINGULARITY_SANDBOX" ]]; then CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" - singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER} + singularity build --sandbox --force ${CONTAINER_SANDBOX} ${CONTAINER} echo "Launching sandbox container with command (next line):" echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" From 78cba78ef9b03467f5c87cac4c9372014cd269be Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 9 Apr 2026 18:03:30 +0200 Subject: [PATCH 06/14] Add the "--force" also to the echo to be consistent --- eessi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi_container.sh b/eessi_container.sh index c23c2cdb..2a5834e5 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1044,7 +1044,7 @@ if [[ -n "$EESSI_SINGULARITY_SANDBOX" ]]; then # using a sandbox image mode is more robust at the cleanup phase at the end CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" - echo "singularity build --sandbox ${CONTAINER_SANDBOX} ${CONTAINER}" + echo "singularity build --sandbox --force ${CONTAINER_SANDBOX} ${CONTAINER}" singularity build --sandbox --force ${CONTAINER_SANDBOX} ${CONTAINER} echo "Launching sandbox container with command (next line):" echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" From 62a178ff82dcc73a007ac54585735dc300a24c30 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Wed, 15 Apr 2026 16:10:19 +0200 Subject: [PATCH 07/14] Add hook for Dyninst (it needs libiberty from binutils provided by compat layer) --- eb_hooks.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 50d37a91..c653e9b4 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1109,6 +1109,26 @@ def pre_configure_hook_score_p(self, *args, **kwargs): else: raise EasyBuildError("Score-P-specific hook triggered for non-Score-P easyconfig?!") +def pre_configure_hook_dyninst(self, *args, **kwargs): + """ + Pre-configure hook for Dyninst + - specify correct path to binutils (in compat layer) + """ + if self.name == 'Dyninst': + + # determine path to Prefix installation in compat layer via $EPREFIX + eprefix = get_eessi_envvar('EPREFIX') + + binutils_lib_path_glob_pattern = os.path.join(eprefix, 'usr', 'lib*', 'binutils', '*-linux-gnu', '2.*') + binutils_lib_path = glob.glob(binutils_lib_path_glob_pattern) + if len(binutils_lib_path) == 1: + self.cfg.update('configopts', '-DLibIberty_ROOT_DIR=' + binutils_lib_path[0]) + else: + raise EasyBuildError("Failed to isolate path for binutils libraries using %s, got %s", + binutils_lib_path_glob_pattern, binutils_lib_path) + + else: + raise EasyBuildError("Dyninst-specific hook triggered for non-Dyninst easyconfig?!") def pre_configure_hook_extrae(self, *args, **kwargs): """ @@ -1987,6 +2007,7 @@ def pre_run_shell_cmd_hook(cmd, work_dir=None, **kwargs): 'WRF': pre_configure_hook_wrf_aarch64, 'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda, 'Score-P': pre_configure_hook_score_p, + 'Dyninst': pre_configure_hook_dyninst, 'CMake': pre_configure_hook_cmake_system, } From b91483d07d70ab87d689d704f19335fbfb990800 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Wed, 15 Apr 2026 16:58:51 +0200 Subject: [PATCH 08/14] Add specific paths --- eb_hooks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index c653e9b4..14540584 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1123,6 +1123,8 @@ def pre_configure_hook_dyninst(self, *args, **kwargs): binutils_lib_path = glob.glob(binutils_lib_path_glob_pattern) if len(binutils_lib_path) == 1: self.cfg.update('configopts', '-DLibIberty_ROOT_DIR=' + binutils_lib_path[0]) + self.cfg.update('configopts', '-DLibIberty_INCLUDE_DIRS=' + os.path.join(binutils_lib_path[0], 'include')) + self.cfg.update('configopts', '-DLibIberty_LIBRARIES=' + binutils_lib_path[0]) else: raise EasyBuildError("Failed to isolate path for binutils libraries using %s, got %s", binutils_lib_path_glob_pattern, binutils_lib_path) From eb48ca4886cef9bf92cca25f5b635725de08b2e1 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Wed, 15 Apr 2026 17:09:53 +0200 Subject: [PATCH 09/14] Add log message --- eb_hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/eb_hooks.py b/eb_hooks.py index 14540584..b8283cc7 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1122,6 +1122,7 @@ def pre_configure_hook_dyninst(self, *args, **kwargs): binutils_lib_path_glob_pattern = os.path.join(eprefix, 'usr', 'lib*', 'binutils', '*-linux-gnu', '2.*') binutils_lib_path = glob.glob(binutils_lib_path_glob_pattern) if len(binutils_lib_path) == 1: + print_msg("Defining LibIberty variables for Dyninst...") self.cfg.update('configopts', '-DLibIberty_ROOT_DIR=' + binutils_lib_path[0]) self.cfg.update('configopts', '-DLibIberty_INCLUDE_DIRS=' + os.path.join(binutils_lib_path[0], 'include')) self.cfg.update('configopts', '-DLibIberty_LIBRARIES=' + binutils_lib_path[0]) From 2a0f76363f7d4e957a84bed8a0829f3d4a1e0f6c Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 16 Apr 2026 14:38:29 +0200 Subject: [PATCH 10/14] Remove Dyninst pre-configure hook --- eb_hooks.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index b8283cc7..50d37a91 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1109,29 +1109,6 @@ def pre_configure_hook_score_p(self, *args, **kwargs): else: raise EasyBuildError("Score-P-specific hook triggered for non-Score-P easyconfig?!") -def pre_configure_hook_dyninst(self, *args, **kwargs): - """ - Pre-configure hook for Dyninst - - specify correct path to binutils (in compat layer) - """ - if self.name == 'Dyninst': - - # determine path to Prefix installation in compat layer via $EPREFIX - eprefix = get_eessi_envvar('EPREFIX') - - binutils_lib_path_glob_pattern = os.path.join(eprefix, 'usr', 'lib*', 'binutils', '*-linux-gnu', '2.*') - binutils_lib_path = glob.glob(binutils_lib_path_glob_pattern) - if len(binutils_lib_path) == 1: - print_msg("Defining LibIberty variables for Dyninst...") - self.cfg.update('configopts', '-DLibIberty_ROOT_DIR=' + binutils_lib_path[0]) - self.cfg.update('configopts', '-DLibIberty_INCLUDE_DIRS=' + os.path.join(binutils_lib_path[0], 'include')) - self.cfg.update('configopts', '-DLibIberty_LIBRARIES=' + binutils_lib_path[0]) - else: - raise EasyBuildError("Failed to isolate path for binutils libraries using %s, got %s", - binutils_lib_path_glob_pattern, binutils_lib_path) - - else: - raise EasyBuildError("Dyninst-specific hook triggered for non-Dyninst easyconfig?!") def pre_configure_hook_extrae(self, *args, **kwargs): """ @@ -2010,7 +1987,6 @@ def pre_run_shell_cmd_hook(cmd, work_dir=None, **kwargs): 'WRF': pre_configure_hook_wrf_aarch64, 'LAMMPS': pre_configure_hook_LAMMPS_zen4_and_aarch64_cuda, 'Score-P': pre_configure_hook_score_p, - 'Dyninst': pre_configure_hook_dyninst, 'CMake': pre_configure_hook_cmake_system, } From fe3541e2ef7542dadfb5286be25fa70168a97c2f Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 16 Apr 2026 15:14:27 +0200 Subject: [PATCH 11/14] Add sandbox mode option to eessi_container.sh --- eessi_container.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eessi_container.sh b/eessi_container.sh index 2a5834e5..83bedfdb 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -118,6 +118,9 @@ display_help() { echo " [default: not set]; uses env var \$http_proxy if set" echo " -y | --https-proxy URL - provides URL for the env variable https_proxy" echo " [default: not set]; uses env var \$https_proxy if set" + echo " --sandbox - use sandbox mode (i.e. convert .sif image to sandbox and then run" + echo " it instead" + echo " [default: not set]" echo echo " If value for --mode is 'exec' or 'run', the SCRIPT/COMMAND provided is executed. If" echo " arguments to the script/command start with '-' or '--', use the flag terminator" @@ -293,6 +296,10 @@ while [[ $# -gt 0 ]]; do export https_proxy=${HTTPS_PROXY} shift 2 ;; + --sandbox) + SANDBOX=1 + shift 1 + ;; --) shift POSITIONAL_ARGS+=("$@") # save positional args @@ -1040,7 +1047,7 @@ for arg in "${PASS_THROUGH[@]}"; do done # EESSI_SINGULARITY_SANDBOX is an environment variable (typically set in site_config.sh, if needed) -if [[ -n "$EESSI_SINGULARITY_SANDBOX" ]]; then +if [[ -n "$EESSI_SINGULARITY_SANDBOX" || $SANDBOX -eq 1 ]]; then # using a sandbox image mode is more robust at the cleanup phase at the end CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" From 3f87df90395abee0c0e92227f9e8f74930b2b995 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 16 Apr 2026 16:12:14 +0200 Subject: [PATCH 12/14] Update eessi_container.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bob Dröge --- eessi_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eessi_container.sh b/eessi_container.sh index 83bedfdb..234c4676 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1047,7 +1047,7 @@ for arg in "${PASS_THROUGH[@]}"; do done # EESSI_SINGULARITY_SANDBOX is an environment variable (typically set in site_config.sh, if needed) -if [[ -n "$EESSI_SINGULARITY_SANDBOX" || $SANDBOX -eq 1 ]]; then +if [[ -n "${EESSI_SINGULARITY_SANDBOX}" || ${SANDBOX} -eq 1 ]]; then # using a sandbox image mode is more robust at the cleanup phase at the end CONTAINER_SANDBOX="${CONTAINER%.sif}.sandbox" echo "Building a sandbox image with command (next line):" From 3d7995877185ac1e6f9ca90dec316eb61d47d496 Mon Sep 17 00:00:00 2001 From: julianmorillo Date: Thu, 16 Apr 2026 16:17:06 +0200 Subject: [PATCH 13/14] Allow "-S" as a shortcut for "--sandbox" --- eessi_container.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eessi_container.sh b/eessi_container.sh index 234c4676..0a430453 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -113,14 +113,14 @@ display_help() { echo " when a directory is provided, the format of the" echo " tarball's name will be {REPO_ID}-{TIMESTAMP}.tgz" echo " [default: not set]" + echo " -S | --sandbox - use sandbox mode (i.e. convert .sif image to sandbox and then run" + echo " it instead)" + echo " [default: not set]" echo " -v | --verbose - display more information [default: false]" echo " -x | --http-proxy URL - provides URL for the env variable http_proxy" echo " [default: not set]; uses env var \$http_proxy if set" echo " -y | --https-proxy URL - provides URL for the env variable https_proxy" echo " [default: not set]; uses env var \$https_proxy if set" - echo " --sandbox - use sandbox mode (i.e. convert .sif image to sandbox and then run" - echo " it instead" - echo " [default: not set]" echo echo " If value for --mode is 'exec' or 'run', the SCRIPT/COMMAND provided is executed. If" echo " arguments to the script/command start with '-' or '--', use the flag terminator" @@ -278,6 +278,10 @@ while [[ $# -gt 0 ]]; do SAVE="$2" shift 2 ;; + -S|--sandbox) + SANDBOX=1 + shift 1 + ;; -u|--resume) RESUME="$2" shift 2 @@ -296,10 +300,6 @@ while [[ $# -gt 0 ]]; do export https_proxy=${HTTPS_PROXY} shift 2 ;; - --sandbox) - SANDBOX=1 - shift 1 - ;; --) shift POSITIONAL_ARGS+=("$@") # save positional args From aed015b287cea1a286b3952dc9b7f94ab87af0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Thu, 16 Apr 2026 16:31:05 +0200 Subject: [PATCH 14/14] Fix indentation --- eessi_container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eessi_container.sh b/eessi_container.sh index 0a430453..da85bcce 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -1056,12 +1056,12 @@ if [[ -n "${EESSI_SINGULARITY_SANDBOX}" || ${SANDBOX} -eq 1 ]]; then echo "Launching sandbox container with command (next line):" echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER_SANDBOX} $@" singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER_SANDBOX} "$@" -exit_code=$? + exit_code=$? else echo "Launching container with command (next line):" echo "singularity ${RUN_QUIET} ${MODE} ${ADDITIONAL_CONTAINER_OPTIONS[@]} ${EESSI_FUSE_MOUNTS[@]} ${CONTAINER} $@" singularity ${RUN_QUIET} ${MODE} "${ADDITIONAL_CONTAINER_OPTIONS[@]}" "${EESSI_FUSE_MOUNTS[@]}" ${CONTAINER} "$@" -exit_code=$? + exit_code=$? fi # 6. save tmp if requested (arg -s|--save)