Our forum migration to Discourse is underway and scheduled to last through June 21. During the migration, the forums will be read-only, except for a single temporary forum (contents of which will not be getting transferred). Read our announcement post for more information about the forum migration.
Hey folks, there is a new Podcast category for forums https://forums.plex.tv/categories/podcasts
If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Plex HW acceleration in LXC container - anyone with success?

Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

I am currently struggling to configure my lxc container for Plex as such that hw acceleration of my xeon e3-1275 v6 is recognized and used. Has anyone succeeded?

My base system is running Proxmox V5.1 with Linux kernel 4.13.13

«1

Comments

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    I do not know proxmox but if proxmox supports udev, and the kernel presents /dev/dri as a member of the video group, the udev rule plex provides should give it. I do not know what happens in the container but suspect /dev/dri is not being made directly available.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    I am passing through the /dev/dri/card0 to the container
    Do I need to have vaapi installed on the host as well?
    Is plex taking care of it inside the container?
    Or do I need to install vaapi inside the container by myself.

    The host operating system is based on Debian stretch
    The Container operating system is ubuntu 17.10

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    If you have proper passthrough, PMS handles the rest. PMS has the libraries included.
    What are the udev permissions? What you're describing is common on NAS processors and docker containers where udev is not working correctly.
    As a test, configure a /etc/rc.local script which sets chmod -R 666 /dev/dri/card* /dev/dri/render*. If this allows it to work, your container doesn't have udev or it's not working correctly. (the PMS installer supplies the rules for udev)

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @ChuckPA, thanks for your assistance. Got it working in LXC container.
    I switched from mounting the dev/... files to
    lxc.cgroup.devices.allow = c 226:0 rwm
    and subsequent
    mknod -m 666 ${LXC_ROOTFS_MOUNT}/dev/dri/card0 c 226 0
    same for the renderD128

    and now it works!
    Great processor use down by more than 50% compared to before!

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    would you mind coming up with a complete step-by-step? I'll take it and post it in Linux Tips and tag it for Proxmox.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    will do tonight - rather simple approach

  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass
    edited January 4

    Moderator edit: This guide has been formalized thanks to @Johnnyh1975 and is now published permanently here:
    https://forums.plex.tv/discussion/301781/pms-installation-guide-when-using-a-proxmox-5-1-lxc-container

    Installation guide for Plex Server under Proxmox 5.1 within an LXC Container

    1. Create an LXC Container (standard approach, well documented in Proxmox)

    Use the standard approach within Proxmox and create a privileged Container (incl. definition of hostname, root password)
    Select the your target operating system template, e.g. ubuntu 16.04, ubuntu 17.04 or ubuntu 17.10. (you have to download it from the Proxmox server)
    Define the memory and cpu allocation for your Plex container: e.g. 8 cores, 20GB RAM,... as well as network parameters

    2. Install on Intel Graphics acceleration drivers on Proxmox Host**

    First install on the Proxmox host the intel graphics acceleration drivers. (e.g. via Shell JS in the Proxmox manager)
    Proxmox host is running Debian stretch.

    apt-get install i965-va-driver

    Test if the driver is working. Install vainfo

    apt-get install vainfo

    Running vainfo should give you an output comparable to

    error: can't connect to X server!
    libva info: VA-API version 0.39.4
    libva info: va_getDriverName() returns 0
    libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_0_39
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 0.39 (libva 1.7.3)
    vainfo: Driver version: Intel i965 driver for Intel(R) Kabylake - 1.7.3
    vainfo: Supported profile and entrypoints
    VAProfileMPEG2Simple : VAEntrypointVLD
    VAProfileMPEG2Simple : VAEntrypointEncSlice
    VAProfileMPEG2Main : VAEntrypointVLD
    VAProfileMPEG2Main : VAEntrypointEncSlice
    VAProfileH264ConstrainedBaseline: VAEntrypointVLD
    VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
    VAProfileH264Main : VAEntrypointVLD
    VAProfileH264Main : VAEntrypointEncSlice
    VAProfileH264High : VAEntrypointVLD
    VAProfileH264High : VAEntrypointEncSlice
    VAProfileH264MultiviewHigh : VAEntrypointVLD
    VAProfileH264MultiviewHigh : VAEntrypointEncSlice
    VAProfileH264StereoHigh : VAEntrypointVLD
    VAProfileH264StereoHigh : VAEntrypointEncSlice
    VAProfileVC1Simple : VAEntrypointVLD
    VAProfileVC1Main : VAEntrypointVLD
    VAProfileVC1Advanced : VAEntrypointVLD
    VAProfileNone : VAEntrypointVideoProc
    VAProfileJPEGBaseline : VAEntrypointVLD
    VAProfileJPEGBaseline : VAEntrypointEncPicture
    VAProfileVP8Version0_3 : VAEntrypointVLD
    VAProfileVP8Version0_3 : VAEntrypointEncSlice
    VAProfileHEVCMain : VAEntrypointVLD
    VAProfileHEVCMain : VAEntrypointEncSlice
    VAProfileHEVCMain10 : VAEntrypointVLD
    VAProfileHEVCMain10 : VAEntrypointEncSlice
    VAProfileVP9Profile0 : VAEntrypointVLD
    VAProfileVP9Profile0 : VAEntrypointEncSlice
    VAProfileVP9Profile2 : VAEntrypointVLD

    Well done your host is supporting the appropriate acceleration.

    3. GPU passthrough configuration to Plex Container

    Find out the right parameter of your graphics card

    ls -l /dev/dri

    this should give you a comparable output to the following

    crw-rw---- 1 root video 226, 0 Dec 29 14:06 card0
    crw-rw---- 1 root video 226, 128 Dec 29 14:06 renderD128

    Note down the numbers behind video
    card0 has the id 226, 0
    renderD128 has the id 226,128

    Additionally take the fb0 devices as well
    ls -l /dev/fb0

    This gives the following output

    crw-rw---- 1 root video 29, 0 Dec 29 14:06 /dev/fb0

    so fb0 has the id 29,0

    Next define the gnu passthrough by adding the following lines at the end of your 100.conf file (use the appropriate number 100, 101,... that you assigned before to the Plex container). Please adjust the following lines with the id numbers for your graphics system you have noted down just before. In the last line replace the 100 with the Plex container id of your system.

    nano /etc/pve/lxc/100.conf

    lxc.cgroup.devices.allow = c 226:0 rvm
    lxc.cgroup.devices.allow = c 226:128 rvm
    lxc.cgroup.devices.allow = c 29:0 rvm
    lxc.autodev: 1
    lxc.autodev.hook: /var/lib/lxc/100/mount_hook.sh
    

    The last line calls at boot of the container a shell script that you need to create to mount the devices appropriately..
    Let's create it:

    nano /var/lib/lxc/100/mount_hook.sh

    Add the following lines and adjust the id's to your graphics system:

    mkdir -p ${LXC_ROOTFS_MOUNT}/dev/dri
    mknod -m 666 ${LXC_ROOTFS_MOUNT}/dev/dri/card0 c 226 0
    mknod -m 666 ${LXC_ROOTFS_MOUNT}/dev/dri/renderD128 c 226 128
    mknod -m 666 ${LXC_ROOTFS_MOUNT}/dev/fb0 c 29 0
    

    Save the file and make it executable.
    chmod 755 /var/lib/lxc/100/mount_hook.sh

    Your Plex LXC container is ready to boot up incl. GPU passthrough. Well done!

    1. Boot-up your container and install Plex media server
      Via Console JS of your container execute the following steps

    Login with root and the assigned password in step 1
    Make sure your system is up-to-date

    apt-get update && sudo apt-get upgrade

    Head to the Plex Downloads page. Download the current ubuntu package and make it available inside the container.
    Alternatively copy the download link from the web page. Use wget to download the installer via the copied link:

    wget https://downloads.plex.tv/...amd64.deb
    Make sure to exchange in this command the url by the copied one from the web page.

    This example uses the current link for Ubuntu, at the time of writing. Be sure to use the up-to-date version supplied on the Plex website.

    Use dpkg to install the Plex server:
    dpkg -i plexmediaserver*.deb

    Enable Plex Media Server to start on reboot, and then start the server:

    systemctl enable plexmediaserver.service
    systemctl start plexmediaserver.service
    

    The rest is than standard Plex configuration and media file management which is well documented. So I will not repeat it.

    Last step to make sure your Plex server is using hardware acceleration. Within the Plex web interface, go on "settings>server>transcoder". Make sure that advanced options are shown. And checkmark "use hardware acceleration when available"

    And now enjoy a fast transcoding experience within an LXC container. On my system the CPU usage was reduced by 50% compared to before :-)

  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @ChuckPA - Step-by-step Guide is posted

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    Thank you.

    I will transfer to Linux Tips, credit you, direct any errata to you?

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    @Johnnyh1975

    I have a few questions:

    1. PMS download direct link is not advisable. 1.5.5 did not support HW transcode. Will this work with any version supporting HW transcoding?
    2. Do you know the link (or starting point) for Intel drivers (your step #2)

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass
    edited December 2017

    @ChuckPA
    yes it will work - exchange it with the newest link and it's fine.
    (I was a bit lazy so I copied the link from another guide I used in the past)
    the intel drivers are part of the normal Debian repository so apt-get will find it. It's a standard package

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    Would you mind making those minor updates? I don't want to make any mistakes.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @ChuckPA
    updated the download link to the latest public Plex download

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    Looking good... Except:

    You're still using a direct-download link (wget) in the container.

    Would you rework that such that:

    1. Download current via the web page
    2. Make the downloaded file available in the container.

    If this isn't possible, use the approach of right-click / copy URL for the desired version.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @ChuckPA
    your suggestion is incorporated

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @ChuckPA

    Found some typos, but can‘t edit the post directly
    3rd line in 1st Paragraph: erase ‚the‘
    2nd titel: erase first ‚on‘ and erase ‚**‘ at the end
    3rd Paragraph, 5th bullet: ‚gnu‘ should be ‚gpu‘

    Rest Looks good

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 22,850 Plex Team Member
    edited January 4

    There you go. Edits applied.

    Barring any last second gaffs on my part which you may find, It's Open for business

    Thank you for all your help and patience.

    :+1:

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    Hosts: Fedora, QNAP, Synology, most Linux distros in VM

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • 4Me4Me Members, Plex Pass Posts: 12 Plex Pass

    Hey,
    thank you for the great tutorial.

    I have some small corrections:

    xc.cgroup.devices.allow = c 226:0 rvm rwm
    lxc.cgroup.devices.allow = c 226:128 rvm rwm
    lxc.cgroup.devices.allow = c 29:0 rvm rwm
    lxc.autodev: 1
    lxc.autodev.hook: lxc.hook.autodev:/var/lib/lxc/100/mount_hook.sh

  • Johnnyh1975Johnnyh1975 Members, Plex Pass, TunerTester Posts: 33 Plex Pass

    @4Me
    @ChuckPA

    in the Post 12 - the corrections are valid. Sorry for the typos...

«1
Sign In or Register to comment.