Skip to content

build-fhsenv-bubblewrap includes /usr/lib and /usr/lib32 in LD_LIBRARY_PATH #262775

@LunNova

Description

@LunNova

export LD_LIBRARY_PATH="/run/opengl-driver/lib:/run/opengl-driver-32/lib:/usr/lib:/usr/lib32''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"

Why does buildFHSEnv include /usr/lib and /usr/lib64 in LD_LIBRARY_PATH? Having them mounted at those locations should be sufficient for apps built for FHS systems to work.

Including them in LD_LIBRARY_PATH causes these libraries to be used even for nix-built packages with proper dependencies on store paths, leading to runtime crashes. An example of this sort of crash occurs when running nix inside a shell inside vscode-fhs as it runs against incorrect libraries.

Is there a case where FHS binaries require LD_LIBRARY_PATH as well?

I've tested vscode-fhs and steam with a small patch to remove these two entries and they work fine but I'd assume there was some reason for including these and I've just not tested it.

@Atemu

Some examples of issues I've ran into that had this as a root cause, when running programs inside a FHS shell:

$ fish: Job 5, 'whoami' terminated by signal SIGSEGV (Address boundary error)
fish: Job 4, 'basename (string trim -l -c '-'…' terminated by signal SIGSEGV (Address boundary error)
fish: Process 352878, 'wc' from job 3, 'jobs -c | command wc -l' terminated by signal SIGSEGV (Address boundary error)
fish: Process 352841, 'sed' from job 2, '__fish_git_prompt | command sed…' terminated by signal SIGSEGV (Address boundar

$ nixpkgs-fmt .
*** stack smashing detected ***: terminated
fish: Job 1, 'nixpkgs-fmt .' terminated by signal SIGABRT (Abort)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions