Skip to content

[BUG] cuda broken - Cannot load libcuda.so.1 #403

Closed as not planned
Closed as not planned

Description

@HidingCherry

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Trying to use hardware transcoding with nvidia.
image
plex uses custom libraries from /usr/lib/plexmediaserver/lib/ instead of /usr/lib/ as one would expect.
nvidia-cdi has even been modified to include libcuda.so.1 to /usr/lib.

nvidia-smi works as expected.

PS: you really miss a "custom comment" section...

Expected Behavior

No response

Steps To Reproduce

  • Setup nvidia environment
  • use nvidia-modprobe (if necessary)
  • create required cdi file with nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
  • recreate container

Environment

- OS: ArchLinux
- How docker service was installed: podman rootless

CPU architecture

x86-64

Docker creation

/usr/bin/podman run \
	--rm \
	-d \
	--replace \
	--name=plex \
	--stop-timeout 90 \
	--ulimit=nofile=65536:65536 \
	--hooks-dir=/usr/share/containers/oci/hooks.d/ \
	--device=/dev/dri:/dev/dri \
	--device nvidia.com/gpu=all \
	-e PUID=1000 \
	-e PGID=1000 \
	-e VERSION=docker \
	-e "NVIDIA_DRIVER_CAPABILITIES=nvidia.com/gpu=all" \
	-e "NVIDIA_VISIBLE_DEVICES=nvidia.com/gpu=all" \
	--net slirp4netns:port_handler=slirp4netns \
	-p xxx:32400:32400 \
	lscr.io/linuxserver/plex:latest

Container logs

[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────
Linuxserver.io version: 1.40.5.8921-836b34c27-ls234
Build-date: 2024-09-09T09:24:02+00:00
───────────────────────────────────────
    
**** Server already claimed ****
Docker is used for versioning skip update check
[custom-init] No custom files found, skipping...
Starting Plex Media Server. . . (you can ignore the libusb_init error)
Connection to localhost (127.0.0.1) 32400 port [tcp/*] succeeded!
[ls.io-init] done.
Critical: libusb_init failed

Activity

  1. github-actions commented on Sep 11, 2024

    @github-actions

    Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

  2. aptalca commented on Sep 11, 2024

    @aptalca
    Member

    You're well into unsupported territory with that level of customization.

    Docker with nvidia runtime (nvidia-container-toolkit) works just fine, which is the configuration we support. Podman rootless itself is considered a reasonable endeavor so while we don't officially support it, we'll try and help. But podman rootless with custom nvidia bits is not something we can help with.
    https://docs.linuxserver.io/misc/support-policy/#reasonable-endeavours-support

  3. HidingCherry commented on Sep 11, 2024

    @HidingCherry
    Author

    Yes, that's correct.
    podman + rootless is already something I don't expect to get lots of support with.

    But since linux standard programs use /usr/lib libraries and not a custom library, the issue seems to be image or plex specific. The main question is, why does plex not use /usr/lib for libraries - but nvidia-smi does (in the same container).

    edit: You should be able to recreate the same issue with docker rootful.

  4. aptalca commented on Sep 11, 2024

    @aptalca
    Member

    No point in arguing hypothethicals. I'd rather avoid the xy problem.

    edit: You should be able to recreate the same issue with docker rootful.

    Please don't expect us to do the work based on assumptions or a hunch. If you reproduce the issue with rootful docker and official nvidia-container-toolkit, let us know and we'll look into it.

    Last I tested plex with nvidia-container-toolkit, following the instructions we provide in the readme, everything was working just fine and that was only a couple of months ago.

  5. HidingCherry commented on Sep 11, 2024

    @HidingCherry
    Author

    I had no issues a couple of months ago either, I use your image since at least a year.
    I'll see if I can setup rootful docker in the near future.

  6. AngellusMortis commented on Oct 6, 2024

    @AngellusMortis

    I am seeing the same issue in kubernetes. Same thing, use to work a few months ago and now it is broken. nvec is still working in other containers, just not Plex.

    image

  7. LinuxServer-CI commented on Nov 5, 2024

    @LinuxServer-CI
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  8. HidingCherry commented on Nov 9, 2024

    @HidingCherry
    Author

    Temporary workaround which works for me:

    for i in /usr/lib/lib*.so.1;
    do ln -s $i /usr/lib/plexmediaserver/lib/;
    done

    This symlinks all libraries (which are actually all nvidia/cuda ones) to the library folder of plex.
    After a short test, hw-transcoding works again.
    This script has to be run inside the container.

    script for podman:
    podman exec plex bash -c 'for i in /usr/lib/lib*.so.1; do ln -s $i /usr/lib/plexmediaserver/lib/; done'

    Currently I don't have the time to setup rootful docker to recreate the issue there.

  9. LinuxServer-CI commented on Dec 10, 2024

    @LinuxServer-CI
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  10. hanzoh commented on Feb 3, 2025

    @hanzoh

    I have the same issue, when transcoding, Plex picks the CPU because it cannot find libcuda.so.1
    When I go inside the container and search for it, it can be found multiple times, but Plex does not see it:

    > docker exec -it plex /bin/bash
    root@71b8332dbd14:/# find / -name libcuda.so.1
    /run/opengl-driver/lib/libcuda.so.1
    /usr/local/nvidia/lib/libcuda.so.1
    /usr/local/nvidia/lib64/libcuda.so.1
    /nix/store/ivp4mjzw75q21lswzrnn9c8qayx4z9jv-nvidia-x11-565.77-6.6.74/lib/libcuda.so.1
    root@71b8332dbd14:/#
    

    When I do the same on a running Jellyfin container (official image jellyfin/jellyfin), I get the same output, but Jellyfin is able to use the GPU to transcode.

  11. j0nnymoe commented on Feb 3, 2025

    @j0nnymoe
    Member

    @hanzoh probably want to start a fresh thread no?

  12. hanzoh commented on Feb 3, 2025

    @hanzoh

    I can, just thought this is the same issue, because @HidingCherry 's workaround works here as well.
    When I symlink the *.so.1 files from /run/opengl-driver/lib/, Plex is able to do transcoding via GPU.

  13. j0nnymoe commented on Feb 3, 2025

    @j0nnymoe
    Member

    It would only be the same issue if you're attempting to run this in a rootless podman environment.

  14. hanzoh commented on Feb 4, 2025

    @hanzoh

    Makes sense :)
    I found the culprit: nvidia-container-toolkit before 1.17 had an issue with adding libcuda.so to LD_LIBRARY_PATH.
    So once I have updated that, the Plex container works fine without any workarounds.
    Maybe this also helps with Podman?!

  15. LinuxServer-CI commented on Mar 6, 2025

    @LinuxServer-CI
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  16. moved this from Issues to Done in Issue & PR Trackeron May 5, 2025
  17. LinuxServer-CI commented on Jun 4, 2025

    @LinuxServer-CI
    Contributor

    This issue is locked due to inactivity

  18. locked as resolved and limited conversation to collaborators on Jun 4, 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

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions