Skip to content

Conversation

@ltsch
Copy link
Contributor

@ltsch ltsch commented Jan 6, 2026

Tdarr: NVIDIA GPU Support

Summary

Adds NVIDIA GPU hardware acceleration support to Tdarr LXC containers.

Important

This PR prioritizes the native var_gpu and setup_hwaccel for Intel/AMD iGPU support. This PR adds NVIDIA support for /dev/nvidia* devices in addition to the standard /dev/dri interface.

Note

This PR modifies two files: ct/tdarr.sh and install/tdarr-install.sh.

NVIDIA Requirements

GPU Type Device Interface Handled By
Intel/AMD iGPU /dev/dri (render nodes) Native var_gpu + setup_hwaccel
NVIDIA /dev/nvidia* (proprietary) This PR (explicit passthrough + version-matched drivers)

NVIDIA GPU passthrough to LXC containers requires:

  1. Explicit device passthrough/dev/nvidia* devices are not part of /dev/dri
  2. Exact version matching — Container userspace libraries must match host kernel driver

Without this, applications attempting to use the GPU (e.g., handbrake, ffmpeg) will fail with a Driver/library version mismatch error when attempting to initialize the NVML or CUDA interface.

Core Libraries & Transcoding

The following libraries are matched to the host version to enable hardware acceleration:

Library Role Enables
libcuda1 CUDA Base Communication with GPU hardware
libnvcuvid1 NVDEC Hardware Decoding in FFmpeg/Handbrake
libnvidia-encode1 NVENC Hardware Encoding in FFmpeg/Handbrake
libnvidia-ml1 NVML Device monitoring and temperature/load reporting

Service Management

The PR implements robust systemd service management to ensure reliability and ease of use:

  • tdarr-server.service: Manages the main Tdarr Server. Includes ExecStartPre to automatically run the Tdarr_Updater before every start.
  • tdarr-node.service: Manages the Tdarr Node. Configured with Requires=tdarr-server.service to ensure the correct startup sequence.
  • Auto-Enable: Both services are enabled to start automatically on container boot, replacing the manual or cron-based startup requirement.
  • Configure a server or node: tdarr-node or tdarr-server services can be enabled or disabled per container.

Changes

ct/tdarr.sh (Host-Side)

Change Purpose
NVIDIA detection Identifies driver version to offer optional pinning
Driver pinning Optional apt-mark hold on host to prevent breaking updates
Help/Abort flow Prevents "half-broken" installs if drivers are missing on host
Uses community packages Delegates passthrough logic to build.func natives

install/tdarr-install.sh (Container-Side)

Change Purpose
Autonomous detection Reads /proc/driver/nvidia/version (shared with host)
Version matching Installs libcuda1 etc. pinned to host version
Verification tools Installs nvidia-smi for status monitoring
Systemd Services Configures robust tdarr-server and tdarr-node services
Intel VA-API Optional intel-media-va-driver-non-free for multi-GPU support

Architecture

┌─ ct/tdarr.sh (Proxmox Host) ─────────────────────────────┐
│  1. Detect NVIDIA driver / Pin host drivers (Optional)   │
│  2. Delegate passthrough to build.func (var_gpu="yes")   │
└────────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─ install/tdarr-install.sh (Inside Container) ────────────┐
│  1. Detect driver version directly via /proc             │
│  2. Pin NVIDIA CUDA repo + Install matched packages      │
│  3. Install nvidia-smi for user verification             │
└────────────────────────────────────────────────────────────┘

Testing

  • Verified on Tdarr built on Debian 13 (Trixie) with NVIDIA host driver 590.48
  • Verified on Proxmox 8.4.16/368e3c45c15b895c (running kernel: 6.8.12-17-pve)
  • Confirmed apt correctly prioritizes pinned NVIDIA repo
  • Confirmed services start cleanly

Files Changed

  • ct/tdarr.sh — NVIDIA detection and device passthrough
  • install/tdarr-install.sh — Userspace package installation

@ltsch ltsch requested a review from a team as a code owner January 6, 2026 02:23
@github-actions github-actions bot added github update script A change that updates a script labels Jan 6, 2026
@ltsch ltsch force-pushed the feat/tdarr-nvidia-support-v2 branch from 225e5e2 to 29d823e Compare January 6, 2026 02:30
@ltsch ltsch force-pushed the feat/tdarr-nvidia-support-v2 branch from 29d823e to a2d2051 Compare January 6, 2026 02:30
@MickLesk
Copy link
Member

MickLesk commented Jan 6, 2026

To be honest, I don't understand the point of the PR. What exactly needs to be fixed ONLY in tdarr?

We have a function in build.func that fits the GPU and installs the necessary drivers (if possible) in tools.func.

@ltsch
Copy link
Contributor Author

ltsch commented Jan 6, 2026

I didn't want to mess with the core build.func used by many projects. Instead I focused on addressing this issue for Tdarr due to my own frustration with the community script not working correctly (container driver version did not align to host driver). If the efforts should be focused on build.func to improve Nvidia driver handling then we can close this PR.

MickLesk added a commit that referenced this pull request Jan 6, 2026
## Major Changes:
- Multi-GPU detection and user selection (60s timeout, auto-select)
- Intel Arc/DG1/DG2 dedicated driver installation
- Intel Gen 9+ (UHD/Iris/HD 5xx-6xx) with compute-runtime from GitHub
- Intel Legacy (Gen 6-8, HD 2xxx-5xxx) with stable repo drivers
- AMD discrete GPU support with Mesa + firmware
- AMD APU integrated graphics support
- NVIDIA version-matched driver installation from CUDA repository

## Distro Support:
- Debian 11 (Bullseye), 12 (Bookworm), 13 (Trixie/Sid)
- Ubuntu 22.04, 24.04

## New Features:
- GPU selection dialog for multi-GPU systems
- Host NVIDIA driver version detection from /proc/driver/nvidia/version
- APT pinning (Priority 1001) for NVIDIA version matching
- Device permissions for /dev/dri, /dev/nvidia*, /dev/kfd
- Modular helper functions for maintainability

## Helper Functions:
- _setup_intel_arc()
- _setup_intel_modern()
- _setup_intel_legacy()
- _setup_amd_gpu()
- _setup_amd_apu()
- _setup_nvidia_gpu()
- _add_debian_nonfree()
- _add_debian_nonfree_firmware()
- _setup_gpu_permissions()

Closes: Implements NVIDIA support properly (alternative to PR #10579)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github update script A change that updates a script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants