Running Plex Media Server (PMS) on the TK1

If someone is interested to run the plex media server on the TK1, here is a short summary how i did it. All credits go to the installation guide from the cubox box: https://bitbucket.org/inkubux/cubox-i/wiki/Plex%20Wheezy
To run the PMS armel code, a chroot with an armel distribution is needed.

First download the Drobo Plex Media Server package (plex.tgz) from plex.tv.

Install debootstrap and schroot

sudo apt-get install debootstrap
sudo apt-get install schroot

Then create a directory and install debian armel wheezy in it

sudo mkdir -p /var/chroot/wheezy-armel
sudo debootstrap --no-check-gpg --arch=armel wheezy /var/chroot/wheezy-armel ftp://ftp.debian.org/debian/

Now setup the schroot conf files

cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.old
sudo gedit /etc/schroot/schroot.conf

Add the folowing text to schroot.conf

[wheezy-armel]
description=Contains plex media server
type=directory
directory=/var/chroot/wheezy-armel
aliases=plex
users=ubuntu
root-groups=root
root-users=root

First time to enter the chroot environment. Change the chroot prompt.

(host) sudo chroot /var/chroot/wheezy-armel
(chroot) echo wheezyArmel > /etc/debian_chroot
(chroot) exit

(host): in normal root directory
(chroot): in armel whezzy chroot environment

Correct locales in chroot environment

(host) sudo chroot /var/chroot/wheezy-armel
(chroot) apt-get install locales
(chroot) locale-gen en_US en_US.UTF-8
(chroot) dpkg-reconfigure locales
--> select en_US.UTF-8

Install more needed packages in chroot

(chroot) apt-get install libexpat1

PMS >= 0.9.10.1.585 (actually plex pass users only) needs libpng16-16, so
experimental repo must be added as source:

Install PMS in chroot

(chroot) cd /tmp
(chroot) mkdir plex
(chroot) cd plex

Copy the PMS installation archive plex.tgz to the temp folder in chroot (use e.g. another terminal)

(host)sudo cp <<download path>>/plex.tgz /var/chroot/wheezy-armel/tmp/plex

Unzip PMS archiv and move files to destination

(chroot) tar -zxvf plex.tgz 
(chroot) mkdir -p /opt/plex/
(chroot) mv Application/ /opt/plex
(chroot) mkdir -p "/opt/plex/Library/Application Support"
(chroot) chmod -R a+w /opt/plex/Library/

Create PMS startscript in chroot.

(chroot) nano /usr/local/bin/plexmediaserver

Add folowing lines to plexmediaserver:

#!/bin/sh
SCRIPTPATH=/opt/plex/Application
export LD_LIBRARY_PATH="{SCRIPTPATH}" export PLEX_MEDIA_SERVER_HOME="{SCRIPTPATH}"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export LC_ALL=“en_US.UTF-8”
export LANG=“en_US.UTF-8”
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/opt/plex/Library/Application Support"
ulimit -s 3000
cd $PLEX_MEDIA_SERVER_HOME
/opt/plex/Application/Plex\ Media\ Server

Make the script executable

(chroot) chmod +x /usr/local/bin/plexmediaserver

Start PMS in chroot

(chroot) plexmediaserver

Test connection from browser

(host) http://localhost:32400/web/index.html

Leave chroot and run PMS as user ubuntu

(chroot) exit
(host) schroot -d /opt/plex -c plex /usr/local/bin/plexmediaserver

Test connection from browser

(host) http://localhost:32400/web/index.html

Enjoy PMS!

Hi,

I’ve tried to follow your instructions and I’m stuck on the command

sudo debootstrap --no-check-gpg --arch=armel wheezy /var/chroot/wheezy-armel ubuntu ftp://ftp.debian.org/debian/

I’m getting the output

E: No Such Script: ftp://ftp.debian.org/debian

Is this normal, can I carry on with the instructions?

Thank you in advance!

Thanks for your feedback. Sorry, the command was wrong. I corrected the command in the original post.
What version of PMS do you use? For new PMS versions >= 0.9.10.1.585 (actually only accessible for plex pass users) libpng16-16 is needed. I also added the commands to the original post.

Thank you for the guide, it works perfectly in (chroot).

But unfortunately (host) schroot -p -c plex /usr/local/bin/plexmediaserver fails to start with the following message:

Error: Unable to set up server: sqlite3_statement_backend::prepare: unable to open database file for SQL: PRAGMA cache_size=4000

What do I need? Thank you in advance!

The plex library directory in the chroot must be writable for the user ubuntu.

Please change to the chroot enviroment and do

(chroot) chmod -R a+w /opt/plex/Library/

I also changed the startup script of the schroot:

(host) schroot -d /opt/plex -c plex /usr/local/bin/plexmediaserver

I hope this works for you.

I followed the guide to the “T”, yet some how I am having an usual error when I run

(chroot) plexmediaserver

The error I get I haven’t seen before in linux, so I do not know how to fix it. Here is the error.

(wheezy-armel)root@tegra-ubuntu:/# plexmediaserver
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Aborted

I am running it in chroot. Thanks for any help.

FYI, the “C” locale is the basic english ASCII character set (or UTF-8 handles this if not using straight ASCII). It looks a lot like it is trying to find a message in the most basic character set and could not.

If running an strace, many many normal C locale programs can be seen to be searching for any locale conversions…if they don’t find a different locale message they print the default ASCII message. I’ve never run strace on a locale-sensitive program before when the host is not ordinary en_US (C locale). By any chance is any machine in the process of building/installing/running this a non-en_US language locale?

This machine is running en_US language. I don not use anything other than en_US, so I do not believe it was doing anything else. I was running Sabnzbdplus, Couchpotato, and Sickbeard in the background. Is it possible that one of those or some other running software could cause this?
Thanks

A different process would not be able to cause plexmediaserver to fail this way. There is a possibility though that the chroot environment was missing something for C locale and that plexmediaserver does not have any fall back when failing to find C locale. It is looking more like the environment is incomplete.

how do I get my media to plex I got my media on /home/ubuntu/USB/plex/

how are it work for you otheras I can se it cant transcode any video do the transcoding work for any of you ?

Hi, Can I use this steps to install plex on Jetson Nano?