Skip to content

lmstudio: remove unnecessary --set-rpath from patchelf to fix lms segfault#511533

Open
cavebatsofware wants to merge 1 commit intoNixOS:masterfrom
cavebatsofware:510446_lmstudio-lms-segfault
Open

lmstudio: remove unnecessary --set-rpath from patchelf to fix lms segfault#511533
cavebatsofware wants to merge 1 commit intoNixOS:masterfrom
cavebatsofware:510446_lmstudio-lms-segfault

Conversation

@cavebatsofware
Copy link
Copy Markdown

@cavebatsofware cavebatsofware commented Apr 19, 2026

Closes #510446

As described in #510446, the lms CLI tool segfaults due to an unnecessary --set-rpath argument being passed to patchelf.

The lms binary is a Node.js/webpack bundle that doesn't require custom library paths. Setting rpath on NixOS can cause ELF header corruption leading to segmentation faults. Only the interpreter needs fixing for AppImage-extracted binaries.

Removing the --set-rpath argument resolves the issue while keeping the necessary --set-interpreter fix.

Before (broken):

patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
  --set-rpath "${lib.getLib stdenv.cc.cc}/lib:${lib.getLib stdenv.cc.cc}/lib64:$out/lib:${
    lib.makeLibraryPath [ (lib.getLib stdenv.cc.cc) ]
  }" $out/bin/lms
image

After (fixed)

patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $out/bin/lms
image

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

As described in NixOS#510446 lms segfaults due to an unnecessary "--set-rpath" .

Removing that argument resolves the issue with lms.
@nixpkgs-ci nixpkgs-ci bot requested a review from crertel April 19, 2026 19:42
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! labels Apr 19, 2026
@crertel crertel self-assigned this Apr 19, 2026
@crertel
Copy link
Copy Markdown
Contributor

crertel commented Apr 19, 2026

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 511533
Commit: 9098af30a9eb1a435df5a3a091d3b13fdc265a66


x86_64-linux

✅ 1 package built:
  • lmstudio

@crertel
Copy link
Copy Markdown
Contributor

crertel commented Apr 19, 2026

Thank you for the fix!

I do note that while this removes the segfault, I was unable to get lms serve to run. How is it on your end?

image

@cavebatsofware
Copy link
Copy Markdown
Author

cavebatsofware commented Apr 19, 2026

Thank you for the fix!

I do note that while this removes the segfault, I was unable to get lms serve to run. How is it on your end?
image

Server appears to be working on my side, my package repo is pointed at my forks master which has this merged in already, so it may be something with it running from shell vs a system package but I don't know for sure if that is why it isn't working for you.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lmstudio: lms segfaults on x86_64-linux; triggered by patchelf --set-rpath on Bun binary

2 participants