Errno 98, PlexConnect and most likely Apache2

Hey,

 

i get the following error message when i try to start the PlexConnect.py:

12:13:38 PlexConnect: ***
12:13:38 PlexConnect: PlexConnect
12:13:38 PlexConnect: Press CTRL-C to shut down.
12:13:38 PlexConnect: ***
12:13:38 PlexConnect: started: 12:13:38
12:13:38 PlexConnect: Version: 0.5-dev
12:13:38 PlexConnect: Python: 2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3]
12:13:38 PlexConnect: Host OS: linux2
12:13:38 PlexConnect: PILBackgrounds: Is PIL installed? False
12:13:38 PlexConnect: IP_self: 192.168.0.17
12:13:39 DNSServer: started: 12:13:39
12:13:39 DNSServer: ***
12:13:39 DNSServer: DNSServer: Serving DNS on 192.168.0.17 port 53.
12:13:39 DNSServer: intercept: ['trailers.apple.com'] => 192.168.0.17
12:13:39 DNSServer: restrain: ['mesu.apple.com', 'appldnld.apple.com', 'appldnld.apple.com.edgesuite.net'] => 127.0.0.1
12:13:39 DNSServer: forward other to higher level DNS: 8.8.8.8
12:13:39 DNSServer: ***
12:13:39 WebServer: started: 12:13:39
12:13:39 WebServer: Failed to connect to HTTP on 192.168.0.17 port 80: [Errno 98] Address already in use
12:13:39 PlexConnect: WebServer not alive. Shutting down.
12:13:39 PlexConnect: Shutting down.
12:13:40 DNSServer: DNS request received!
12:13:40 DNSServer: Source: ('192.168.0.11', 58439)
12:13:40 DNSServer: Domain: init.itunes.apple.com
12:13:40 DNSServer: ***forward request
12:13:40 DNSServer: -> DNS response from higher level
12:13:40 DNSServer: Shutting down.
12:13:40 PlexConnect: shutdown
12:13:40 PlexConnect: shutdown

My Settings.py looks like this:

g_settings = [
    ('enable_plexgdm'  , ('True', '((True)|(False))')),
    ('ip_pms'          , ('192.168.0.17', '([0-9]{1,3}\.){3}[0-9]{1,3}')),
    ('port_pms'        , ('32400', '[0-9]{1,5}')),
    \
    ('enable_dnsserver', ('True', '((True)|(False))')),
    ('port_dnsserver'  , ('53', '[0-9]{1,5}')),
    ('ip_dnsmaster'    , ('8.8.8.8', '([0-9]{1,3}\.){3}[0-9]{1,3}')),
    ('prevent_atv_update'           , ('True', '((True)|(False))')),
    \
    ('enable_plexconnect_autodetect', ('True', '((True)|(False))')),
    ('ip_plexconnect'  , ('0.0.0.0', '([0-9]{1,3}\.){3}[0-9]{1,3}')),
    ('hosttointercept' , ('trailers.apple.com', '[a-zA-Z0-9_.]+')),
    \
    ('port_webserver'  , ('80', '[0-9]{1,5}')),
    ('enable_webserver_ssl'         , ('True', '((True)|(False))')),
    ('port_ssl'        , ('443', '[0-9]{1,5}')),
    ('certfile'        , ('./assets/certificates/trailers.pem', '.+.pem')),
    \
    ('allow_gzip_atv'              , ('False', '((True)|(False))')),
    ('allow_gzip_pmslocal'         , ('False', '((True)|(False))')),
    ('allow_gzip_pmsremote'        , ('True', '((True)|(False))')),
    \
    ('loglevel'        , ('Normal', '((Off)|(Normal)|(High))')),
    ('logpath'         , ('.', '.+')),
    ]

I have Apache2 installed on my RasPi (for remote outlets) but i changed to port to 8080. The ports.conf looks like this:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:8080
Listen 8080

# If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 Listen 443

and the /site-enabled/000-default looks like this


        ServerAdmin webmaster@localhost
    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

When i run lsof -i -P i get the following for port80:

python    1972 root    4u  IPv4   6580      0t0  TCP 192.168.0.17:80 (LISTEN)

and when i run netstat -atupn i get this:

tcp        0      0 192.168.0.17:80         0.0.0.0:*               LISTEN      -

I also tried to shutdown the apache2 server with sudo service apache2 stop but the port80 ist still being used. I had it already working but i guess something is still wrong. Do i have to follow this guide http://www.linuxtoolbox.ninja/?p=60 or is there something else i have to do? I have to say that i am not an expert in this :)

 

Thank you very much

 

Michael

I'm also having the same exact issue as you. Running plexconnect 0.5.8 on my Synology NAS. It use to work before, but recently I'm not sure what broke this. :(

>>When i run lsof -i -P i get the following for port80:

>> ...

That looks like Python is already hooked up to port 80. Is there another/an older revision of PlexConnect already running?

Check the running processes (ps -ef), if you find like 4 python processes next to each other, they are likely from PlexConnect. You could try to shut them down...

That is what i get when i run the ps -ef command:

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  2 23:36 ?        00:00:01 init [2]  
root         2     0  0 23:36 ?        00:00:00 [kthreadd]
root         3     2  0 23:36 ?        00:00:00 [ksoftirqd/0]
root         4     2  0 23:36 ?        00:00:00 [kworker/0:0]
root         5     2  0 23:36 ?        00:00:00 [kworker/0:0H]
root         6     2  0 23:36 ?        00:00:00 [kworker/u8:0]
root         7     2  0 23:36 ?        00:00:00 [rcu_preempt]
root         8     2  0 23:36 ?        00:00:00 [rcu_sched]
root         9     2  0 23:36 ?        00:00:00 [rcu_bh]
root        10     2  0 23:36 ?        00:00:00 [migration/0]
root        11     2  0 23:36 ?        00:00:00 [migration/1]
root        12     2  0 23:36 ?        00:00:00 [ksoftirqd/1]
root        13     2  0 23:36 ?        00:00:00 [kworker/1:0]
root        14     2  0 23:36 ?        00:00:00 [kworker/1:0H]
root        15     2  0 23:36 ?        00:00:00 [migration/2]
root        16     2  0 23:36 ?        00:00:00 [ksoftirqd/2]
root        17     2  0 23:36 ?        00:00:00 [kworker/2:0]
root        18     2  0 23:36 ?        00:00:00 [kworker/2:0H]
root        19     2  0 23:36 ?        00:00:00 [migration/3]
root        20     2  0 23:36 ?        00:00:00 [ksoftirqd/3]
root        21     2  0 23:36 ?        00:00:00 [kworker/3:0]
root        22     2  0 23:36 ?        00:00:00 [kworker/3:0H]
root        23     2  0 23:36 ?        00:00:00 [khelper]
root        24     2  0 23:36 ?        00:00:00 [kdevtmpfs]
root        25     2  0 23:36 ?        00:00:00 [netns]
root        26     2  0 23:36 ?        00:00:00 [perf]
root        27     2  0 23:36 ?        00:00:00 [khungtaskd]
root        28     2  0 23:36 ?        00:00:00 [writeback]
root        29     2  0 23:36 ?        00:00:00 [crypto]
root        30     2  0 23:36 ?        00:00:00 [bioset]
root        31     2  0 23:36 ?        00:00:00 [kblockd]
root        32     2  0 23:36 ?        00:00:00 [kworker/1:1]
root        33     2  0 23:36 ?        00:00:00 [rpciod]
root        34     2  0 23:36 ?        00:00:00 [kswapd0]
root        35     2  0 23:36 ?        00:00:00 [fsnotify_mark]
root        36     2  0 23:36 ?        00:00:00 [nfsiod]
root        42     2  0 23:36 ?        00:00:00 [kthrotld]
root        43     2  0 23:36 ?        00:00:00 [kworker/0:1]
root        44     2  0 23:36 ?        00:00:00 [VCHIQ-0]
root        45     2  0 23:36 ?        00:00:00 [VCHIQr-0]
root        46     2  0 23:36 ?        00:00:00 [VCHIQs-0]
root        47     2  0 23:36 ?        00:00:00 [iscsi_eh]
root        48     2  0 23:36 ?        00:00:00 [dwc_otg]
root        49     2  0 23:36 ?        00:00:00 [DWC Notificatio]
root        50     2  0 23:36 ?        00:00:00 [kworker/u8:1]
root        51     2  0 23:36 ?        00:00:00 [VCHIQka-0]
root        52     2  0 23:36 ?        00:00:00 [SMIO]
root        53     2  0 23:36 ?        00:00:00 [deferwq]
root        54     2  0 23:36 ?        00:00:00 [kworker/u8:2]
root        55     2  1 23:36 ?        00:00:01 [mmcqd/0]
root        56     2  0 23:36 ?        00:00:00 [kworker/1:2]
root        57     2  0 23:36 ?        00:00:00 [jbd2/mmcblk0p2-]
root        58     2  0 23:36 ?        00:00:00 [ext4-rsv-conver]
root        59     2  0 23:36 ?        00:00:00 [kworker/2:1]
root        74     2  0 23:36 ?        00:00:00 [kworker/3:1]
root       175     1  0 23:36 ?        00:00:00 udevd --daemon
root       298   175  0 23:36 ?        00:00:00 udevd --daemon
root       310   175  0 23:36 ?        00:00:00 udevd --daemon
root       330     2  0 23:36 ?        00:00:00 [kworker/u9:0]
root       331     2  0 23:36 ?        00:00:00 [hci0]
root       333     2  0 23:36 ?        00:00:00 [hci0]
root       335     2  0 23:36 ?        00:00:00 [kworker/u9:1]
root       341     2  0 23:36 ?        00:00:00 [kworker/u9:2]
root      1520     1  0 23:36 ?        00:00:00 /usr/sbin/ifplugd -i eth0 -q -f 
root      1531     1  0 23:36 ?        00:00:00 /usr/sbin/ifplugd -i lo -q -f -u
root      1723     2  0 23:37 ?        00:00:00 [kworker/0:2]
root      1801     2  0 23:37 ?        00:00:00 [kworker/2:2]
root      1806     2  0 23:37 ?        00:00:00 [kworker/3:2]
nobody    1820     1  0 23:37 ?        00:00:00 /usr/sbin/thd --daemon --trigger
root      1838     1  1 23:37 ?        00:00:00 python /home/pi/PlexConnect/Plex
root      1875     1  0 23:37 ?        00:00:00 /usr/sbin/rsyslogd -c5
pi        1946     1  1 23:37 ?        00:00:01 Xtightvnc :1 -desktop X -auth /h
root      1964  1838  0 23:37 ?        00:00:00 python /home/pi/PlexConnect/Plex
root      1968  1838  0 23:37 ?        00:00:00 python /home/pi/PlexConnect/Plex
root      1970  1838  0 23:37 ?        00:00:00 python /home/pi/PlexConnect/Plex
pi        1975     1  0 23:37 ?        00:00:00 /bin/sh /home/pi/.vnc/xstartup
root      1981  1838  0 23:37 ?        00:00:00 python /home/pi/PlexConnect/Plex
pi        1989  1975  0 23:37 ?        00:00:00 /usr/bin/lxsession -s LXDE-pi -e
pi        2021  1989  0 23:37 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/ck-l
pi        2024     1  0 23:37 ?        00:00:00 /usr/bin/dbus-launch --exit-with
root      2025     1  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
pi        2089     1  0 23:37 ?        00:00:00 /usr/bin/dbus-daemon --fork --pr
pi        2144     1  0 23:37 ?        00:00:00 /bin/sh /usr/sbin/start_pms
pi        2153  2144  2 23:37 ?        00:00:01 ./Plex Media Server
ntp       2160     1  0 23:37 ?        00:00:00 /usr/sbin/ntpd -p /var/run/ntpd.
root      2168     1  0 23:37 ?        00:00:00 /usr/sbin/cron
pi        2198  1989  0 23:37 ?        00:00:00 openbox --config-file /home/pi/.
pi        2208  1989  1 23:37 ?        00:00:00 lxpanel --profile LXDE-pi
pi        2209  1989  0 23:37 ?        00:00:00 pcmanfm --desktop --profile LXDE
104       2210     1  0 23:37 ?        00:00:00 /usr/bin/dbus-daemon --system
root      2236     1  0 23:37 ?        00:00:00 ./daemon_remote
www-data  2237  2025  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2238  2025  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2239  2025  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2240  2025  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  2241  2025  0 23:37 ?        00:00:00 /usr/sbin/apache2 -k start
pi        2245     1  0 23:37 ?        00:00:00 /usr/lib/notification-daemon/not
root      2249     1  0 23:37 ?        00:00:00 /usr/sbin/sshd
root      2276     1  0 23:37 ?        00:00:00 /usr/sbin/bluetoothd
root      2282     2  0 23:37 ?        00:00:00 [krfcommd]
pi        2291     1  0 23:37 ?        00:00:00 /usr/bin/pulseaudio --start
rtkit     2294     1  0 23:37 ?        00:00:00 /usr/lib/rtkit/rtkit-daemon
root      2313     1  0 23:37 ?        00:00:00 /usr/lib/policykit-1/polkitd --n
pi        2319     1  0 23:37 ?        00:00:00 /usr/bin/bluetooth-agent 0000
root      2331     1  0 23:37 ?        00:00:00 /usr/sbin/lightdm
root      2361  2331  1 23:37 tty7     00:00:00 /usr/bin/X :0 -auth /var/run/lig
pi        2365     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfsd
root      2366     1  0 23:37 tty1     00:00:00 /bin/login -f    tty1
root      2367     1  0 23:37 tty2     00:00:00 /sbin/getty 38400 tty2
root      2368     1  0 23:37 tty3     00:00:00 /sbin/getty 38400 tty3
root      2369     1  0 23:37 tty4     00:00:00 /sbin/getty 38400 tty4
root      2370     1  0 23:37 tty5     00:00:00 /sbin/getty 38400 tty5
root      2371     1  0 23:37 tty6     00:00:00 /sbin/getty 38400 tty6
root      2372     1  0 23:37 ?        00:00:00 /sbin/getty -L ttyAMA0 115200 vt
root      2375     1  0 23:37 ?        00:00:00 /usr/sbin/console-kit-daemon --n
pi        2438  2366  1 23:37 tty1     00:00:00 -bash
pi        2452     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-gdu-volume-mo
root      2458     1  0 23:37 ?        00:00:00 /usr/lib/udisks/udisks-daemon
root      2461  2458  0 23:37 ?        00:00:00 udisks-daemon: not polling any d
root      2475  2331  0 23:37 ?        00:00:00 lightdm --session-child 11 14
pi        2485  2153 58 23:37 ?        00:00:28 Plex Plug-in [com.plexapp.system
pi        2510  2475  0 23:37 ?        00:00:00 /usr/bin/lxsession -s LXDE-pi -e
pi        2534     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volum
pi        2539  2510  0 23:37 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus
pi        2543     1  0 23:37 ?        00:00:00 /usr/bin/dbus-launch --exit-with
pi        2547     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-afc-volume-mo
pi        2548     1  0 23:37 ?        00:00:00 /usr/bin/dbus-daemon --fork --pr
pi        2554  2510  1 23:37 ?        00:00:00 openbox --config-file /home/pi/.
pi        2556  2510  2 23:37 ?        00:00:00 lxpanel --profile LXDE-pi
pi        2558  2510  1 23:37 ?        00:00:00 pcmanfm --desktop --profile LXDE
pi        2571  2153  2 23:37 ?        00:00:00 /usr/lib/plexmediaserver/Plex DL
pi        2572     1  1 23:37 ?        00:00:00 /usr/lib/notification-daemon/not
pi        2583     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfsd
pi        2594     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-gdu-volume-mo
pi        2596     1  0 23:37 ?        00:00:00 /usr/lib/arm-linux-gnueabihf/lib
root      2598     2  0 23:37 ?        00:00:00 [kworker/0:1H]
pi        2602     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfsd-trash --spaw
pi        2605     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volum
pi        2608     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfs-afc-volume-mo
root      2609     2  0 23:37 ?        00:00:00 [kworker/2:1H]
pi        2618     1  0 23:37 ?        00:00:00 /usr/lib/arm-linux-gnueabihf/lib
pi        2629     1  0 23:37 ?        00:00:00 /usr/lib/gvfs/gvfsd-trash --spaw
root      2658     2  0 23:37 ?        00:00:00 [kworker/1:1H]
pi        2678     1  2 23:37 ?        00:00:00 lxterminal
pi        2679  2678  0 23:37 ?        00:00:00 gnome-pty-helper
pi        2680  2678  2 23:37 pts/0    00:00:00 /bin/bash
pi        2691  2680 10 23:37 pts/0    00:00:00 ps -ef

are those 4 python lines (seperated by one other) what you mean? how can i shut them down?

Thank you

root 1964 1838 0 23:37 ? 00:00:00 python /home/pi/PlexConnect/Plex
root 1968 1838 0 23:37 ? 00:00:00 python /home/pi/PlexConnect/Plex
root 1970 1838 0 23:37 ? 00:00:00 python /home/pi/PlexConnect/Plex
...
root 1981 1838 0 23:37 ? 00:00:00 python /home/pi/PlexConnect/Plex

PlexConnect already running...

Also, please post settings.cfg instead of *.py.

When i try to connect to PlexConnect via Trailers App, nothing happens though.. The DNS Server is on manual with the correct IP adress. I will post the settings.cfg on sunday since i am not at home until then.

Thank you

Hello,

here is the setting.cfg

[PlexConnect]
enable_plexgdm = True
ip_pms = 192.168.178.10
port_pms = 32400
enable_dnsserver = True
port_dnsserver = 53
ip_dnsmaster = 8.8.8.8
prevent_atv_update = True
enable_plexconnect_autodetect = True
ip_plexconnect = 0.0.0.0
hosttointercept = trailers.apple.com
port_webserver = 80
enable_webserver_ssl = True
port_ssl = 443
certfile = ./assets/certificates/trailers.pem
allow_gzip_atv = False
allow_gzip_pmslocal = False
allow_gzip_pmsremote = True
loglevel = Normal
logpath = .

Thank you

As PlexConnect seems to be running already, what do you get when browsing to 

-> 192.168.0.17:80 or :443 from any Webbrowser?

Also, isn't Apache serving ports :80 and :443? Who is doing the authentication stuff on :443? Did you install the "key" with Apache as well?

It's really weird, yesterday PlexConnect was working and i did not change anything. I don't know if this is always like this now though..

When i browse to 192.168.0.17:80 i get this:

Error code 403.

Message: Not Serving Client 192.168.0.12.

Error code explanation: 403 = Request forbidden – authorization will not help.

It does not connect to :443. The error response above is from the remote outlets, i had this the first time and thats why i changed to port 8080. I followed this guide to install Apache, i did not install anything else (https://alexbloggt.com/funksteckdosen-raspberry-pi-teil1/)

Thank you

304 is correct from the browser.