Plex Media Server - Linux installation packaging update - Issues

  1. docker plexinc/pms-docker
  2. 45-plex-hw-transcode-and-connected-tuner does not run when using public nor plexpass tag. Works via latest tag

public/plexpass tag

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[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.

latest tag

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[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] 45-plex-hw-transcode-and-connected-tuner: executing…
[cont-init.d] 45-plex-hw-transcode-and-connected-tuner: exited 0.
[cont-init.d] 50-plex-update: executing…
[cont-init.d] 50-plex-update: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Starting Plex Media Server.

1 Like

I’m not understanding. Are you trying to create a new docker container using the DEB packaging?

Might not be related to this topic. Basically all I am doing is running plex using the docker images. When using the tags public or plexpass it does not run that [cont-init.d] file for one reason or another. However if you use the latest tag it does. This is important since it adds the plex user to the video group for hw transcoding.

EDIT:

Which DEB file / PMS version are you using? 1.18.5.2260 or 118.5.2309 ?

118.5.2309 - Is what gets installed on all versions:

When using plexinc/pms-docker:public or plexinc/pms-docker:plexpass

$ docker exec -it plex ls -lrth /var/run/s6/etc/cont-init.d/
total 12K
-rwxr-xr-x 1 root root 1.5K Jan 14  2019 50-plex-update
-rwxr-xr-x 1 root root 4.1K Jan 14  2019 40-plex-first-run

When using plexinc/pms-docker:latest

$ docker exec -it plex ls -lrth /var/run/s6/etc/cont-init.d/
total 16K
-rwxr-xr-x 1 root root 1.5K Jan 23 11:26 50-plex-update
-rwxr-xr-x 1 root root  922 Jan 23 11:26 45-plex-hw-transcode-and-connected-tuner
-rwxr-xr-x 1 root root 4.1K Jan 23 11:26 40-plex-first-run

Gack! You got caught by the same thing the LSIO guys got caught with.

In 2260, I checked for updating a running container only. I didn’t allow for a sh environment.

As I progressed into that quagmire of executives to allow (which is an endless list – and what you’re seeing in your situation), a breakthrough was made (see above)

I updated the packaging detection to look at the kernel flags and ignore what PID 1 is. It’s cleaner. The LSIO guys tested it and gave it the :+1:

PMS 1.18.6 has these changes. PMS 1.18.6 is probably coming out to Plex Pass Mon-Tues timeframe (I’m not the release manager so please don’t quote me on that?)

Can you hang on until then or are you fully down?

Hey there

upgrading plexmediaserver still sets it to enabled if it was disabled before.

@Orko

Yes, For this and the next update, it will.

The choices were:

  1. Respect run/stop state now, knowing the old package did a hard stop without preserving run/stop state and then require everyone to manually establish control that first time after package installation.

  2. Force start for 1.18.5 and 1.18.6 as the transition period. This gives two releases for everyone to transition. Once the new packaging is installed, you’ll be fine. It’s only the transition from the old packaging to the new where this is a problem.

They decided, since more users probably have it running at installation time and want it to continue running after installation time, to force restart it in this transition.

When you see 1.18.7, it’ll fully respect the running state after installation is complete because plexmediaserver.prerm (which is what stops PMS prior to unpacking) which just got updated to preserve state, will be in place.

DPKG calls prerm before unpacking. That’s what was hiding the run state from preinst. It won’t do that any more. It will preserve run state when it’s called – right before preinst gets called.

I think there is a misunderstanding, i am talking about enable/disable which is a different thing than runs/stop and has nothing to do with each other. Enable/Disable handles the autolaunch at boot time, old packages always set it to enable so the only case where it was disabled is if the user made the choice to.

The correct choice is to always respect users decision, we do that for a reason and its always wrong to silently change user set config which can lead to unwanted behaviour.

You deal with disable that way but totally disregard mask status, why?

I went through your script, please remove the warning if user does not want to autolaunch plex on startup. That is not the correct place to educate users about systemd basics, I really do not need to see that every time. Generally it would be a good idea to behave like every other debian package and not break decade long accepted and expected behaviour.

Also it seems you guys reinvented the wheel. Packages usually use “deb-systemd-helper” for that. Manpage about that is a little misleading, to be fair.

Yes, We might be. Let me restate and see if I can say it better?

All versions prior to 1.18.5.2260

  1. Hard stop PMS - No state preservation
  2. Hard disable PMS - No state preservation
  3. Install
  4. Hard enable PMS
  5. Hard start PMS.

1.18.5.2260 and after

  1. Prerm captures and preserves running/stopped state (the impact of this will be seen after this package control upgrade)
  2. Never touch enable/disable state except for new installations where Enable is asserted on first-time install.
  3. Upgrades will:
    a. Capture run/stop state of PMS prior to unpacking
    b. Restore run/stop state of PMS after installation is complete.

What is happening here is I’m correcting the sins of the past.
With 1.18.5.2260 and newer, states are preserved.
I am trying to educate about the changes while this is happening.
There will be those who never considered Enabling PMS as they should.
This is why I tell them now during this transition.

As I said above, Engineering has decided to force start PMS after install.
I will remove this forced restart after installation.

A point worth reiterating

Linux distribution agnostic support.
a. SystemD native
b. SYSV-init native
c. Docker + Linux (LXC) container
d. Custom installations

SYSV-init systems don’t have any systemd support functions and neither do most containers. I had no choice but to be free-standing.

It’s a tool specifically made for deb packages to handle all init systems on debian.

NAME
deb-systemd-helper - subset of systemctl for machines not running systemd

From the package description:

Package: init-system-helpers (1.56+nmu1) [[ essential ]]

helper tools for all init systems

This package contains helper tools that are necessary for switching between the various init systems that Debian contains (e. g. sysvinit or systemd). An example is deb-systemd-helper, a script that enables systemd unit files without depending on a running systemd.

It also includes the “service”, “invoke-rc.d”, and “update-rc.d” scripts which provide an abstraction for enabling, disabling, starting, and stopping services for all supported Debian init systems as specified by the policy.

While this package is maintained by pkg-systemd-maintainers, it is NOT specific to systemd at all. Maintainers of other init systems are welcome to include their helpers in this package.

Is it 100% guaranteed: If the host has the dpkg package installer, it will also have all the helpers?

Since this packaging is agnostic, It also must import directly into the RPM packaging.

If I make one deb-helper dependent, I now must create and maintain a second set for RPM.

Doesn’t making either of these dependent on DPKG or RPM has nullified the design premise of being 100% agnostic?

Is there any update on PMS 1.18.6.xxx release? The 1.18.5.2309 release is not working on my bare-metal, bog-standard Ubuntu 19.10 system.

Linux samiran-desktop 5.3.0-29-generic #31-Ubuntu SMP Fri Jan 17 17:27:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan

Install output below, this is after a remove and purge, and manually deleting the /var/lib/plexmediaserver directory, so this should be considered as a pretty clean install. I don’t understand why it is failing, but it is quite a pain in my butt.

samiran@samiran-desktop:~/Downloads$ sudo dpkg -i plexmediaserver_1.18.5.2309-f5213a238_amd64.deb
Selecting previously unselected package plexmediaserver.
(Reading database … 314628 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.18.5.2309-f5213a238_amd64.deb …
PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Pre-installation Validation complete.
Unpacking plexmediaserver (1.18.5.2309-f5213a238) …
Setting up plexmediaserver (1.18.5.2309-f5213a238) …
PlexMediaServer install:
PlexMediaServer install: Now installing based on:
PlexMediaServer install: Process Control: Systemd
PlexMediaServer install: Plex User: plex
PlexMediaServer install: Plex Group: plex
PlexMediaServer install: Video Group: video
PlexMediaServer install: Metadata Dir: /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install: Temp Directory: /var/lib/plexmediaserver/tmp_transcoding
PlexMediaServer install: Lang Encoding: en_US.UTF-8
PlexMediaServer install: HW transcoding: Found
PlexMediaServer install:
PlexMediaServer install: Completing final configuration.
dpkg: error processing package plexmediaserver (–install):
installed plexmediaserver package post-installation script subprocess returned error exit status 2
Processing triggers for libc-bin (2.30-0ubuntu2) …
Processing triggers for gnome-menus (3.32.0-1ubuntu1) …
Processing triggers for desktop-file-utils (0.24-1ubuntu1) …
Processing triggers for mime-support (3.63ubuntu1) …
Errors were encountered while processing:
plexmediaserver

From a bit earlier in the thread:

Thanks!

FYI, I fixed this error by going into /var/lib/dpkg/info/plexmediaserver.postinst, and commenting out lines 231 through 234.

# Reload and trigger if not in a Linux Container (known udev bug)

if [ $LinuxContainer -eq 0 ]; then

udevadm control --reload-rules

udevadm trigger

fi

@scamiran

Was the issue caused by the use of a Linux Container?
You state “bare metal” but are editing LinuxContainer conditional? I’m not understanding.

May I see the /tmp/plexinstall.log file please?

Hey @ChuckPa, I just loaded up the latest Plexpass build on my ubuntu 19.04 machine, and noticed:
Created symlink /etc/systemd/system/multi-user.target.wants/plexmediaserver.service → /lib/systemd/system/plexmediaserver.service.
/var/lib/dpkg/info/plexmediaserver.postinst: 375: [: -gt: unexpected operator
PlexMediaServer install: PlexMediaServer-1.18.6.2348-fd90a1389 - Installation successful.

http://paste.ubuntu.com/p/BFCH3NgXYk/

Lemme know if you need anything else from me (feel free to ping on IRC, you know where to find me)

Keith,
would you grab the file /tmp/plexinstaller.log ?

You should not be seeing that

Edit:
Disregard. Found a state transition error. I had been asked to cleanup code. In that cleanup, I made an error (oversight). Those who reviewed didn’t find it either. I’ve made the correction and will try to get PMS repackaged given it will be some time before the next release of PMS.

Hi! I’m running Plex in a systemd-nspawn container, and upgrading to 1.18.5.2309 dpkg was giving me

dpkg: error processing package plexmediaserver (--configure):
 installed plexmediaserver package post-installation script subprocess returned error exit status 1

Which was udevadm control --reload-rules failing. Looking through plexinstall.log LinuxContainer was set to 0. I set it to 1 in plexinstall.log manually and dpkg --configure happily finished on the next run.

Looking through preinst, LinuxContainer is set when container=lxc is in /proc/1/environ, but naturally I have container=systemd-nspawn instead. I didn’t see anything that seemed quite like what I was seeing in this thread, so hopefully this is of some use. Let me know if there is any more information you need.