wernight / docker-plex-media-server

Dockerized Plex Media Server
https://registry.hub.docker.com/u/wernight/plex-media-server/
MIT License
129 stars 34 forks source link

Latest autoupdate image does not work #38

Open gravufo opened 7 years ago

gravufo commented 7 years ago

Host OS: Linux (Ubuntu 16.04) Tag/Version: autoupdate

Steps:

  1. Create a new container using the following command: docker run -d --name=plex --restart=unless-stopped -v /plex:/config -v /media:/media -p 1900:1900/udp -p 32469:32469 -p 3005:3005 -p 5353:5353/udp -p 8324:8324 -p 32410:32410/udp -p 32412:32412/udp -p 32413:32413/udp -p 32414:32414/udp -p 32400:32400 -e X_PLEX_TOKEN=<token> wernight/plex-media-server:autoupdate

Expected: Server to download latest plex pass version and run.

Actual: The following error:

➜  docker logs plex
8192
Downloading Plex Media Server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   177  100   177    0     0    364      0 --:--:-- --:--:-- --:--:--   364
100  101M  100  101M    0     0  14.1M      0  0:00:07  0:00:07 --:--:-- 15.8M
Installing Plex Media Server...
Selecting previously unselected package plexmediaserver.
(Reading database ... 8335 files and directories currently installed.)
Preparing to unpack plexmediaserver.deb ...
Unpacking plexmediaserver (1.7.4.4017-3886b5c85) ...
Setting up plexmediaserver (1.7.4.4017-3886b5c85) ...
dpkg: error processing package plexmediaserver (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 plexmediaserver
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
Warning: program compiled against libxml 209 using older 207
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)
xmlstarlet: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by xmlstarlet)

After that, it keeps looping the same thing over and over again.

Thanks for helping and maintaining this image btw!

shianux commented 7 years ago

I'm having a similar issue:

Downloading Plex Media Server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   177  100   177    0     0    202      0 --:--:-- --:--:-- --:--:--   202
100  101M  100  101M    0     0  53.2M      0  0:00:01  0:00:01 --:--:--  112M
Installing Plex Media Server...
Selecting previously unselected package plexmediaserver.
(Reading database ... 8335 files and directories currently installed.)
Preparing to unpack plexmediaserver.deb ...
Unpacking plexmediaserver (1.7.4.4017-3886b5c85) ...
Setting up plexmediaserver (1.7.4.4017-3886b5c85) ...
dpkg: error processing package plexmediaserver (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 plexmediaserver
wernight commented 7 years ago

Looking into it. I managed to reproduce the issue.

wernight commented 7 years ago

Last version for PlexPass seems to have an issue. Until it's fixed by Plex, you can do one of:

shianux commented 7 years ago

the container and Plex is working again, however it seems that Plex Pass updates are not downloaded and/or installed.

wernight commented 7 years ago

@shianux As I said, I think PlexPass latest version is bugged.

wernight commented 7 years ago

Plex version 1.7.4.4017-3886b5c85 for Ubuntu 64 (sha1 c9d3d4a709a30b86f144c5f59b6894bd5ba89b3f matching what's on https://www.plex.tv/downloads/) cannot be installed. This is a new issue as version 1.5.7.4016-25d94bad9 works.

Posted the issue also on Plex forum.

gravufo commented 7 years ago

Thank you for the help! I guess this ticket could be closed since it's not an issue on your end, but you could also leave it open for visibility until Plex resolves the underlying issue; up to you :)

As a workaround I am using the "latest" image instead of autoupdate and it works just fine.

wernight commented 7 years ago

@gravufo I suggested 2 other workarounds. I'll leave it open until resolved.

shianux commented 7 years ago

thank you

shianux commented 7 years ago

Plex seems to have updated, but the docker still seems unable to install PMS.

If I run the docker using X_PLEX_TOKEN, this is the error:

Downloading Plex Media Server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   506  100   506    0     0    621      0 --:--:-- --:--:-- --:--:--   620
Installing Plex Media Server...
dpkg-deb: error: `plexmediaserver.deb' is not a debian format archive
dpkg: error processing archive plexmediaserver.deb (--install):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 plexmediaserver.deb

If I run the docker using log in details, this is the error:

Retrieving a X-Plex-Token using Plex login/password...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   506  100   506    0     0    621      0 --:--:-- --:--:-- --:--:--   620
Failed to retrieve the X-Plex-Token.
/plex-entrypoint.sh: 35: export: html>: bad variable name

If I run the docker forcing download URL, this is the error:

Using PLEX_FORCE_DOWNLOAD_URL.
Downloading Plex Media Server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   177  100   177    0     0     46      0  0:00:03  0:00:03 --:--:--    46
100  101M  100  101M    0     0  20.6M      0  0:00:04  0:00:04 --:--:--  112M
Installing Plex Media Server...
Selecting previously unselected package plexmediaserver.
(Reading database ... 8335 files and directories currently installed.)
Preparing to unpack plexmediaserver.deb ...
Unpacking plexmediaserver (1.7.5.4035-313f93718) ...
Setting up plexmediaserver (1.7.5.4035-313f93718) ...
dpkg: error processing package plexmediaserver (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 plexmediaserver
wernight commented 7 years ago

Looks like an unrelated issue with retrieve-plex-token (see #39).

domibarton commented 7 years ago

Same issue here on 1.7.4 and 1.7.5.4035-313f93718.

The error in the post script is because of udev / udevadm. Here's the debug output of the post install script (running with configure, non-existing PMS installed so far):

+ action=configure
+ version=
+ [  = 1 ]
+ [ x = x ]
+ USER=plex
+ getent passwd plex
+ getent group plex
+ [ ! -d /var/lib/plexmediaserver ]
+ PUSER=plex
+ VGROUP=video
+ NORUN=0
+ OVERRIDE=/etc/systemd/system/plexmediaserver.service.d/override.conf
+ OLDSERVICE=/etc/systemd/system/plexmediaserver.service
+ OLDINIT=/etc/default/plexmediaserver
+ cat /proc/1/comm
+ [ bash = systemd ]
+ [ -f /etc/default/plexmediaserver ]
+ grep ^User= /etc/default/plexmediaserver
+ wc -l
+ [ 0 = 1 ]
+ [ -f /dev/dri/renderD128 ]
+ [ -f /dev/fb0 ]
+ [ -f /dev/video0 ]
+ [ 0 != 1 ]
+ getent group video
+ grep -c video
+ [ 1 != 0 ]
+ groups plex
+ grep -c video
+ [ 1 = 0 ]
+ [ -f /etc/systemd/system/plexmediaserver.service ]
+ [ -f /sbin/udevadm ]
+ udevadm control --reload-rules

Udev won't start in Docker containers and therefor the following command fails:

root@02e47a391c55:/# udevadm control --reload-rules
root@02e47a391c55:/# echo $?
2
wernight commented 7 years ago

I remember creating a dummy start for example. May be a dummy udev or udevadm would fix this.

domibarton commented 7 years ago

Mhm could work…

Just FYI: I'm not using your image, as I'm using my own Docker image. However, I've the same problem and when I saw your issue I though I will update it ;)

I see the following options:

IMHO you don't need to tinker with the udev init script, as the post-install script will only use udevadm. Unfortunately, there's a set -e set on top, and because of that it fails.

As we're talking about Docker, I would suggest replacing udevadm with a dummy script is an option, as well as force installing plex. However, I wait until it's fixed! :)

domibarton commented 7 years ago

Just saw the post of ChuckPA… apparently a fix is ready soon ;)

shianux commented 7 years ago

Hi,

I've tried 3 different methods of running the container (token, log in credentials, forced download URL), and get the same error message with all three:

Downloading Plex Media Server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   177  100   177    0     0    206      0 --:--:-- --:--:-- --:--:--   206
100  101M  100  101M    0     0  52.1M      0  0:00:01  0:00:01 --:--:--  112M
Installing Plex Media Server...
Selecting previously unselected package plexmediaserver.
(Reading database ... 8335 files and directories currently installed.)
Preparing to unpack plexmediaserver.deb ...
Unpacking plexmediaserver (1.7.5.4035-313f93718) ...
Setting up plexmediaserver (1.7.5.4035-313f93718) ...
dpkg: error processing package plexmediaserver (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 plexmediaserver
wernight commented 7 years ago

You can use also wernight/plex-media-server:latest. 1.7.5 has the issue described here.

I've just pushed a temp fix until this is properly fixed. You may pull to test the new version.

adduc commented 7 years ago

It might be decent to exit/fail after n number of tries, to prevent unneeded bandwidth consumption. Woke up this morning to find nearly 300GB consumed attempting to download/install from the autoupdate image.

domibarton commented 7 years ago

@adduc This is not directly the image's fault, it's how Docker works. However, auto-updating images aren't a good practice, as Docker wasn't designed for that ;) Auto-updating means your image will grow over time and you can't leverage the Docker FS layers.

wernight commented 7 years ago

@domibarton The image will not grow over time. You just need to clean up unused images which not docker have docker image prune.

There is a non-autoupdate but that should work for plex pass as those download links are normally restricted. Also it may delay updates.

@adduc That's if you've setup restart:true without delay. I don't see a good way to make that work simply. There could be of course such mechanism within the auto-update image but I feel it's not the right place. For example it'd give no way from outside the container to just see that it failed to download. So I think it should be done outside of the container. Kubernetes for example automatically multiplies time by 2 each time.

What could be done is to have the downloaded .deb cached. It'd also improve restart speed. I'll look into supporting that.