Nixos-rebuild fails because bash is broken (dependency issue in, undefined symbol: __nanosleep_nocancel)

If I try to run nixos-rebuild switch I get

/nix/store/j8vysakw78bpgngba32hfwwikqda9yx2-bash-4.4-p23/bin/bash: symbol lookup error: /nix/store/bqbg6hb2jsl3kvf6jgmgfdqy06fpjrrn-glibc-2.30/lib/ undefined symbol: __nanosleep_nocancel, version GLIBC_PRIVATE

I get the same when running /nix/store/j8vysakw78bpgngba32hfwwikqda9yx2-bash-4.4-p23/bin/bash. What is weird, that I some version of bash must be working, otherwise I could not log in o.O.

/run/current-system/sw/bin/bash points to a different object in storage, namely /nix/store/x4gd806afbgx0ag1jf8y7blzrrhiyx8q-bash-interactive-4.4-p23/bin/bash

Happened sometime three weeks ago after an update on the unstable channel. What went wrong? Can this be repaired?

This seems to be an issue with LD preloading. Temporarily renaming


helped. Can someone explain?

Should be only a temporary breakage due to breaking changes in the GNU C library (glibc) version 2.31 (Nixpkgs merge: 5e7d581ffdba220d088ed92f382a41acb37670e1).

I believe that due to impurities it can happen that binaries build with glibc 2.30 do now load glibc 2.31 which causes these issues (as e.g. the __nanosleep_nocancel function was removed). Another such breakage: MESA-LOADER: failed to open $driver · Issue #94315 · NixOS/nixpkgs · GitHub

But I haven’t really looked into the details (e.g. why a newer glibc version is used / where the impurities come from - but I think there is already an old Nix/Nixpkgs issue about this).

Trying to fix this there: