Closed bbigras closed 5 months ago
@regnat this seems pretty bad?
@regnat this seems pretty bad?
The fact that it causes the daemon to crash is bad, indeed.
The fact that it’s not working seems pretty legit given that the installation script (purposely) creates a drvPath
that’s not valid (both because it’s not pointing to an existing drv and because it doesn’t have the right shape for a drv path).
Did this use to work?
Yes, this used to work on 2.3
I think I just hit this, both locally and in GitHub actions.
@regnat is there a workaround?
My nix-daemon logs look like this:
Dec 21 17:20:23 no nix-daemon[77914]: accepted connection from pid 78026, user n (trusted)
Dec 21 17:20:52 no nix-daemon[77914]: accepted connection from pid 78327, user n (trusted)
Dec 21 17:21:07 no nix-daemon[78344]: nix-daemon: src/libstore/sqlite.cc:92: nix::SQLiteStmt::Use::Use(nix::SQLiteStmt&): Assertion `stmt.stmt' failed.
Dec 21 17:21:21 no systemd[1]: Stopping Nix Daemon...
Dec 21 17:21:21 no systemd[1]: nix-daemon.service: Deactivated successfully.
Dec 21 17:21:21 no systemd[1]: Stopped Nix Daemon.
Dec 21 17:21:21 no systemd[1]: nix-daemon.service: Consumed 5.313s CPU time, no IO, received 310B IP traffic, sent 206B IP traffic.
-- Boot caeef82e0b224a888aaccb9a711810da --
Dec 21 17:21:48 no systemd[1]: Started Nix Daemon.
Dec 21 17:21:48 no nix-daemon[1170]: accepted connection from pid 1093, user n (trusted)
Dec 21 17:21:49 no nix-daemon[1170]: accepted connection from pid 1681, user n (trusted)
Dec 21 17:22:08 no nix-daemon[1170]: accepted connection from pid 3117, user n (trusted)
Dec 21 17:22:08 no nix-daemon[3130]: nix-daemon: src/libstore/derivations.cc:630: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
Dec 21 17:22:32 no nix-daemon[1170]: accepted connection from pid 4254, user n (trusted)
Dec 21 17:22:32 no nix-daemon[1170]: accepted connection from pid 4479, user n (trusted)
Dec 21 17:22:44 no nix-daemon[1170]: accepted connection from pid 4962, user n (trusted)
Dec 21 17:22:44 no nix-daemon[4975]: nix-daemon: src/libstore/derivations.cc:630: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
Dec 21 17:36:02 no nix-daemon[1170]: accepted connection from pid 13458, user n (trusted)
Dec 21 17:36:13 no nix-daemon[1170]: accepted connection from pid 13594, user n (trusted)
Dec 21 17:36:13 no nix-daemon[13607]: nix-daemon: src/libstore/derivations.cc:630: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
Dec 21 17:56:23 no nix-daemon[1170]: accepted connection from pid 23970, user n (trusted)
Dec 21 17:56:23 no nix-daemon[23985]: nix-daemon: src/libstore/derivations.cc:630: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
Sorry I can't provide precise information as to how I got there, I'm confused myself and I think there might be several bugs interacting.
The least I can tell is I'm using Nix 2.4 and messing around with flakes and ca-derivations.
Ah, the first error in those logs seems to be from https://github.com/NixOS/nix/issues/5017
@regnat is there a workaround?
First thing that comes to my mind would be something like
with import <nixpkgs> {};
buildEnv {
name = "cachix-env";
paths = [ /nix/store/3lqc09mn31yd05mcy6gcd9nsbcwwphic-cachix-0.6.1 ];
}
(this relies on nixpkgs, but you can probably do something with builtin:buildenv
instead).
Ideally nix-env
should be able to take direct paths as input. Not sure why that’s not the case
Does this issue still exist?
Yeah it seems like it wouldn't anymore.
I can reproduce this with nix 2.21.0.
I did the following nix profile install cachix -vvv --quiet -j8 -f https://cachix.org/api/v1/install
and the daemon crashed:
linking '/nix/store/k86zg9jv1nbk4l46yynhllg8sf93cp6m-nix-2.16.2/lib/libboost_thread.so' to '/nix/store/.links/16cxvl4cg3xjbmrwhgwvrldvfp69qcadxvqg6m9sw8g929wah9qc'
linking '/nix/store/k86zg9jv1nbk4l46yynhllg8sf93cp6m-nix-2.16.2/lib/tmpfiles.d/nix-daemon.conf' to '/nix/store/.links/13glwg0wrn8z6l3bc2ml5wyhq4v9yhlh1yqlbs262yzkq8vsmwh0'
copying path '/nix/store/gw5pl0by3lqcznmgf4fykhbkz3x5shrl-cachix-1.7-bin' from 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/nar/15gv8sv61cd3361xv8bg686pc1c6bbx7p981khvvijnqmdxd069x.nar.xz'...
error: Nix daemon disconnected unexpectedly (maybe it crashed?)
journalctl reports:
Apr 05 15:38:56 nixos nix-daemon[303110]: nix-daemon: src/libstore/derivations.cc:935: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
Apr 05 15:38:56 nixos systemd[1]: Created slice Slice /system/systemd-coredump.
Apr 05 15:38:56 nixos systemd[1]: Started Process Core Dump (PID 303190/UID 0).
Apr 05 15:38:56 nixos systemd-timesyncd[755]: Network configuration changed, trying to establish connection.
Apr 05 15:38:56 nixos systemd-timesyncd[755]: Network configuration changed, trying to establish connection.
Apr 05 15:38:56 nixos systemd-timesyncd[755]: Network configuration changed, trying to establish connection.
Apr 05 15:39:03 nixos systemd-coredump[303191]: [🡕] Process 303110 (nix-daemon) of user 0 dumped core.
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 libbrotlicommon.so.1 without build-id.
Module libaws-c-common.so.1 without build-id.
Module libaws-checksums.so.1.0.0 without build-id.
Module libaws-c-sdkutils.so.1.0.0 without build-id.
Module libaws-c-cal.so.1.0.0 without build-id.
Module libaws-c-compression.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 libgssapi_krb5.so.2 without build-id.
Module libpsl.so.5 without build-id.
Module libidn2.so.0 without build-id.
Module libnghttp2.so.14 without build-id.
Module libxml2.so.2 without build-id.
Module libbz2.so.1 without build-id.
Module libzstd.so.1 without build-id.
Module liblzma.so.5 without build-id.
Module libacl.so.1 without build-id.
Module libz.so.1 without build-id.
Module libssh2.so.1 without build-id.
Module libpcre.so.1 without build-id.
Module libhttp_parser.so.2.9 without build-id.
Module libcpuid.so.16 without build-id.
Module libbrotlidec.so.1 without build-id.
Module libbrotlienc.so.1 without build-id.
Module libseccomp.so.2 without build-id.
Module libaws-crt-cpp.so 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 libarchive.so.13 without build-id.
Module libgit2.so.1.7 without build-id.
Module libboost_context.so.1.81.0 without build-id.
Module libgcc_s.so.1 without build-id.
Module libstdc++.so.6 without build-id.
Module liblowdown.so.1 without build-id.
Module libeditline.so.1 without build-id.
Stack trace of thread 303110:
#0 0x00007fb2611c207c __pthread_kill_implementation (libc.so.6 + 0x8d07c)
#1 0x00007fb261172e06 raise (libc.so.6 + 0x3de06)
#2 0x00007fb26115b8f5 abort (libc.so.6 + 0x268f5)
#3 0x00007fb26115b819 __assert_fail_base.cold (libc.so.6 + 0x26819)
#4 0x00007fb26116b686 __assert_fail (libc.so.6 + 0x36686)
#5 0x00007fb261957ead _ZN3nix15BasicDerivation12nameFromPathERKNS_9StorePathE (libnixstore.so + 0x157ead)
#6 0x00007fb261a19427 _ZN3nixL20readDerivationCommonERNS_5StoreERKNS_9StorePathEb (libnixstore.so + 0x219427)
#7 0x00007fb261a19572 _ZN3nix5Store14readDerivationERKNS_9StorePathE (libnixstore.so + 0x219572)
#8 0x00007fb2619054f9 _ZN3nix14DerivationGoal14loadDerivationEv (libnixstore.so + 0x1054f9)
#9 0x00007fb261949f1a _ZN3nix6Worker3runERKSt3setISt10shared_ptrINS_4GoalEENS_15CompareGoalPtrsESaIS4_EE (libnixstore.so + 0x149f1a)
#10 0x00007fb2619192ba _ZN3nix5Store21buildPathsWithResultsERKSt6vectorINS_11DerivedPathESaIS2_EENS_9BuildModeESt10shared_ptrIS0_E (libnixstore.so + 0x1192ba)
#11 0x00007fb261952c88 _ZN3nix6daemonL9performOpEPNS0_12TunnelLoggerENS_3refINS_5StoreEEENS_11TrustedFlagENS0_13RecursiveFlagEjRNS_6SourceERNS_12BufferedSinkENS_11WorkerProto2OpE (libnixstore.so + 0x152c88)
#12 0x00007fb2619570a8 _ZN3nix6daemon17processConnectionENS_3refINS_5StoreEEERNS_8FdSourceERNS_6FdSinkENS_11TrustedFlagENS0_13RecursiveFlagE (libnixstore.so + 0x1570a8)
#13 0x00005608942b503d _ZNSt17_Function_handlerIFvvEZL10daemonLoopSt8optionalIN3nix11TrustedFlagEEEUlvE_E9_M_invokeERKSt9_Any_data (nix + 0x10d03d)
#14 0x00007fb261798a1d _ZNSt17_Function_handlerIFvvEZN3nix12startProcessESt8functionIS0_ERKNS1_14ProcessOptionsEEUlvE_E9_M_invokeERKSt9_Any_data.lto_priv.0 (libnixutil.so + 0xc2a1d)
#15 0x00007fb2617afda9 _ZN3nixL6doForkEbRSt8functionIFvvEE.constprop.0 (libnixutil.so + 0xd9da9)
#16 0x00007fb26179895f _ZN3nix12startProcessESt8functionIFvvEERKNS_14ProcessOptionsE (libnixutil.so + 0xc295f)
#17 0x00005608942b5815 _ZL10daemonLoopSt8optionalIN3nix11TrustedFlagEE (nix + 0x10d815)
#18 0x00005608942b6a0a _ZL15main_nix_daemoniPPc.lto_priv.0 (nix + 0x10ea0a)
#19 0x00005608942fbc6f _ZN3nix11mainWrappedEiPPc (nix + 0x153c6f)
#20 0x00007fb262063985 _ZN3nix16handleExceptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt8functionIFvvEE (libnixmain.so + 0x24985)
#21 0x000056089424884c main (nix + 0xa084c)
#22 0x00007fb26115d0ce __libc_start_call_main (libc.so.6 + 0x280ce)
#23 0x00007fb26115d189 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x28189)
#24 0x000056089424d1d5 _start (nix + 0xa51d5)
Stack trace of thread 303113:
#0 0x00007fb26123589f __poll (libc.so.6 + 0x10089f)
#1 0x00007fb2608348e0 Curl_poll (libcurl.so.4 + 0x618e0)
#2 0x00007fb26082ac5a multi_wait.part.0 (libcurl.so.4 + 0x57c5a)
#3 0x00007fb26082ae67 curl_multi_wait (libcurl.so.4 + 0x57e67)
#4 0x00007fb2619793b7 _ZN3nix16curlFileTransfer16workerThreadMainEv (libnixstore.so + 0x1793b7)
#5 0x00007fb26197ad60 _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN3nix16curlFileTransferC4EvEUlvE_EEEEE6_M_runEv (libnixstore.so + 0x17ad60)
#6 0x00007fb2614e8683 execute_native_thread_routine (libstdc++.so.6 + 0xe8683)
#7 0x00007fb2611c0383 start_thread (libc.so.6 + 0x8b383)
#8 0x00007fb26124300c __clone3 (libc.so.6 + 0x10e00c)
Stack trace of thread 303111:
#0 0x00007fb26123589f __poll (libc.so.6 + 0x10089f)
#1 0x00007fb26194fd8f _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN3nix12MonitorFdHupC4EiEUlvE_EEEEE6_M_runEv (libnixstore.so + 0x14fd8f)
#2 0x00007fb2614e8683 execute_native_thread_routine (libstdc++.so.6 + 0xe8683)
#3 0x00007fb2611c0383 start_thread (libc.so.6 + 0x8b383)
#4 0x00007fb26124300c __clone3 (libc.so.6 + 0x10e00c)
ELF object binary architecture: AMD x86-64
Still be able to reproduce on nix 2.21.2 using nix profile
.
Command:
sudo nix profile install --profile ./p -f https://cachix.org/api/v1/install cachix
Output:
nix: src/libstore/derivations.cc:935: static std::string_view nix::BasicDerivation::nameFromPath(const nix::StorePath&): Assertion `hasSuffix(nameWithSuffix, extension)' failed.
minimized:
let
package = {
name = "cachix-1.7.3";
type = "derivation";
system = "x86_64-linux";
outputs = [ "out" ];
# TODO: we lie here so that Nix won't build it
drvPath = "/nix/store/8qlfcic10lw5304gqm8q45nr7g7jl62b-cachix-1.7.3-bin";
outputName = "out";
outPath = "/nix/store/8qlfcic10lw5304gqm8q45nr7g7jl62b-cachix-1.7.3-bin";
out = package;
};
in
package
building this with the daemon will cause the daemon to crash.
Describe the bug
nix-daemon crash
originally posted in https://github.com/NixOS/nix/issues/4903#issuecomment-870906902
Steps To Reproduce
nix-env -vvv --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
Expected behavior
nix-env --version
outputnix-env (Nix) 2.4pre20210601_5985b8b
Additional context