fix: nvidia library resolution on merged-lib guests (e.g. Arch)#2014
Open
RomeoV wants to merge 1 commit into89luca89:mainfrom
Open
fix: nvidia library resolution on merged-lib guests (e.g. Arch)#2014RomeoV wants to merge 1 commit into89luca89:mainfrom
RomeoV wants to merge 1 commit into89luca89:mainfrom
Conversation
On guests where /usr/lib64 is a symlink to /usr/lib (Arch Linux, etc.), the nvidia init would mount 32-bit host libraries from /usr/lib/ into /usr/lib/, then skip the 64-bit libraries from /usr/lib64/ because the destination path already existed. This caused `nvidia-smi` and other 64-bit nvidia tools to fail with "incompatible ELF class". Two changes fix this: 1. Only set lib64_dir="/usr/lib64/" when /usr/lib64 is a real directory, not a symlink. This avoids treating a merged-lib guest as split-lib. 2. Search host lib directories in lib64-first order so that 64-bit libraries are mounted before their 32-bit counterparts. The existing "file exists" check then correctly skips the 32-bit duplicates. Reproducer: Bazzite (Fedora immutable) host + Arch Linux distrobox with --nvidia flag. Bazzite ships 32-bit nvidia libs in /usr/lib/ for Steam/Proton compatibility, while Arch expects 64-bit libs there. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nvidia-smi(and other 64-bit nvidia tools) failing withincompatible ELF classinside Arch Linux distroboxes on Fedora/Bazzite hosts with--nvidia/usr/lib/and 64-bit in/usr/lib64/, but Arch has/usr/lib64→/usr/lib(merged-lib layout), so both map to the same directory and the 32-bit versions win/usr/lib64as a separate directory when it's a symlink, (2) search hostlib64beforelibso 64-bit libs are mounted first and the existing "file exists" check skips 32-bit duplicatesReproducer
Root cause visible with
LD_DEBUG:The file at
/usr/lib/libnvidia-ml.so.1is 32-bit (from host's/usr/lib/) whilenvidia-smiis 64-bit.Test plan
nvidia-smiworks in Arch distrobox on Fedora/Bazzite host with--nvidia/usr/lib64/directory)x86_64-linux-gnulayout)🤖 Generated with Claude Code