Proxmox · July 25, 2021 · 3 min read

Install Plex/Jellyfin with HW Acceleration inside LXC on Proxmox

GPU passthrough to a privileged LXC container for hardware transcoding. Intel, AMD, and Nvidia driver setup on the Proxmox host.

LXC containers are a great way to have highly customized, low-overhead containers on your system. Traditionally they fell short in the hardware passthrough department — making hardware-dependent applications unusable, forcing us to use Virtual Machines. Today we’ll use an LXC container in Proxmox to pass through hardware (the built-in GPU on an Intel Processor) for running a media server, with the benefits of host hardware sharing and lower overhead versus full VMs.

Configure Proxmox

Before starting, upgrade your installation:

apt update && apt dist-upgrade

Since LXC containers use the host’s kernel, we need to load all GPU drivers on the Proxmox host itself.

Install GPU Drivers

Intel

If you want to use the Intel GPU in your processor, the drivers are most probably installed and activated already by default. Check with:

ls /dev/dri | grep renderD

If you see any device with the prefix renderD, you’re good to go — skip to the next step.

AMD

apt update && apt install firmware-amd-graphics libgl1-mesa-dri libglx-mesa0 mesa-vulkan-drivers xserver-xorg-video-all

Restart your system to load the new drivers.

Nvidia

First, add the Debian backports repo to /etc/apt/sources.list:

# buster-backports
deb http://deb.debian.org/debian buster-backports main contrib non-free

Then install:

apt update && apt install -t buster-backports nvidia-driver firmware-misc-nonfree

Reboot your system to load the new drivers. Optionally, apply this patch to remove some driver limitations.

Create LXC Container

Follow this guide to set up a container and Docker for your Media Server install.

Note: This method is untested with unprivileged containers. You need to use a Privileged container. If installing Plex, you can skip the Docker install and just create a regular privileged container.

Update your container with the latest packages.

Passthrough Your GPU

First identify the device to passthrough:

ls -l /dev/dri

Usually the CPU’s built-in GPU is the first device (e.g. renderD128) and subsequent ones are PCI (e.g. renderD129 for a GPU in the first PCI slot).

We’ll passthrough the built-in Intel QuickSync GPU which is renderD128 and card0.

Add the following lines to your container config file (/etc/pve/lxc/<VMID>.conf, e.g. /etc/pve/lxc/111.conf):

lxc.cgroup.devices.allow: c 226:* rwm
lxc.mount.entry: /dev/dri/<Your card> dev/dri/card0 none bind,optional,create=file
lxc.mount.entry: /dev/dri/<Your RenderD> dev/dri/renderD128 none bind,optional,create=file

Example:

lxc.cgroup.devices.allow: c 226:* rwm
lxc.mount.entry: /dev/dri/card0 dev/dri/card0 none bind,optional,create=file
lxc.mount.entry: /dev/dri/renderD128 dev/dri/renderD128 none bind,optional,create=file

Reboot the container and confirm devices are available:

ls -l /dev/dri/

Install Plex Media Server

Head over to the Plex Server Download page, download and install the appropriate package for your container OS.

Debian/Ubuntu

apt update && apt install curl gpg2
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
apt install plexmediaserver

Arch Linux

Install plex-media-server from the AUR.

Fedora

Install the Plex Server package from the download page above. Enable the repo by setting enabled=1 in /etc/yum.repos.d/plex.repo:

[PlexRepo]
name=PlexRepo
baseurl=https://downloads.plex.tv/repo/rpm/$basearch/
enabled=1
gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key
gpgcheck=1

Jellyfin

Head over to the Official Jellyfin Install Documentation and install using the Docker method.

Let me know if I missed anything.

← All posts
Category: Proxmox