`nix flake update` crashes in pack_entry_find_offset (libgit2.so)
Describe the bug
nix flake update crashes in pack_entry_find_offset (libgit2.so)
❯ nix --offline flake update
downloading 'https://api.github.com/repos/nix-community/disko/commits/HEAD'Error: nu::shell::core_dumped
× External command core dumped
╭─[entry #9:1:1]
1 │ nix --offline flake update
· ─┬─
· ╰── core dumped with SIGBUS (7)
╰────
#0 0x00007f520979a7ef pack_entry_find_offset (libgit2.so.1.9 + 0xc67ef)
#1 0x00007f520979eb96 git_pack_entry_find (libgit2.so.1.9 + 0xcab96)
#2 0x00007f5209791283 pack_entry_find (libgit2.so.1.9 + 0xbd283)
#3 0x00007f52097917f7 pack_backend__read (libgit2.so.1.9 + 0xbd7f7)
#4 0x00007f5209788cce odb_read_1 (libgit2.so.1.9 + 0xb4cce)
#5 0x00007f520978c6b0 git_odb_read (libgit2.so.1.9 + 0xb86b0)
#6 0x00007f5209786fb0 git_object_lookup_prefix (libgit2.so.1.9 + 0xb2fb0)
#7 0x00007f520b34a96e _ZN3nix11GitRepoImpl9hasObjectERKNS_4HashE (libnixfetchers.so + 0xb796e)
#8 0x00007f520b387413 _ZNK3nix8fetchers21GitArchiveInputScheme15downloadArchiveENS_3refINS_5StoreEEENS0_5InputE (libnixfetchers.so + 0xf4413)
coredump:
PID: 5201 (nix)
UID: 1000 (timon)
GID: 100 (users)
Signal: 7 (BUS)
Timestamp: Tue 2025-07-08 19:48:53 UTC (6min ago)
Command Line: /run/current-system/sw/bin/nix --offline flake update
Executable: /nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix
Control Group: /user.slice/user-1000.slice/[email protected]/app.slice/app-ghostty-transient-2883.scope/surfaces/55BE2E43EA10.scope
Unit: [email protected]
User Unit: app-ghostty-transient-2883.scope
Slice: user-1000.slice
Owner UID: 1000 (timon)
Boot ID: 68f9c0bf6b1b48408f2465f18113bf25
Machine ID: a37389fb43ca46969e0b6fa989fa545b
Hostname: timon-pc
Storage: /var/lib/systemd/coredump/core.nix.1000.68f9c0bf6b1b48408f2465f18113bf25.5201.1752004133000000.zst (present)
Size on Disk: 1.6M
Message: Process 5201 (nix) of user 1000 dumped core.
Module /nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix without build-id.
Module libkeyutils.so.1 without build-id.
Module libkrb5support.so.0 without build-id.
Module libcom_err.so.3 without build-id.
Module libk5crypto.so.3 without build-id.
Module libkrb5.so.3 without build-id.
Module libunistring.so.5 without build-id.
Module libattr.so.1 without build-id.
Module libpcre2-8.so.0 without build-id.
Module libllhttp.so.9.3 without build-id.
Module libaws-c-common.so.1 without build-id.
Module libaws-c-sdkutils.so.1.0.0 without build-id.
Module libaws-c-compression.so.1.0.0 without build-id.
Module libaws-checksums.so.1.0.0 without build-id.
Module libaws-c-cal.so.1.0.0 without build-id.
Module libs2n.so.1 without build-id.
Module libaws-c-io.so.1.0.0 without build-id.
Module libaws-c-http.so.1.0.0 without build-id.
Module libaws-c-auth.so.1.0.0 without build-id.
Module libaws-c-s3.so.0unstable without build-id.
Module libaws-c-event-stream.so.1.0.0 without build-id.
Module libaws-c-mqtt.so.1.0.0 without build-id.
Module libaws-crt-cpp.so without build-id.
Module libgssapi_krb5.so.2 without build-id.
Module libpsl.so.5 without build-id.
Module libssh2.so.1 without build-id.
Module libidn2.so.0 without build-id.
Module libnghttp2.so.14 without build-id.
Module libbrotlicommon.so.1 without build-id.
Module libtbb.so.12 without build-id.
Module libxml2.so.16 without build-id.
Module liblzma.so.5 without build-id.
Module libz.so.1 without build-id.
Module libbz2.so.1 without build-id.
Module libzstd.so.1 without build-id.
Module libacl.so.1 without build-id.
Module libeditline.so.1 without build-id.
Module liblowdown.so.1 without build-id.
Module libgit2.so.1.9 without build-id.
Module libaws-cpp-sdk-core.so without build-id.
Module libaws-cpp-sdk-s3.so without build-id.
Module libaws-cpp-sdk-transfer.so without build-id.
Module libseccomp.so.2 without build-id.
Module libboost_context.so.1.87.0 without build-id.
Module libcpuid.so.17 without build-id.
Module libbrotlienc.so.1 without build-id.
Module libbrotlidec.so.1 without build-id.
Module libblake3.so.0 without build-id.
Module libarchive.so.13 without build-id.
Module libgcc_s.so.1 without build-id.
Module libstdc++.so.6 without build-id.
Module libnixcmd.so without build-id.
Module libnixmain.so without build-id.
Module libnixflake.so without build-id.
Module libnixfetchers.so without build-id.
Module libnixexpr.so without build-id.
Module libnixstore.so without build-id.
Module libnixutil.so without build-id.
Stack trace of thread 5201:
#0 0x00007f520979a7ef pack_entry_find_offset (libgit2.so.1.9 + 0xc67ef)
#1 0x00007f520979eb96 git_pack_entry_find (libgit2.so.1.9 + 0xcab96)
#2 0x00007f5209791283 pack_entry_find (libgit2.so.1.9 + 0xbd283)
#3 0x00007f52097917f7 pack_backend__read (libgit2.so.1.9 + 0xbd7f7)
#4 0x00007f5209788cce odb_read_1 (libgit2.so.1.9 + 0xb4cce)
#5 0x00007f520978c6b0 git_odb_read (libgit2.so.1.9 + 0xb86b0)
#6 0x00007f5209786fb0 git_object_lookup_prefix (libgit2.so.1.9 + 0xb2fb0)
#7 0x00007f520b34a96e _ZN3nix11GitRepoImpl9hasObjectERKNS_4HashE (libnixfetchers.so + 0xb796e)
#8 0x00007f520b387413 _ZNK3nix8fetchers21GitArchiveInputScheme15downloadArchiveENS_3refINS_5StoreEEENS0_5InputE (libnixfetchers.so + 0xf4413)
#9 0x00007f520b387e7d _ZNK3nix8fetchers21GitArchiveInputScheme11getAccessorENS_3refINS_5StoreEEERKNS0_5InputE (libnixfetchers.so + 0xf4e7d)
#10 0x00007f520b324575 _ZNK3nix8fetchers5Input20getAccessorUncheckedENS_3refINS_5StoreEEE (libnixfetchers.so + 0x91575)
#11 0x00007f520b326654 _ZNK3nix8fetchers5Input11getAccessorENS_3refINS_5StoreEEE (libnixfetchers.so + 0x93654)
#12 0x00007f520b995837 _ZNK3nix8FlakeRef9lazyFetchENS_3refINS_5StoreEEE (libnixflake.so + 0x7c837)
#13 0x00007f520b97cd4e _ZN3nix5flakeL21fetchOrSubstituteTreeERNS_9EvalStateERKNS_8FlakeRefENS_8fetchers13UseRegistriesERSt3mapIS3_NS0_12FetchedFlakeESt4lessIS3_ESaISt4pairIS4_S9_EEE (libnixflake.so + 0x63d4e)
#14 0x00007f520b98085a _ZN3nix5flakeL8getFlakeERNS_9EvalStateERKNS_8FlakeRefENS_8fetchers13UseRegistriesERSt3mapIS3_NS0_12FetchedFlakeESt4lessIS3_ESaISt4pairIS4_S9_EEERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaISN_EE (libnixflake.so + 0x6785a)
#15 0x00007f520b983884 _ZZN3nix5flake9lockFlakeERKNS0_8SettingsERNS_9EvalStateERKNS_8FlakeRefERKNS0_9LockFlagsEENKUlRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_10FlakeInputESt4lessISI_ESaISt4pairIKSI_SJ_EEENS_3refINS0_4NodeEEERKSt6vectorISI_SaISI_EESt10shared_ptrIKSU_ES10_RKNS_10SourcePathEbE_clESS_SV_S10_S13_S10_S16_b (libnixflake.so + 0x6a884)
#16 0x00007f520b984776 _ZNSt17_Function_handlerIFvRKSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN3nix5flake10FlakeInputESt4lessIS6_ESaISt4pairIKS6_S9_EEENS7_3refINS8_4NodeEEERKSt6vectorIS6_SaIS6_EESt10shared_ptrIKSK_ESQ_RKNS7_10SourcePathEbEZNS8_9lockFlakeERKNS8_8SettingsERNS7_9EvalStateERKNS7_8FlakeRefERKNS8_9LockFlagsEEUlSI_SL_SQ_ST_SQ_SW_bE_E9_M_invokeERKSt9_Any_dataSI_OSL_SQ_OST_SQ_SW_Ob (libnixflake.so + 0x6b776)
#17 0x00007f520b9851cd _ZN3nix5flake9lockFlakeERKNS0_8SettingsERNS_9EvalStateERKNS_8FlakeRefERKNS0_9LockFlagsE (libnixflake.so + 0x6c1cd)
#18 0x00005579b3b19a32 _ZN12FlakeCommand9lockFlakeEv (/nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix + 0x18ba32)
#19 0x00005579b3b19c19 _ZN14CmdFlakeUpdate3runEN3nix3refINS0_5StoreEEE (/nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix + 0x18bc19)
#20 0x00007f520af7306c _ZN3nix12StoreCommand3runEv (libnixcmd.so + 0x6406c)
#21 0x00005579b3b5219d _ZN3nix11mainWrappedEiPPc (/nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix + 0x1c419d)
#22 0x00007f520b902905 _ZN3nix16handleExceptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvvEE (libnixmain.so + 0x3e905)
#23 0x00005579b3a5c945 main (/nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix + 0xce945)
#24 0x00007f520a62a4d8 __libc_start_call_main (libc.so.6 + 0x2a4d8)
#25 0x00007f520a62a59b __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x2a59b)
#26 0x00005579b3a64e35 _start (/nix/store/w0sz6vzj889m03wys6mbra4fxmvlhszg-nix-2.28.4/bin/nix + 0xd6e35)
Stack trace of thread 5207:
#0 0x00007f520a7147bd __poll (libc.so.6 + 0x1147bd)
#1 0x00007f5209eb0d78 Curl_poll (libcurl.so.4 + 0x7ad78)
#2 0x00007f5209ea54e0 multi_wait.part.0 (libcurl.so.4 + 0x6f4e0)
#3 0x00007f5209ea56eb curl_multi_wait (libcurl.so.4 + 0x6f6eb)
#4 0x00007f520b643d1e _ZN3nix16curlFileTransfer16workerThreadMainEv (libnixstore.so + 0x243d1e)
#5 0x00007f520b6450fc _ZN3nix16curlFileTransfer17workerThreadEntryEv (libnixstore.so + 0x2450fc)
#6 0x00007f520aaed064 execute_native_thread_routine (libstdc++.so.6 + 0xed064)
#7 0x00007f520a69af08 start_thread (libc.so.6 + 0x9af08)
#8 0x00007f520a7230ac __clone3 (libc.so.6 + 0x1230ac)
Stack trace of thread 5203:
#0 0x00007f520a642740 __sigtimedwait (libc.so.6 + 0x42740)
#1 0x00007f520a641d5c sigwait (libc.so.6 + 0x41d5c)
#2 0x00007f520bba4963 _ZN3nixL19signalHandlerThreadE10__sigset_t (libnixutil.so + 0x1a4963)
#3 0x00007f520bba638d _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFv10__sigset_tES3_EEEEE6_M_runEv (libnixutil.so + 0x1a638d)
#4 0x00007f520aaed064 execute_native_thread_routine (libstdc++.so.6 + 0xed064)
#5 0x00007f520a69af08 start_thread (libc.so.6 + 0x9af08)
#6 0x00007f520a7230ac __clone3 (libc.so.6 + 0x1230ac)
Stack trace of thread 5204:
#0 0x00007f520a697249 __futex_abstimed_wait_common (libc.so.6 + 0x97249)
#1 0x00007f520a69a632 pthread_cond_clockwait@GLIBC_2.30 (libc.so.6 + 0x9a632)
#2 0x00007f520b8fc18b _ZZN3nix11ProgressBarC4EbENKUlvE_clEv (libnixmain.so + 0x3818b)
#3 0x00007f520aaed064 execute_native_thread_routine (libstdc++.so.6 + 0xed064)
#4 0x00007f520a69af08 start_thread (libc.so.6 + 0x9af08)
#5 0x00007f520a7230ac __clone3 (libc.so.6 + 0x1230ac)
ELF object binary architecture: AMD x86-64
Steps To Reproduce
Expected behavior
Flake update works or returns sensible error that a user can resolve.
Metadata
nix-env (Nix) 2.28.4
Additional context
Checklist
- [x] checked latest Nix manual (source)
- [x] checked open bug issues and pull requests for possible duplicates
Add :+1: to issues you find important.
also happens in new git repo
I was able to resolve this on my end. The issue was caused by bind mounting (FUSE) ~/.cache/nix using impermanence. I've switched to using a symlink instead, which resolved the problem.
Feel free to close this if you think it's acceptable for Nix to crash in this scenario.
The issue was caused by bind mounting (FUSE) ~/.cache/nix using impermanence. I've switched to using a symlink instead, which resolved the problem.
Does the crash also occur with a fresh tarball cache when using the bindfs for .cache/nix? I wonder if that has something to do with the cache size.
Please note that using bindfs for the cache directory also leads to incredibly poor performance of the git tarball cache and should be avoided.
Yes when using bindfs or any other fuse based fs for mounting .cache/nix nix crashes even with it being completely empty.
It would be useful to have a repro. For now I've tried this and wasn't able to reproduce the issue:
mkdir /tmp/nix-cache-triage
mkdir /tmp/nix-cache-triage-mount
bindfs --multithreaded /tmp/nix-cache-triage /tmp/nix-cache-triage-mount
nix shell github:nixos/nix/2.28.4
NIX_CACHE_HOME=/tmp/nix-cache-triage-mount nix flake metadata github:nixos/nixpkgs/68e9886ae324b47df448c2a1287c38b15d94b2ae
Does that crash with your version of nix?
This seems to have to do with FUSE implementation in question not supporting mmap properly that's required by libgit2 (and WAL in sqlite too).