Plex Media Server - Linux installation packaging update - Issues

Not off topic at all to me but reading my posts would make me smile more :smiley:

As I stated in the Update announcement at the top of this topic,

When this logic has been proven stable, it will be fitted into the RedHat (RPM) packages.

Thanks for the response, sorry for the delay in response

This is the error I get

sudo dpkg -i plexmediaserver_1.18.5.2260-056ab4be9_amd64.deb
[sudo] password for
(Reading database … 199969 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.18.5.2260-056ab4be9_amd64.deb …
plexmediaserver stop/waiting
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Unsupported init/systemd hybrid control configuration.
dpkg: error processing archive plexmediaserver_1.18.5.2260-056ab4be9_amd64.deb (–install):
subprocess new pre-installation script returned error exit status 1
plexmediaserver start/running, process 27659
Processing triggers for libc-bin (2.23-0ubuntu11) …
Errors were encountered while processing:
plexmediaserver_1.18.5.2260-056ab4be9_amd64.deb

The result from cat /proc/1/comm
init

I don’t have a log file for the plex installer in /tmp

Edit: never mind fixed it by running:

If you want to switch back to systemd, install the systemd-sysv and ubuntu-standard packages.

from https://wiki.ubuntu.com/SystemdForUpstartUsers

What that’s telling you is cat /proc/1/comm is reporting init but when it goes to check for systemd (which is the supported migration) /sbin/init -> /sbin/systemd), it’s not finding systemd. This is intended to support upgraded system from Ubuntu 14-> 15 (upstart – which isn’t supported) -> systemd.

Can you tell me what you do have ?

1 Like

To All Reading Here:

In the posts above, we uncovered a few issues with the new packaging.

As promised, those changes were submitted to Engineering and QA.

Unfortunately, they did not make it into the master source tree in time for updating before PMS 1.18.6 was release locked.

What this means:

  1. PMS 1.18.5.2260 will be advanced to public as it is - with these few issues still open.

  2. PMS 1.18.6.xxxx does contain the changes & corrections. PMS 1.18.6 will be available in Plex Pass Beta when 1.18.5 becomes public. (Normal release process).

I apologize for how this worked out but we did the best we could do given everything involved.

Overall, given the number of installations, the new packaging release is proceeding exceptionally well. It’s much better than expected. I’m looking forward to an equally smooth introduction into the general user community.

Eek. My bad.

Scotch doesn’t lend to thorough reading :-/

Thanks for the reply though.

No, it’s doesn’t lend itself to thorough reading but it does make the evening much more enjoyable. :wink:

Hey, @ChuckPa.
Getting back after the new released build:

Selecting previously unselected package plexmediaserver.
(Reading database ... 11215 files and directories currently installed.)
Preparing to unpack plex.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Docker detected. Preinstallation validation not required.
Unpacking plexmediaserver (1.18.5.2309-f5213a238) ...
Setting up plexmediaserver (1.18.5.2309-f5213a238) ...
PlexMediaServer install: Error:  Plex installation configuration file could not be imported.  Please seek additional help in our Support Forums
dpkg: error processing package plexmediaserver (--install):
 installed plexmediaserver package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.29-9) ...
Errors were encountered while processing:

Update: I spare you the debugging: the Docker condition exit the preinst script before writting the plexinstall.log :slight_smile:

Yes, it’s supposed to exit as soon as a supported docker container is detected.
I’m annoyed that it didn’t continue equally gracefully in the actual postinst module and simply drop the files where they should be.

Please confirm for me you installed inside your existing docker container at the command line?

I’m looking at the code now and see an oversight in postinst.
As final verification, cat /proc/1/comm returns sh ?

This will require a hotfix. Since 1.18.5 is now locked and 1.18.6 in QA, I’ll need hotfix 1.18.6 PlexPass.

Yes

root@7f576bcd27fb:/data# dpkg -i plex_mod.deb
(Reading database ... 13435 files and directories currently installed.)
Preparing to unpack plex_mode.deb ...
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Docker detected. Preinstallation validation not required.
Unpacking plexmediaserver (1.18.5.2309-f5213a238) over (1.18.5.2309-f5213a238) ...
Setting up plexmediaserver (1.18.5.2309-f5213a238) ...
/prom/1/comm is sh
PlexMediaServer install: Error:  Plex installation configuration file could not be imported.  Please seek additional help in our Support Forums
dpkg: error processing package plexmediaserver (--install):
 installed plexmediaserver package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.30-0ubuntu2) ...
Processing triggers for mime-support (3.63ubuntu1) ...
Errors were encountered while processing:
 plexmediaserver

Yes

actually you could just add the condition of ā€œ$(/proc/1/comm)ā€ = ā€œshā€

 44 if [ "$(cat /proc/1/comm)" = "s6-svscan" ] || [ "$(cat /proc/1/comm)" = "tini" ]; then
 45   Output both "Docker detected. Postinstallation not required."
 46   exit 0
 47 fi

the build you have doesn’t have what is coming out. If I may share what you’ll see (or very close to it) ?

You’ll see I re-sequenced as well when things are written and, most importantly, when read. This keeps to the design premise of keeping the intelligence in preinst and only flags in postinst.

preinst

  # Looks like Docker  (s6-svscan = Plex/Linuxserver.io;  tini = binhex; sh = custom or homemade container)
  if [ "$(cat /proc/1/comm)" = "s6-svscan" ] || [ "$(cat /proc/1/comm)" = "tini" ] || [ "$(cat /proc/1/comm)" = "sh" ]; then
    Output both "Docker detected. Preinstallation validation not required."

    # Put date/time stamp in log file for use in debugging
    echo '# Plex Media Server installation configuration info: ' $(date) >>$InstConfig

    # Flag only Docker because we're oterwise done.
    echo IsDocker=1                       >> $InstConfig

    # Exit now
    exit 0
  fi

postinst

# Define Temp file
InstConfig="/tmp/plexinstaller.log"

# Read the file - Fail if it does not
test -f /tmp/plexinstaller.log  && . /tmp/plexinstaller.log
if [ $? -ne 0 ]; then
  Output both 'Error:  Plex installation configuration file could not be imported.  Please seek additional help in our Support Forums'
  exit 1
fi

# Read the runtime state
if [ -e /tmp/.plexmediaserver.state ]; then
  . /tmp/.plexmediaserver.state
fi

# If this is a Docker or other container,  exit now.  No additional processing is necessary
if [ $IsDocker -eq 1 ]; then

  # Inform the user we're done with Docker installation
  Output both "Docker detected. Post installation tasks not required. Continuing. "
  exit 0
fi

Thoughts ?

I still have to do the full testing workup.
I am expecting that if you have a valid existing configuration in the container (which the container is supposed to provide) then my work of depositing files is done.

Yup your solution’s working for containers :+1:

I have one more cleanup for containers I’m wanting to do.

I have a developer build if you’d like to try it for me?
It’ll help me ā€œcheck the boxesā€ quicker.

Sure thing

Thanks.

I’m writing the change request up now.

Should :crossed_fingers: go quick. I’ll press for an update to 2309 in PlexPass.

As of plexmediaserver_1.18.5.2309-f5213a238_amd64.deb
i am still getting
PlexMediaServer install: Error: Unknown username 'ADplex' used in /etc/systemd/system/plexmediaserver.service.d/override.conf.

It passes as a warning for the ownership check but the systemd override is still erroring.

How can that be? I’ve updated the references to use getent.

    # Validate the user, accept as PlexUser if valid
    if [ "$OverrideUser" != "" ]; then
      if [ $(getent passwd ${OverrideUser} | wc -l) -eq 0 ]; then
        Output both "Error: Unknown username '$OverrideUser' used in $OverrideFile."
        Fail=1
      else
        PlexUser=$OverrideUser
      fi
    fi

Edit: I pulled the build logs. The getent change did not make it into 2309. Some of the changes got in but that one didn’t. I am sorry about that.

There is another bump coming quickly on the heals. It is in this next one.

latest plexinc/pms-docker:1.18.5.2309-f5213a238 docker container.
Container does not start properly, and installation fails.

[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 40-plex-first-run: executing... 
Plex Media Server first run setup complete
[cont-init.d] 40-plex-first-run: exited 0.
[cont-init.d] 50-plex-update: executing... 
Attempting to upgrade to: 1.18.5.2309-f5213a238
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   190    0   190    0     0    719      0 --:--:-- --:--:-- --:--:--   719

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 82.8M  100 82.8M    0     0  71.7M      0  0:00:01  0:00:01 --:--:--  100M

Selecting previously unselected package plexmediaserver.
(Reading database ... 7556 files and directories currently installed.)
Preparing to unpack /tmp/plexmediaserver.deb ...
PlexMediaServer install: Pre-installation Validation.  
PlexMediaServer install: ERROR:  Plex Media Server can only be installed on 'init' or 'systemd' based systems.  
PlexMediaServer install:         Your system has docker-init but minimally required files are missing.  
dpkg: error processing archive /tmp/plexmediaserver.deb (--install):
 subprocess new pre-installation script returned error exit status 1
Processing triggers for libc-bin (2.23-0ubuntu10) ..
Errors were encountered while processing:
 /tmp/plexmediaserver.deb
[cont-init.d] 50-plex-update: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting Plex Media Server.
/bin/sh: 1: /usr/lib/plexmediaserver/Plex Media Server: not found
Starting Plex Media Server.
/bin/sh: 1: /usr/lib/plexmediaserver/Plex Media Server: not found
Starting Plex Media Server.
/bin/sh: 1: /usr/lib/plexmediaserver/Plex Media Server: not found
Starting Plex Media Server.
/bin/sh: 1: /usr/lib/plexmediaserver/Plex Media Server: not found
1 Like

@ChuckPa

Linuxserver team member here.

Linuxserver plex build is failing because during build time, /proc/1/comm is sh. (During container runtime, it is s6-svscan)
Preinst checks for that correctly and skips, but postinst does not and fails.

For reference, here’s the working preinst docker check:

  if [ "$(cat /proc/1/comm)" = "s6-svscan" ] || [ "$(cat /proc/1/comm)" = "tini" ] || [ "$(cat /proc/1/comm)" = "sh" ]; then
    Output both "Docker detected. Preinstallation validation not required."
    exit 0
  fi

And here’s the non-working postinst docker check:

if [ "$(cat /proc/1/comm)" = "s6-svscan" ] || [ "$(cat /proc/1/comm)" = "tini" ]; then
  Output both "Docker detected. Postinstallation not required."
  exit 0
fi

Here’s our jenkins build log where you can see the errors: https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-plex/detail/master/179/pipeline/123

@rastaman3

The situation you see is the result of the inspection not recognizing your docker container correctly. It looked specifically for LSIO and BimHex. Anything else resulted in the error you indicated (docker-init) because it is looking for init or systemd (the standards)

Because of the number of different docker flavors in existence, it was decided by engineering that I should change the detection as I would otherwise be forever chasing that list. I’ve already learned of dumb-init. You’ve just added docker-init as another. See how crazy that will get if I keep allowing them on a per-case basis?

To that end, I’m preparing to make adjustments which result in:

  1. Systemd
  2. Init
  3. Official LSIO / BinHex Docker
  4. All others

The processing for each would be:

  • Systemd & Init - continues as per design
  • LSIO/Binhex - No processing required. Those environments are known to handle everything needed
  • All others - will be allowed with the caveat the packaging will do no processing after depositing the files because it doesn’t know that is safe and what isn’t. I don’t want to break anything.

Does this seem a good resolution ?

@aptalca

Yes, the detection / allowance of sh was missing from the initial set.
The design criteria was for the run-time environments where folks would be installing into existing containers.

Other docker executives now known include dumb-init and docker-init. I don’t know where that list would end which is why the above 3 classes seems to make the most sense.

When the main environments (init + systemd) are detected, processing is as per norm. All others skip the normal processing and allow that environment to perform its own tasks.

Your thoughts please?