[How To] Install plexconnect for aTV

JC_Remover

Cadet
Joined
May 15, 2015
Messages
3
I used the method in the guide: git clone https://github.com/iBaa/PlexConnect.git

It worked fine and downloaded the file, which is what has me stumped.

Full disclosure, I am pretty new to FreeNas but I'm familiar and comfortable working through ssh or coding methods.

I've wiped the jail with the intention of starting the guide again tomorrow night if I get the chance but I have a few more questions.

When I create the jail via the GUI it doesn't say Pluginjail it just says Standard, from my googling it seem this is an intended feature in 9.3?

I get a strange error message both times I installed Bash by the guide
bash requires fdescfs(5) mounted on /dev/fd If you have not done it yet, please do the following: mount -t fdescfs fdesc /dev/fd ...

Any idea what this means? I ignored it the first time through and I think it might be the cause of my issue.

Furthermore when I installed it the first time around I didn't get a plugin pop up as installed in the GUI but I'm not sure if that's expected behaviour or not.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
The guide is based on a previous version of FreeNAS (pre 9.3) so the right choice now is the standard jail.

You'll need to make sure bash is installed correctly before trying to run PlexConnect.

Installing the required packages (python, bash, nano, git, pillow) should be straight forward, with not much more effort to configure the certificates and plexconnect service.

Not that it helps, but I've set this up a few times following the guide so I'd have another go in a fresh jail.
 

JC_Remover

Cadet
Joined
May 15, 2015
Messages
3
Thanks for the help, I'm giving it another go hopefully tonight.

Re the Bash thing, I was reading that I should also set up a start-up command to do the bash mount? I'm a bit confused by the problem but I'll see how I go tonight.
 

John Dvoracek

Dabbler
Joined
May 23, 2015
Messages
10
I followed the guide three times, and each time I still get:

root@plexconnect:/PlexConnect # ./PlexConnect.py
env: python: No such file or directory

I edited the .bash script file, and I added the path to PATH:

root@plexconnect:/ # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bi
n

I also noticed the messages after installing bash:

Message for bash-4.3.33:
======================================================================

bash requires fdescfs(5) mounted on /dev/fd

If you have not done it yet, please do the following:

mount -t fdescfs fdesc /dev/fd

To make it permanent, you need the following lines in /etc/fstab:

fdesc /dev/fd fdescfs rw 0 0

======================================================================

But when I try to do this, I get an error:

root@plexconnect:/ # mount -t fdescfs fdesc /dev/fd
mount: fdesc: Operation not permitted

Could this be my problem? Any ideas for a solution if so. Thanks in advance!
 

John Dvoracek

Dabbler
Joined
May 23, 2015
Messages
10
I installed bash this way, and even though I still received that message I described previously, plexconnect worked:

# portsnap fetch
# cd /usr/ports/shells/bash
# make install clean

I don't understand, but plexconnect now WORKS!

There is an issue playing lossless ALAC iTunes files though. This was described on earlier versions of PMS but supposedly fixed. Those files only play the first 10 or so seconds, then another track starts to play. Yet they play fine on my Denon via DLNA or on the web player. But video works, and that is a huge plus.

Thanks to all the posters on the topic.

PMS Version 0.9.12.0
 

traxinv

Dabbler
Joined
Feb 8, 2014
Messages
21
Hi guys, sorry i have been running around a bit the last while. I will try setup a jail from scratch on a new box today/tomorrow and then update the post.
 

naq90

Dabbler
Joined
Jun 7, 2015
Messages
24
@traxinv Thanks for your write up! I'm having the same issue as a few of the other users. Is the guide on the first page updated?
 

Prasanth

Contributor
Joined
Mar 2, 2014
Messages
100
I was able to successfully install and run plex connect using most of the method described in the first post.
I did not use the "pkg_add -r pkg" command given the warning in the freenas manual. After that the rest of the commands worked fine and I was able to run plex connect. The only issue I had was that it wasn't seeing my local plex server even after entering the correct ip_pms ip address.
I went back and changed the "enable_plexgdm" to true in settings.cfg and at least it was seeing my server now.

I can see the server now but it won't give me a list of movies and shows on the server.

Anyone else run into this and able to solve it?
 

wraith

Contributor
Joined
Dec 21, 2015
Messages
102
I'm trying to get PlexConnect up and running on my FreeNAS. I've successfully made it as far as page 5 of the pdf:

Check that the script works:
/etc/rc.d/plexconnect start
Output => 'PlexConnect is running'

However, when I go to the next step:
/etc/rc.d/plexconnect status
I get the following error
/etc/rc.d/plexconnect: unknown directive 'status'.
Usage: /etc/rc.d/plexconnect [fast|force|one|quiet] (start|stop|restart|rcvar)


Odd as the plexconnect status command worked as expected earlier in the procedure.
Any ideas?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
If you've got the "PlexConnect is running" message I wouldn't worry about the status check, and carry on with the rest of page 5 and any others.

Once you've done everything, "service PlexConnect status" should give you the same "PlexConnect is running" message.

I'd also think about buying an aTV4 :D
 

wraith

Contributor
Joined
Dec 21, 2015
Messages
102
Running "servce plexconnect status" outputs the same error. Any other ideas? I've checked everything else and confident I've followed the procedure. running "bash /PlexConnect/PlexConnect_daemon.bash status" works and informs me the service is running.

Initially, when creating the jail, I didn't have the option of selecting 'pluginjail' as the type. Could this be affecting my ability to proceed any further? If so, how do I go about setting up a 'pluginjail' type?

Not sure what version of aTV I have!
 
Last edited:

wraith

Contributor
Joined
Dec 21, 2015
Messages
102
*bump*
Hey all, any ideas on how to remedy the "service PlexConnect status" command not, apparently, working?
 

ianfs

Cadet
Joined
Apr 13, 2016
Messages
3
This guide worked flawlessly on my 9.10 install. The only question I have is about seeing the local server. Like others on here I can't connect locally and only via the logged in setting. Is this how it's supposed to go or is there another way to set this up so I can stream locally?
 

BillCardiff

Explorer
Joined
May 13, 2014
Messages
59
Great guide. Works perfectly after adding local exceptions to my Plex server. Thanks for the walk through.
Only change I made was running git clone in /usr/local/ then editing the plexconnect loader to point to the new locations for the daemon calls.
 

EsTaF

Contributor
Joined
Sep 20, 2013
Messages
163
Code:
bash /PlexConnect/PlexConnect_daemon.bash start

Starting PlexConnect...
bash /PlexConnect/PlexConnect_daemon.bash status

PlexConnect is running


Rechecking script. There are ok all.

After it I watch, that the profile item had left/beginning to somewhere (apple tv 2). There's that item Before all manipulations. Don't understand nothing.

Before it I use Ubuntu with ubuntu community plexconnect guide. all're ok. I was watching a profile item on apple tv etc.

Had found. https://github.com/iBaa/PlexConnect/wiki/Install-Guide-Certificate-via-Ethernet
I noticed, that a lot of manual-mans are forgetting that moment. About apple tv side configuration.
 
Last edited:

Srikanth K Kota

Dabbler
Joined
Jul 20, 2017
Messages
28
How to Install PlexConnect (with automatic boot)

Login to your FreeNAS server using the normal IP. Then go to the jails section in the navigation bar and then add jails. Select the following options:

lQ599tA.png


You can give it any IP you prefer. Also make sure you select the following:

22CbVDj.png


Then Click ok!

Next go ahead and open putty (or something similar) and connect directly to your FreeNAS’s IP. Username: root Password: [your password]

First we need to find the jail we just created. Run the following command:
Code:
jls

This will return a list of all your current jails:

A0ozUHh.png

Now you want to directly connect to the jail itself using the JID. From the list you look for the hostname PlexConnect (I will be using PlexConnect_test as I don’t want to change my current setup, you should use PlexConnect jail.)

To get into the jail run the following command
Code:
jexec <JID> csh

Where <JID> is the JID of the PlexConnect jail.


Install the required software:

First we are going to have to install all the extra packages PlexConnect requires to work.

1.Pkg manager.
First let’s do some future proofing. Now pkg_add can be used instead of this method. But everyone seems to have a massive problem with it so lets us pkgng, BUT since it is not as standard part of a pluginjail (or is depending on the version of freenas you are running) we need to install it.

Run:
Code:
pkg_add -r pkg

(Note if this is not working skip to the next package)

So then run the command:
Code:
pkg2ng

This will take several minutes just be patient. Now for good measure you can just run:
Code:
pkg update


If it want you to update the pkg manager just say yes.

2.Python

Code:
pkg install python

3.Nano – Text editing
Code:
pkg install nano

4.Bash
Code:
pkg install bash


5.Git
Code:
pkg install git


6.Pillow
Code:
pkg install py27-pillow


Part 1: Get PlexConnect and Configure it

Get PlexConnect

Now we have to fetch the newest PlexConnect from the git repo.
Code:
git clone https://github.com/iBaa/PlexConnect.git
cd PlexConnect/
git pull


Generate the required SSL certificates

Next we need to create the communication certificates. Change directory to the certificates folder
Code:
cd /PlexConnect/assets/certificates


Generate the required SSL certificates
Code:
openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"


This will create 2 files trailers.key and trailers.pem. Next run this:
Code:
openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem 


Create the Settings.cfg file

Go back to the root directory:
Code:
cd / 


Change Directory
Code:
cd PlexConnect/


Start PlexConnect so it creates Settings.cfg
Code:
./PlexConnect.py


When it started Exit using CTRL + C
Code:
nano Settings.cfg


Change the 2 lines below
Code:
ip_pms = 10.0.0.30 # This one you have to change to your Jail IP address
enable_plexgdm = False # This one you have to change from True to False


Test that the basics work:


To start PlexConnect
Code:
bash /PlexConnect/PlexConnect_daemon.bash start


Make sure it starts up:
Code:
bash /PlexConnect/PlexConnect_daemon.bash status


It should return that it is running. Then you can stop the process:
Code:
bash /PlexConnect/PlexConnect_daemon.bash stop


Part 2: Creating Boot Script

Initial Setup:

Creat the boot script

Code:
nano /etc/rc.d/plexconnect


copy and paste the following code and then save and close the file.

Code:
#!/bin/sh
#
#PROVIDE: PlexConnect
#REQUIRE: DAEMON
#KEYWORD: shutdown

. /etc/rc.subr

name=plexconnect
rcvar=plexconnect_enable

start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"
extra_commands="status"
PATH=/usr/local/bin:${PATH}

plexconnect_start()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash start
}
plexconnect_stop()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash stop
}

plexconnect_status()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash status
}

load_rc_config $name
run_rc_command "$1"


NOTE: if you installed PlexConnect in a different directory change the directory to the bash script.

Next make sure the permissions are the same as the other scripts, run the following script:
Code:
chmod 0555 /etc/rc.d/plexconnect


Register the script:

Run the following command to open the rc.conf file:
Code:
nano /etc/rc.conf

and add the following line:
Code:
plexconnect_enable="Yes"

save and close the file.

Check that the script works:

so when you are in the root dir and you call:
Code:
/etc/rc.d/plexconnect start

and then calling:
Code:
/etc/rc.d/plexconnect status

and it returns:
Code:
PlexConnect is running

so great the script works.
Now just run:

Code:
/etc/rc.d/plexconnect stop

So we make sure plex is not running before we try to start it as a service.

Setup the plexconnect service:

FINALLY:

run the following command:
Code:
service plexconnect status


and it should return:
Code:
PlexConnect is not running


Okay great the service is now working. Thank god. Now just startup plexconnect:
Code:
service plexconnect start


So plexconnect is now running and it is a valid service. Yay.

You can then test if it is working by either rebooting your NAS or toggling the plugins on off switch.

FINAL NOTE:

Update: 2015-05-04 - Changed Boot script to now include the path parameter. Hence you no longer need to edit the bash script. (Thanks @mbaltaks)

Updated: 2015-05-04 - Added the native package manger install procedure for pillow. (also @mbaltaks)


--++00DONE00++--
Without a single mistake, I could setup PlexConnect on 11.1-U1 for Apple TV 3. Thanks a lot for the post.
 

rknaub

Explorer
Joined
Jan 31, 2017
Messages
75
Incredibly, I was able to get this working in 11.2-U5. Only had to make minor changes here or there. Thank you so much, now I can retire the old windows machine that was serving this purpose.
 

rknaub

Explorer
Joined
Jan 31, 2017
Messages
75
I had to start over and re-install plexconnect as a jail, and ran into some issues. Once I figured it out again, I made some changes to the original process and documented it so if I ever had to do it again I could do it quickly. Thanks again for the guide. My changes below:

Install PlexConnect (with automatic boot) FreeNAS 11.2

You should be able to copy/paste any commands below the line:
Code:

Login to your FreeNAS server using the normal IP. Then go to the jails section in the navigation bar and then click add.

Name the jail plexconnect
For the release drop-down, select the release you are running (i.e.11.2)
Click Next
Select DHCP
Click Next

Now start the jail.

Next go ahead and open putty (or something similar) and connect directly to your FreeNAS’s IP. Username: root Password: [your password]

First we need to find the jail we just created. Run the following command:
Code:

jls

This will return a list of all your current jails:




Now you want to directly connect to the jail itself using the JID. From the list you look for the hostname PlexConnect (I will be using PlexConnect_test as I don’t want to change my current setup, you should use PlexConnect jail.)

To get into the jail run the following command
Code:

jexec <JID> csh

Where <JID> is the JID of the PlexConnect jail. (Use the number, not the name – i.e. 1 or 4)

Install the required software:

First we are going to have to install all the extra packages PlexConnect requires to work.

1.Pkg manager.

Code:

pkg update
Enter Y for yes.

2.Python

Code:

pkg install python27

3.Nano – Text editing
Code:

pkg install nano

4.Bash
Code:

pkg install bash


5.Git
Code:

pkg install git


6.Pillow
Code:

pkg install py27-pillow


Part 1: Get PlexConnect and Configure it

Get PlexConnect
Now we have to fetch the newest PlexConnect from the git repo.
Code:

git clone https://github.com/iBaa/PlexConnect.git

cd PlexConnect/

git pull


Generate the required SSL certificates

Next we need to create the communication certificates. Change directory to the certificates folder

Code:

cd /PlexConnect/assets/certificates


Generate the required SSL certificates
Code:

openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"


This will create 2 files trailers.key and trailers.pem. Next run this:

Code:

openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem


Create the Settings.cfg file
Go back to the root directory:

Code:

cd /


Change Directory
Code:

cd PlexConnect/

**The following I had to do to get it to work in 11.2 with python2.7**
Code:

nano /PlexConnect/PlexConnect_daemon.bash

Edit the PYTHON line as follows (so that it references the python instance explicitly):

PYTHON=”/usr/local/bin/python2.7”


Start PlexConnect so it creates Settings.cfg
Code:

./PlexConnect.py


When it started Exit using CTRL + C
Code:

nano Settings.cfg


Change the 2 lines below
Code:

ip_pms = 10.0.0.30 # This one you have to change to your Jail IP address
enable_plexgdm = False # This one you have to change from True to False


Test that the basics work:

To start PlexConnect

Code:

bash /PlexConnect/PlexConnect_daemon.bash start


Make sure it starts up:
Code:

bash /PlexConnect/PlexConnect_daemon.bash status


It should return that it is running. Then you can stop the process:
Code:

bash /PlexConnect/PlexConnect_daemon.bash stop


Part 2: Creating Boot Script

Initial Setup:

Creat the boot script


Code:

nano /etc/rc.d/plexconnect


copy and paste the following code and then save and close the file.

Code:

#!/bin/sh
#
#PROVIDE: PlexConnect
#REQUIRE: DAEMON
#KEYWORD: shutdown

. /etc/rc.subr

name=plexconnect
rcvar=plexconnect_enable

start_cmd="${name}_start"
stop_cmd="${name}_stop"
status_cmd="${name}_status"
extra_commands="status"
PATH=/usr/local/bin:${PATH}

plexconnect_start()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash start
}
plexconnect_stop()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash stop
}

plexconnect_status()
{
/usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash status
}

load_rc_config $name
run_rc_command "$1"


NOTE: if you installed PlexConnect in a different directory change the directory to the bash script.

Next make sure the permissions are the same as the other scripts, run the following script:

Code:

chmod 777 /etc/rc.d/plexconnect


Register the script:
Run the following command to open the rc.conf file:

Code:

nano /etc/rc.conf

and add the following line:

Code:

plexconnect_enable="Yes"

save and close the file.

Check that the script works:
so when you are in the root dir and you call:

Code:

/etc/rc.d/plexconnect start

and then calling:

Code:

/etc/rc.d/plexconnect status

and it returns:

Code:

PlexConnect is running

so great the script works.
Now just run:

Code:

/etc/rc.d/plexconnect stop

So we make sure plex is not running before we try to start it as a service.

Setup the plexconnect service:

FINALLY:

run the following command:

Code:

service plexconnect status


and it should return:

Code:

PlexConnect is not running


Okay great the service is now working. Thank god. Now just startup plexconnect:

Code:

service plexconnect start


So plexconnect is now running and it is a valid service. Yay.

You can then test if it is working by either rebooting your NAS or toggling the plugins on off switch.

Now set a DHCP address reservation in your router, for plex connect. Then go to your ATV, and configure there, remember to set the DNS server to the address that was assigned to plexconnect jail.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I ran this for a number of years, but I'm struggling to see why anyone would bother now given how old even the aTV4 is now!
 
Top