Repository navigation
Closed as not planned
Labels
Description
Describe the bug
On one of my hosts after a rebuild I lost the ability to use ANY Nix commands because of this error:
> nix --verison
nix: /nix/store/bvy2z17rzlvkx2sj7fy99ajm853yv898-glibc-2.34-210/lib/libpthread.so.0:
version `GLIBC_PRIVATE' not found (required by /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1)
It happens for other binaries too:
> sudo nixos-rebuild boot
building the system configuration...
nix: /nix/store/bvy2z17rzlvkx2sj7fy99ajm853yv898-glibc-2.34-210/lib/libpthread.so.0:
version `GLIBC_PRIVATE' not found (required by /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1)s
> nix-store --version
nix-store: /nix/store/bvy2z17rzlvkx2sj7fy99ajm853yv898-glibc-2.34-210/lib/libpthread.so.0:
version `GLIBC_PRIVATE' not found (required by /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1)
Steps To Reproduce
No clue whatsoever.
Expected behavior
It doesn't explode.
nix-env --version output
> nix-env --version
nix-env: /nix/store/bvy2z17rzlvkx2sj7fy99ajm853yv898-glibc-2.34-210/lib/libpthread.so.0:
version `GLIBC_PRIVATE' not found (required by /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1)
Additional context
I managed to find that some older versions of Nix do work:
> which nix
/run/current-system/sw/bin/nix
> ls -l /run/current-system/sw/bin/nix
lrwxrwxrwx 1 root root 61 Jan 1 1970 /run/current-system/sw/bin/nix -> /nix/store/y6daxy2r6l2w8afpqw8dmxks71p9v8va-nix-2.7.0/bin/nix
> /nix/store/y6daxy2r6l2w8afpqw8dmxks71p9v8va-nix-2.7.0/bin/nix --version
/nix/store/y6daxy2r6l2w8afpqw8dmxks71p9v8va-nix-2.7.0/bin/nix: /nix/store/bvy2z17rzlvkx2sj7fy99ajm853yv898-glibc-2.34-210/lib/libpthread.so.0:
version `GLIBC_PRIVATE' not found (required by /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1)
> find /nix/store -maxdepth 1 -iname '*nix-2.7.0'
/nix/store/7c4cp4pj389j8rmrc40x5sq6csf0m8ks-nix-2.7.0
/nix/store/h538v75x5xgwzy31s5ia3ah7k6cdyzmy-nix-2.7.0
/nix/store/v2f9abhmmvk2slns100c2h696d5xj4gm-nix-2.7.0
/nix/store/rvwxh34igy78fzgjwr3z1biygpbxn66h-nix-2.7.0
/nix/store/y6daxy2r6l2w8afpqw8dmxks71p9v8va-nix-2.7.0
> /nix/store/7c4cp4pj389j8rmrc40x5sq6csf0m8ks-nix-2.7.0/bin/nix --version
nix (Nix) 2.7.0
I also tried verifying and repairing Nix store, but that did nothing:
> sudo /nix/store/7c4cp4pj389j8rmrc40x5sq6csf0m8ks-nix-2.7.0/bin/nix-store \
--verify --check-contents --repair
reading the Nix store...
checking path existence...
checking link hashes...
checking store hashes...
Activity
Kha commentedon May 23, 2022
Do you have
LD_PRELOADorLD_LIBRARY_PATHset by any chance? NixOS/nixpkgs#327854jakubgs commentedon May 23, 2022
I do not:
nixos-discourse commentedon May 23, 2022
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nixos-rebuild-switch-fails-due-to-broken-glibc/18583/6
fogti commentedon May 25, 2022
with which nixpkgs (against which the broken nix is built) version is this happening?
jakubgs commentedon May 25, 2022
Right now it's NixOS/nixpkgs@2d474d6, but I also used NixOS/nixpkgs@79385ae and it was broken.
jakubgs commentedon Jun 1, 2022
Oh boy, now I've seen it on another host, except it's the
nix-daemonthis time:That can't be good...
jakubgs commentedon Jun 1, 2022
This is weird, when I try to run
nix-daemonwithstrace -fand filter forlibpthreadI see this:But when I filter for
librtI get this:Why is that in one case
glibc-2.34-210is being searched, and in anotherglibc-2.33-123? That doesn't seem right.jakubgs commentedon Jun 1, 2022
I don't get what's happening here:
Where is the
glibc-2.33-123coming from?nix: don't use unstable channel for Nix
jakubgs commentedon Jun 1, 2022
I've managed to fix it by reverting back to
nix_2_7fromnixos-21.11channel.Previously I was using
nixos-unstableatf1c167688a6f81f4a51ab542e5f476c8c595e457and pullingnix_2_8from it.Bad idea apparently. Though it worked fine on most of my hosts, just two had issue.
Kha commentedon Jun 1, 2022
For what it's worth, I believe
LD_DEBUG=all ldd nixgives much more helpful output in such casesjakubgs commentedon Jun 1, 2022
Indeed it does. That's a helpful tip, thanks @Kha. Here's what I got:
https://gist.github.com/jakubgs/d050192b1c55e8cc0ab9143856ffee3b
The most interesting parts might be:
Not sure what to make of it though.
Kha commentedon Jun 1, 2022
Are you using the NixOS option
environment.memoryAllocator.provider?malloc-provider-scudois definitely not a default dependency ofnix.jakubgs commentedon Jun 1, 2022
Not to my knowledge, no, I can't find it anywhere in my config.
2 remaining items
jakubgs commentedon Jun 2, 2022
Actually, I can't fix this on one of my hosts because when I try to
nixos-rebuild bootit explodes without a reason:Not sure how I'm supposed to switch/boot into a fixed NixOS generation.
jakubgs commentedon Jun 2, 2022
I can't even activate the newly built system:
I'm worried rebooting the host will break things if I
nixos-rebuild bootdoesn't properly run.cstich commentedon Jun 5, 2022
At least I ended up with a broken generation and the reboot failed. I could boot into an old one for what it is worth.
jakubgs commentedon Jun 6, 2022
I guess that's one way to do it, boot into an older generation and try to rebuild using new stable Nix.
Although, I don't think I know a way to switch grub config to and older generation, and I can't boot it on Hetzner without requesting a KVM. I think I'll just have to get a KVM. I guess I can just manually try editing
grub.cfgto change the default.jakubgs commentedon Jun 6, 2022
Well, I've booted into the oldest generation of the OS I have and it still has the issue, so I don't know how I'm supposed to fix this.
jakubgs commentedon Jun 6, 2022
Oh for the love of Zeus. I booted into a kexec I built from a working system and it still fails:
I literally cannot even.
Kha commentedon Jun 6, 2022
Can't you just (temporarily) remove the
/etc/ld-nix.so.preload? Not using the custom allocator shouldn't break anything.jakubgs commentedon Jun 6, 2022
I ended up purging everything from
/mnt(root) aside from/etc/nixosand a few others look/boot{1,2}and also disabled the hardened profile, and rannixos-install. I've managed to install a working system that has a functionalnixos-rebuild.That was VERY annoying.
jakubgs commentedon Jun 6, 2022
After booting back in my system I re-enabled the hardened profile, but while using stable version of
nix_2_8, and it's back:So it appears the issue is with the hardened profile, and the unstable Nix version was just a red herring.
jakubgs commentedon Jun 6, 2022
And indeed, after re-enabling hardened profile but explicitly setting this:
Now it works fine after reboot, so as you suggested correctly, this was indeed the issue.
bardiel: use libc memoryAllocator, fix GLIBC errors
jakubgs commentedon Jun 7, 2022
Interestingly, on another host I tried your suggestion and I backed up the
ld-nix.so.preloadsymlink:Which allowed the Grub config to be updated and me to reboot into a fresh installation with working Nix.
arael: include memoryAllocator fix for GLIBC errors
roberth commentedon Jul 25, 2025
Thank you for sharing your solution!
I'll close this as it's not actionable, but it can still be found using issue search.