Skip to content

NixOS system misconfiguration: ldconfig -p has exit status 1 #35387

Open

Description

@coretemp

Issue description

As root:

# ldconfig -p
ldconfig: Can't open cache file /nix/store/xzx1bv1d7z4mgg6sg6ly0jx609qvka4x-glibc-2.25-49/etc/ld.so.cache
: No such file or directory
# echo $?
1

I expect no error message and an exit status of 0.

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.13.4, NixOS, 17.09.git.39cd40f (Hummingbird)
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 1.11.15
  • channels(root): "nixos-17.09.2182.7f6f0c49f0"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

Activity

  1. abbradar commented on Feb 23, 2018

    @abbradar
    Member

    It's arguably the correct behaviour because there's no ld.cache in NixOS at all, hence failure.

  2. coretemp commented on Feb 23, 2018

    @coretemp
    ContributorAuthor

    The correct behavior to me seems to be to output nothing and exit with EXIT_SUCCESS.

    -p
    
    Print the lists of directories and candidate libraries stored in the current cache.
    
  3. abbradar commented on Feb 23, 2018

    @abbradar
    Member

    There is a difference between "empty cache" and "no cache" though and we have the second case -- I don't think changing behaviour of ldconfig is a good idea. We could add an empty cache but is there any merit to it?

  4. coretemp commented on Feb 23, 2018

    @coretemp
    ContributorAuthor

    I am also not sure what's best. I do know that if NixOS would be the only operating system in the world, that we would just delete the -p flag from ldconfig.

    Back in the real world lots of scripts seem to use the -p flag, although generally these scripts will only work on a single operating system anyway.

    Result from searching for "ldconfig -p" on GitHub.

    13,033 code results
    

    Since technically the current cache is undefined, ldconfig -p has https://en.wikipedia.org/wiki/Undefined_behavior and its current behavior (exiting with exitstatus 1) is valid too.

    It would be nicer to have an empty cache, because then the program has no source of undefined behavior anymore.

  5. abbradar commented on Feb 23, 2018

    @abbradar
    Member

    What is this call usually used for? To enumerate library directories? If so we could emulate it in our stdenv just for builds (though I'm not sure we want this instead of patching packages and telling upstream to fix their stuff).

  6. bbarker commented on Oct 12, 2019

    @bbarker
    Contributor

    I'm also having the issue on one of my systems. Oddly it occurs when running stack --nix build, which i've certainly run on other NixOS systems (albeit maybe slightly different versions).

    [nix-shell:/opt/purescript-dynlangs]$ ldconfig -p                                                                                                                                                                                                                                                                                                                          │·······························································
    ldconfig: Can't open cache file /nix/store/7gx4kiv5m0i7d7qkixq2cwzbr10lvxwc-glibc-2.27/etc/ld.so.cache                                                                                                                                                                                                                                                                     │·······························································
    : No such file or directory                                                                                                                                                                                                                                                                                                                                                │·······························································                                                                                                                                                                                                                                                                                                                                                                           │·······························································
    [nix-shell:/opt/purescript-dynlangs]$ stack --nix build                                                                                                                                                                                                                                                                                                                    │·······························································
    /nix/store/8bh94qdmga1zkb85li56380i44ay82cs-glibc-2.27-bin/bin/ldconfig: Can't open cache file /nix/store/7gx4kiv5m0i7d7qkixq2cwzbr10lvxwc-glibc-2.27/etc/ld.so.cache                                                                                                                                                                                                      │·······························································
    : No such file or directory                                                                                                                                                                                                                                                                                                                                                │·······························································I don't know how to install GHC on your system configuration, please install manually
    

    My system info:

    • system: "x86_64-linux" │·······························································
    • host os: Linux 4.14.109, NixOS, 18.09.2456.43ba99fa035 (Jellyfish) │·······························································
    • multi-user?: yes │·······························································
    • sandbox: yes │·······························································
    • version: nix-env (Nix) 2.1.3 │·······························································
    • channels(nixos): "" │·······························································
    • channels(root): "nixos-18.09.2456.43ba99fa035" │·······························································
    • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
  7. flokli commented on Oct 14, 2019

    @flokli
    Member

    @bbarker did you dig through stack on what it uses ldconfig -p for?

  8. stale commented on Jun 1, 2020

    @stale

    Thank you for your contributions.
    This has been automatically marked as stale because it has had no activity for 180 days.
    If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
    Here are suggestions that might help resolve this more quickly:

    1. Search for maintainers and people that previously touched the
      related code and @ mention them in a comment.
    2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
      irc.freenode.net.
  9. added
    2.status: stale
    on Jun 1, 2020
  10. uri-canva commented on Feb 22, 2021

    @uri-canva
    Contributor

    We are also hitting this issue with playwright, which uses ldconfig -p to provide the user with an error message suggesting how to install missing dependencies: https://github.com/aslushnikov/playwright/blob/2ac93f0a8bd61bdd7920629d9560e40ff1f15506/src/server/validateDependencies.ts

    Reported on playwright as well: microsoft/playwright#5501.

  11. removed
    2.status: stale
    on Feb 22, 2021
  12. stale commented on Aug 22, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  13. added
    2.status: stale
    on Aug 22, 2021
  14. thinkrapido commented on Apr 8, 2022

    @thinkrapido
    Contributor

    It is also not working for python's Nuitka

    Nuitka/Nuitka#1520

  15. removed
    2.status: stale
    on Apr 8, 2022
  16. danielmain commented on Jul 2, 2022

    @danielmain
    Contributor

    Same here 😞

    ➜ ~ lutris /run/current-system/sw/bin/ldconfig: Can't open cache file /nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/etc/ld.so.cache : No such file or directory 2022-07-02 08:02:19,615: ['/run/current-system/sw/bin/ldconfig', '-p'] command failed: Command '['/run/current-system/sw/bin/ldconfig', '-p']' returned non-zero exit status 1. 2022-07-02 08:02:19,839: Starting Lutris 0.5.10.1

  17. bugeats commented on Aug 25, 2022

    @bugeats

    Tensorflow CUDA config scripts currently use ldconfig -p and break tensorflow-sys builds in NixOS.

  18. flokli commented on Aug 26, 2022

    @flokli
    Member
  19. bugeats commented on Aug 26, 2022

    @bugeats

    This line probably needs to be changed

    I mean, yes, maybe? The way I read this particular script is that it will work fine in NixOS just as long as the call to ldconfig -p doesn't return an error. I suspect it's the same for all the other external projects mentioned in this issue.

    FWIW, I think that @abbradar had the right idea. An empty ld.so.cache should do the trick. I also think it's arguable the semantically correct thing to do. In the context of NixOS, all cache queries should be misses.

  20. added
    2.status: stale
    on Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions