# Detached head error when using spack to build ESM1.6

**URL:** <https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009>\
**Category:** CMIP7 development\
**Tags:** spack, help\
**Created:** [12 December 2024 22:06 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009 "2024-12-12T22:06:30Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [12 December 2024 04:04 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/1 "2024-12-12T04:04:05Z")

</div>

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](https://github.com/ACCESS-NRI/ACCESS-ESM1.6/blob/main/spack.yaml) 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?

---

<div class="post-metadata">

**Author:** ![TommyGatti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/tommygatti/32/2353_2.png) [@TommyGatti](https://forum.access-hive.org.au/u/TommyGatti)\
**Post date:** [12 December 2024 06:19 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/2 "2024-12-12T06:19:38Z")

</div>

Hello @inh599!

If the issue is what I’m thinking of, it could be an issue with [how spack fetches the repositories](https://github.com/spack/spack/issues/48023) 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:

```auto
spack --debug --stacktrace concretize -f --fresh

```

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [12 December 2024 22:06 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/3 "2024-12-12T22:06:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![clairecarouge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/clairecarouge/32/380_2.png) [@clairecarouge](https://forum.access-hive.org.au/u/clairecarouge)\
**Post date:** [17 December 2024 23:22 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/4 "2024-12-17T23:22:07Z")

</div>



---

<div class="post-metadata">

**Author:** ![TommyGatti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/tommygatti/32/2353_2.png) [@TommyGatti](https://forum.access-hive.org.au/u/TommyGatti)\
**Post date:** [17 December 2024 23:40 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/5 "2024-12-17T23:40:15Z")

</div>

Hi Ian, I’m wondering if it’s due to tags being potentially clobbered - there was an issue with some `git tag`s 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 `cd`ed into the `git_repos` directory that is in the directory above the `spack` installation:

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

```

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [18 December 2024 00:23 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/6 "2024-12-18T00:23:36Z")

</div>

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](https://github.com/ACCESS-NRI/mocsy)
> 
> - branch HEAD → FETCH\_HEAD  
> = [up to date] 2017.12.0 → 2017.12.0  
> = [up to date] diff → diff  
> = [up to date] v1.0 → v1.0  
> = [up to date] v2.0 → v2.0  
> = [up to date] v2.0.1 → v2.0.1  
> = [up to date] v2.1 → v2.1  
> = [up to date] v2.1.1 → v2.1.1  
> = [up to date] v2.1.2 → v2.1.2  
> = [up to date] v2.1.3 → v2.1.3  
> = [up to date] v2.2 → v2.2  
> = [up to date] v2.2.1 → v2.2.1  
> = [up to date] v2.3 → v2.3  
> = [up to date] v2.3.1 → v2.3.1  
> = [up to date] v2.3.2 → v2.3.2  
> = [up to date] v2.3.3 → v2.3.3  
> POST git-upload-pack (102 bytes)  
> From [GitHub - ACCESS-NRI/FMS: GFDL's Flexible Modeling System: This is a fork for use with the MOM5 model.](https://github.com/ACCESS-NRI/FMS)
> - branch HEAD → FETCH\_HEAD  
> = [up to date] dev\_2024.11.0 → dev\_2024.11.0  
> t [tag update] dev\_2024.12.0 → dev\_2024.12.0
> - [new tag] dev\_2024.12.1 → dev\_2024.12.1  
> POST git-upload-pack (102 bytes)  
> POST git-upload-pack (943 bytes)  
> remote: Enumerating objects: 37, done.  
> remote: Counting objects: 100% (37/37), done.  
> remote: Compressing objects: 100% (27/27), done.  
> remote: Total 37 (delta 22), reused 24 (delta 10), pack-reused 0 (from 0)  
> Unpacking objects: 100% (37/37), 53.99 KiB | 445.00 KiB/s, done.  
> From [GitHub - ACCESS-NRI/GFDL-generic-tracers: Collection of GFDL generic tracers and associated code for use with MOM and GOLD](https://github.com/ACCESS-NRI/GFDL-generic-tracers)
> - branch HEAD → FETCH\_HEAD  
> = [up to date] 2024.11.0 → 2024.11.0  
> = [up to date] dev\_2024.11.0 → dev\_2024.11.0  
> t [tag update] dev\_2024.12.0 → dev\_2024.12.0
> - [new tag] dev\_2024.12.1 → dev\_2024.12.1
> - [new tag] dev\_2024.12.2 → dev\_2024.12.2  
> = [up to date] v2024.08.17 → v2024.08.17  
> POST git-upload-pack (102 bytes)  
> From [GitHub - ACCESS-NRI/ACCESS-ESM1.6: The ACCESS Earth System Model (ACCESS-ESM) Version 1.6 is a fully-coupled global climate model that includes atmoshpere, land, ocean, sea ice, ocean biogeochemistry and land biogeochemistry components, linked together by a coupler.](https://github.com/ACCESS-NRI/ACCESS-ESM1.6)
> - branch HEAD → FETCH\_HEAD

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

---

<div class="post-metadata">

**Author:** ![TommyGatti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/tommygatti/32/2353_2.png) [@TommyGatti](https://forum.access-hive.org.au/u/TommyGatti)\
**Post date:** [18 December 2024 00:26 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/7 "2024-12-18T00:26:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [18 December 2024 00:56 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/8 "2024-12-18T00:56:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [18 December 2024 01:03 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/9 "2024-12-18T01:03:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TommyGatti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/tommygatti/32/2353_2.png) [@TommyGatti](https://forum.access-hive.org.au/u/TommyGatti)\
**Post date:** [18 December 2024 01:05 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/10 "2024-12-18T01:05:03Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [18 December 2024 02:15 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/11 "2024-12-18T02:15:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TommyGatti](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/tommygatti/32/2353_2.png) [@TommyGatti](https://forum.access-hive.org.au/u/TommyGatti)\
**Post date:** [18 December 2024 02:20 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/12 "2024-12-18T02:20:37Z")

</div>

> ==\> 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? 🙂

---

<div class="post-metadata">

**Author:** ![inh599](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/inh599/32/3400_2.png) [@inh599](https://forum.access-hive.org.au/u/inh599)\
**Post date:** [18 December 2024 02:24 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/13 "2024-12-18T02:24:56Z")

</div>

yes - thanks once again

---

<div class="post-metadata">

**Author:** ![anton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/anton/32/1836_2.png) [@anton](https://forum.access-hive.org.au/u/anton)\
**Post date:** [14 January 2025 21:57 UTC](https://forum.access-hive.org.au/t/detached-head-error-when-using-spack-to-build-esm1-6/4009/14 "2025-01-14T21:57:52Z")

</div>


