Missing `libnss_sss.so.2` where needed.
Describe the bug
libnss_sss.so.2 not contained in nix-environment for packages that need them.
Among them:
- bosh-cli
- whoami
Environment
The following environment probably does not matter (apart from not using NixOS) but I include it for completeness:
- OS: Ubuntu 20.04
- Nix: 2.13.2 (single-user-installation)
- direnv: 2.32.1 (used to load shells defined in nix-flakes)
What may matter however: I use a company-linux making use of https://ubuntu.com/server/docs/service-sssd-ad to manage users.
Steps To Reproduce
Steps to reproduce the behavior with whoami:
- Open a terminal where
whoamiis provided by Nix. - Execute
whoami.
Addition: I found the reason using strace whoami:
[…]
openat(AT_FDCWD, "/nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/libnss_sss.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (file or directory not found)
[…]
Expected behavior
I expect to see my username.
Actual behaviour
% whoami
whoami: cannot find name for user ID <my-user-id>
Additional context
There is a related issue which helped me to find the quick-fix: #31700
Quick fix
Using the library from my host-system: LD_PRELOAD='/lib/x86_64-linux-gnu/libnss_sss.so.2' whoami works!
The package that provides libnss_sss.so.2 under the mentioned path is libnss-sss.
Notify maintainers
For gnu-coreutils (whoami): @dasJ
For bosh-cli: @risicle
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
these 2 paths will be fetched (1.10 MiB download, 6.93 MiB unpacked):
/nix/store/f01r6lmbi7mg0xg80mvzdwqhlmrzvy4v-bash-interactive-5.2-p15
/nix/store/skjaxjyjqf933mw7pcnhxzms9hk593q9-nix-info
copying path '/nix/store/f01r6lmbi7mg0xg80mvzdwqhlmrzvy4v-bash-interactive-5.2-p15' from 'https://cache.nixos.org'...
copying path '/nix/store/skjaxjyjqf933mw7pcnhxzms9hk593q9-nix-info' from 'https://cache.nixos.org'...
- system: `"x86_64-linux"`
- host os: `Linux 5.15.0-69-generic, Ubuntu, 20.04.6 LTS (Focal Fossa), nobuild`
- multi-user?: `no`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.3`
- channels(i539286): `"nixpkgs"`
- nixpkgs: `/sapmnt/home/<redacted>/.nix-defexpr/channels/nixpkgs`
maybe similar to https://github.com/NixOS/nixpkgs/issues/12335 (read through it and the linked issues) solution should be to install nscd
@Artturin Thank you for looking into the issue. However closing this ticket was too fast: nscd has been already available:
% whoami
whoami: cannot find name for user ID <my-user-id>
1 % which nscd
/nix/store/qvaj0419bgnldvnqy4dylfrq34khhfxr-glibc-2.37-8-bin/bin/nscd
Please re-open the ticket.
Looks like this ticket may be related to #1868. (However as they try to fix builds there, the wrapper-solution does not look applicable to me for this problem.)
Relevant: https://github.com/NixOS/nixpkgs/pull/111194
Hi. I am using AlmaLinux9.2 with nix single-user installation. The system is connected to active directory via LDAP using sssd configuration. The problem is that glibc is not able to find libnss_sss.so, so it is not able to resolve users correctly. This affects a big number of any utilities that try to do it, starting from id, ps, through htop, glances, and finally: ssh is unusable and just exits with No user exists for uid 11021.
$ id -nu
id: cannot find name for user ID 11021
11021
Pre-loading host libnss_sss.so works:
$ LD_PRELOAD=/usr/lib64/libnss_sss.so.2 id -nu
kcukrowski
Pre-loading nix libnsss_sss.so works:
$ LD_PRELOAD=~/.nix-profile/lib/libnss_sss.so.2 id -nu
kcukrowski
Just adding the path to libnsss_sss for the linker to find it works:
$ LD_LIBRARY_PATH=~/.nix-profile/lib id -nu
kcukrowski
It would be great if utilities that depend on glibc would be able to find the library. How to solve such problem? Thanks.
I added sssd to my shell.nix and set LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${pkgs.sssd}/lib which solved the problem on my system: Ubuntu 22.04, authentication via LDAP, nix 24.05.
I do not like this solution because shell.nix should not contain bits that are related to a specific host, but that is better than nothing.
FYI. In flake's devShells you can fix this via this shellHook:
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.sssd}/lib
'';
https://discourse.nixos.org/t/whoami-cannot-find-name-for-user-id-in-nix-develop/64460/3
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/whoami-cannot-find-name-for-user-id-in-nix-develop/64460/2