Detached head error when using spack to build ESM1.6

Hi all,

new spack user here - with the aim of using spack/payu as part of code development around ESM1.6 (so I’m having to deal with environments, concretization etc.)

I think I’ve navigated to the point, following the hive guidelines, where I can compile/build from source ESM1.6 (had to update the spack.yaml that comes with the git clone of spack). The general idea is that I will then be able to update the spack yaml file to a different um7 branch. When I do the

spack concretize -f --fresh

step using the spack.yaml from ACCESS-ESM1.6/spack.yaml at main · ACCESS-NRI/ACCESS-ESM1.6 · GitHub I’m getting

=> Error: Command exited with status 1:
‘/bin/git’ ‘-c’ ‘advice.detachedHead=false’ ‘-c’ ‘advice.detachedHead=false’ ‘fetch’ ‘–tags’

Any idea as to what this means/what I’ve done incorrectly?

Hello @inh599!

If the issue is what I’m thinking of, it could be an issue with how spack fetches the repositories that are used to build the packages - I’ve been dealing with that for a bit, now, but I have a workaround that I’ll share if it’s that issue. Alternatively, it could be an issue with a shallow clone of spack, but I’m not certain at the moment.

If you don’t mind, would you be able to run the same command with the debug and stacktrace commands enabled:

spack --debug --stacktrace concretize -f --fresh

The output from that command was a lot. It looks like it was okay until

lib/spack/spack/util/module_cmd.py:78 ==> [2024-12-13-08:55:02.589104] module_cmd.load_module: gcc/14.1.0
lib/spack/spack/util/executable.py:233 ==> [2024-12-13-08:55:03.043590] ‘/apps/gcc/14.1.0/wrappers/gcc’ ‘-v’ ‘/scratch/p66/inh599/tmp/spack-implicit-link-infol4gcg42j/main.c’ ‘-o’ ‘/scratch/p66/inh599/tmp/spack-implicit-link-infol4gcg42j/output’
lib/spack/spack/solver/asp.py:2993 ==> [2024-12-13-08:55:03.829233] the C compiler None does not exist, or does not run correctly. The compiler intel@=2021.11.1 will not be used during concretization.

shortly followed by the error message above, then a long line of python error output which ends with

File “/g/data/p66/inh599/spack/0.22/spack/lib/spack/spack/version/version_types.py”, line 600, in ref_lookup
self._ref_lookup.get(self.ref)
File “/g/data/p66/inh599/spack/0.22/spack/lib/spack/spack/version/git_ref_lookup.py”, line 118, in get
self.data[ref] = self.lookup_ref(ref)
File “/g/data/p66/inh599/spack/0.22/spack/lib/spack/spack/version/git_ref_lookup.py”, line 149, in lookup_ref
self.fetcher.git(“fetch”, “–tags”, output=os.devnull, error=os.devnull)
File “/g/data/p66/inh599/spack/0.22/spack/lib/spack/spack/util/executable.py”, line 252, in call
raise ProcessError(“Command exited with status %d:” % proc.returncode, long_msg)
spack.util.executable.ProcessError: Command exited with status 1:
‘/bin/git’ ‘-c’ ‘advice.detachedHead=false’ ‘-c’ ‘advice.detachedHead=false’ ‘fetch’ ‘–tags’

This looks like that one of the git addresses in the spack.yaml file (which I got from the ESM1.6.git suite) doesn’t exist - but I’ve no idea which one.

Hi Ian, I’m wondering if it’s due to tags being potentially clobbered - there was an issue with some git tags being moved in some repositories which could lead to the above error.

If you don’t mind, would you be able to give me the output of the following command (it is force-fetching updates to the tags in the repositories that are used). This command assumes you are cded into the git_repos directory that is in the directory above the spack installation:

for repo in *; do git -C "./$repo" fetch --verbose --update-head-ok --tags --force; done

Hi, I’m not sure what I’m looking for so here’s the full output.

[inh599@gadi-login-02 git_repos]$ for repo in *; do git -C “./$repo” fetch -->verbose --update-head-ok --tags --force; done
POST git-upload-pack (102 bytes)
From GitHub - ACCESS-NRI/mocsy: Routines to model ocean carbonate system thermodynamics

I think the environment spack.yaml file that I am/was trying to concretize involved specs

  • access-esm1p6@git.dev_2024.12.0,

requiring

  • mom5 @git.dev_2024.08.14=access-esm1.6
  • cice4 @git.2024.05.21=acccess-esm1.5
  • um7 @git.dev-access-esm1.6=access-esm1.6

Alright, that output is good news - the t [tag update] dev_2024.12.0 → dev_2024.12.0 sections mean that we’ve updated the tags that were failing earlier.

If you attempt to run spack concretize -f --fresh now on the model you want to build, what happens - does it succeed? I hope that this fix gets you a little bit further along!

This has now thrown message

==> Error: dev_2024.12.0 is not a valid git ref for access-esm1p6

This happened before and after I updated/refreshed my instance of spack on gadi.

Now there are four instances of the dev_2024.12.0 tag in the spack.yaml file

  • in the specs: section as - access-esm1p6@git.dev_2024.12.0
  • in the packages: section access-fms: require: - '@git.dev_2024.12.0' ' and access-generic-tracers: require: - '@git.dev_2024.12.0'
  • in the module: default: tcl: projections" section as access-esm1p6: '{name}/dev_2024.12.0'

so I’m guessing that one of these isn’t quite correct.

Now having gone through this - thank you for your assistance - it maybe better to stop and pause at this point. I was hoping to assist with some last minute code edits as part of the immediate effort around ESM1.6 - but we’ve largely moved to a different mode of operation for now. It’s unlikely I’ll need to solve this before next year (if at all).

Of course - if you want me/us to continue trying as it would help identify something for more wider community benefit then let me know.

Ah, yep. So I’ve confirmed that instances in the packages section are fine, it’s the ones in the specs and modules section that are an issue. This is because it’s looking for the dev_2024.12.0 tag in the ACCESS-NRI/ACCESS-ESM1.6 repository, which doesn’t exist.

Instead, would you be able to use the following references:

  • In the specs section: - access-esm1p6@latest.
  • In the modules section: access-esm1p6: '{name}/latest' (or indeed, whatever modulefile name you would like to demarcate between other builds)

The spack concretize command worked with only a deprecation warning thrown

==> Warning: using “cmake@3.24.2” which is a deprecated version

This suggests that the spack.yaml file that forms part of the current/official/default release needs to be updated (or the ACCESS-ESM1.6 repo updated with that tag).

Thanks for the assistance in getting past that roadblock.


Interestingly during the spack install command it needed my gadi ssh/git passcode when completing

==> Installing gcom4-git.2024.05.28=access-esm1.5-7xql2zmt54bnvdgzalcc44joachmby56

and

==> Installing um7-git.dev-access-esm1.6=access-esm1.6-zpehauutrxs7mi2plup4zmj33kh3ofoi

but otherwise the build seems to have worked okay as well.

==> Warning: using “cmake@3.24.2” which is a deprecated version

Good catch. I am investigating this separately, as it’s come up in a bunch of builds.

Interestingly during the spack install command it needed my gadi ssh/git passcode

Yes, that is because the UM is a private repository and spack can’t fetch it without extra credentials.

With the detached head stuff solved, would we consider this topic solved? :slight_smile:

yes - thanks once again

1 Like