New Linux installer - Forum preview & beta testing

New Plex Media Server packaging (installer) for Linux.

We set out on this task to upgrade PMS’ packaging for all Linux systems.

A. The design criteria

  1. Intelligent installer in the package itself.
    a. Non-destructive pre-installation evaluation.
    b. Not changing a running installation unless the installer knows it will succeed.
    c. Capable of evaluating each system’s particular configuration and adapting to it.
    d. Reporting errors as they are found in the Pre-installation and actual installation stages
    e. Respecting the run-time state of PMS (running / stopped / enabled / disabled ) and restoring that state after installation
    f. Correctly implement remove and purge on Debian-based systems
    g. Be as “well behaved” as possible in Linux (atomic packaging operations)

  2. Linux distribution agnostic.
    a. SystemD native support
    b. SYSV-init native support

  3. Status report of what the installer found and how PMS is configured on the target system. This includes reporting if hardware transcoding capability has been found.

  4. System log file tracking of installation activity. Final installation configuration also recorded in the system log to allow audit of automated download and installation via scripted methods.

  5. Regardless of the system installed on, PMS will not
    a. Break a running system in the installation process
    b. Allow installation of PMS on a known-bad configuration.

B. What it looks like

A preview of what you’ll see now. Systemd or Init based no longer matters.

chuck@debian9-init:~$ sudo dpkg -i plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb
(Reading database ... 156356 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb ...
Shutting down Plex Media Server: 
PlexMediaServer installer: Pre-installation Validation.  
PlexMediaServer installer: Pre-installation Validation complete.  
Unpacking plexmediaserver (1.16.1.1227-7d24c1d30) over (1.16.0.1220-147963d87) ...
Setting up plexmediaserver (1.16.1.1227-7d24c1d30) ...
PlexMediaServer installer:    
PlexMediaServer installer: Now installing based on:  
PlexMediaServer installer:   Process Control:    Init  
PlexMediaServer installer:   Plex User:          plex 
PlexMediaServer installer:   Plex Group:         plex 
PlexMediaServer installer:   Video Group:        video 
PlexMediaServer installer:   Metadata Dir:       /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer installer:   Temp Directory:     /tmp 
PlexMediaServer installer:   Lang Encoding:      en_US.UTF-8 
PlexMediaServer installer:   Config file used:   /etc/default/plexmediaserver 
PlexMediaServer installer:   HW transcoding:     Not found  
PlexMediaServer installer:    
PlexMediaServer installer: Completing final configuration.  
PlexMediaServer installer: PlexMediaServer-1.16.1.1227-7d24c1d30 - Installation successful.  
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for gnome-menus (3.13.3-9) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Processing triggers for mime-support (3.60) ...
chuck@debian9-init:~$

Explaining the output:

a. Process Control - Whether systemd or init based.
b. Plex User - User name Plex is going to run as
c. Plex Group - Group name Plex is going to run as
d. Video Group - Group Plex will use for join for hardware transcoding
e. Metadata Dir - Where the Plex Library is.
f. Temp Dir - Temporary directory used for transcoding
g. Lang Encoding: - Language localization (locale) configured
h. Config file used: - Reported when a customized local configuration is detected
i. HW Transcoding - “Found” or “Not Found” (passive inspection during installation)

When Preinstallation validation is complete, Pre-install writes a combined “Log/Config” file to /tmp/plexinstaller.log. This file is used by actual installer postinst but also can be used to debug configuration problems including bringing that information to the forums for additional assistance.

Sample Error Messages

During Pre-installation validation, where the installer verifies the actual installation will succeed, it will report errors it finds. Configuration customizations (override files) are
A few examples of this are:

  1. Error: Temp directory 'DirName' used in 'OverrideFile' file does not exist.
  2. Error: Unknown username 'OverrideUser' used in OverrideFile'.
  3. Error: Environment variable 'ForbiddenVar' not allowed in 'OverrideFile'

Forum Preview Goals:

  1. Test the new installer core software on Debian systems
  2. Correct any deficiencies or errors found
  3. Deploy as standard for all future Debian packaging.
  4. Integrate this installer as the core of the new RPM installer

Warnings

  1. It will not let you install into an configuration which cannot run
  2. The pre-installer is verbose and will tell you what it does not like.
  3. apt purge will really purge everything, just as a proper Linux purge should.

Please keep all discussion and support requests in this thread.

We will work through any issues as they come up. I expect a few minor ones but this should be a largely effortless on your part improvement.

The Download Links 1.16.1.1227 (updated PMS below)

I will update these as/if we need to make any changes along the way.

Please let me know how you make out, good or bad. It will help gauge when to put this into production use.

Update

04-July-2019 - Plex Media Server 1.16.2.1311

If no errors or edge conditions are found in this build, this packaging will become the new mainstream packaging for all Debian based systems.

Everyone’s input is welcome here

Update 07-Jul-2019

  • Fat fingered developer error; Fixed. Developer shot. :smiling_imp:

  • WSL2 - Now detected and blocked while in Alpha/Beta phase. Cannot support a moving target.

Same links as above, copied here.

2 Likes

The installation went fine on my Xubuntu 19.04 test server. All expected information was output as described above and was correct.

No issues here. Exactly as advertised. Installed on Debian 9.9 (Stretch). Was running Plex 1.14.x

(Reading database … 57477 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb …
Removed /etc/systemd/system/multi-user.target.wants/plexmediaserver.service.
PlexMediaServer installer: Pre-installation Validation.
PlexMediaServer installer: Pre-installation Validation complete.
Unpacking plexmediaserver (1.16.1.1227-7d24c1d30) over (1.14.1.5488-cc260c476) …
Setting up plexmediaserver (1.16.1.1227-7d24c1d30) …
PlexMediaServer installer:
PlexMediaServer installer: Now installing based on:
PlexMediaServer installer: Process Control: Systemd
PlexMediaServer installer: Plex User: plex
PlexMediaServer installer: Plex Group: plex
PlexMediaServer installer: Video Group: video
PlexMediaServer installer: Metadata Dir: /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer installer: Temp Directory: /var/lib/plexmediaserver/tmp_transcoding
PlexMediaServer installer: Lang Encoding: en_US.UTF-8
PlexMediaServer installer: HW transcoding: Not found
PlexMediaServer installer:
PlexMediaServer installer: Completing final configuration.
Created symlink /etc/systemd/system/multi-user.target.wants/plexmediaserver.service → /lib/systemd/system/plexmediaserver.service.
PlexMediaServer installer: PlexMediaServer-1.16.1.1227-7d24c1d30 - Installation successful.
Processing triggers for libc-bin (2.24-11+deb9u4) …
Processing triggers for mime-support (3.60) …

NB: I did have to restart the Plex service after the installer ran. I don’t know if that’s part of the installer process, or part of the reason I had to downgrade to 1.14.x when 1.15.x came out (I’m aware this is 1.16.x but problems from before could still exist).

@HarryShowerdrain

Would you please grab the file /tmp/plexinstaller.log and attach it here?
It will tell me everything it found and why it started / didn’t restart.

If you have restarted the system, the same information can be found in your system log.

journalctl -xe | grep PlexMediaServer

-or-

dmesg | grep PlexMediaServer

Plex Media Server installation configuration info: Wed Jun 19 10:28:25 EDT 2019

Init=0
Systemd=1
IsEnabled=1
IsRunning=0
NewInstall=0
HaveOverride=0
OverrideFile=“”
PlexUser=“plex”
PlexGroup=“plex”
VideoGroup=“video”
AppSuppDir=“/var/lib/plexmediaserver/Library/Application Support”
PlexTempDir=“/var/lib/plexmediaserver/tmp_transcoding”
LangEncoding=“en_US.UTF-8”
HaveHardware=0
NeedUser=0
NeedGroup=0
NeedDirs=0
NeedVideo=1
NeedUdev=0
NeedOwner=0
Verbose=1

You like that? This is what preinst does.
In postinst I use those flags to steer the logic.

It’s still a big package script pair (799 lines including comments in this pre-production phase)
I want this to make it so PMS dependencies are reduced to the hardware and glibc (the company’s goal)

2 Likes

@HarryShowerdrain

Quick Question:

I’ve been thinking about your post above.

Was PMS running when you installed but it didn’t restart automatically after ?

tried installing this preview on windows + debian + WSL2 (windows services for linux v2)

tekno@DESKTOP-TMKRN4C:~$ sudo dpkg -i /mnt/c/Users/Tekno/Downloads/plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb
Selecting previously unselected package plexmediaserver.
(Reading database ... 9692 files and directories currently installed.)
Preparing to unpack .../plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb ...
PlexMediaServer installer: Pre-installation Validation.
PlexMediaServer installer: Pre-installation Validation complete.
Unpacking plexmediaserver (1.16.1.1227-7d24c1d30) ...
Setting up plexmediaserver (1.16.1.1227-7d24c1d30) ...
PlexMediaServer installer:
PlexMediaServer installer: Now installing based on:
PlexMediaServer installer:   Process Control:    Systemd
PlexMediaServer installer:   Plex User:          plex
PlexMediaServer installer:   Plex Group:         plex
PlexMediaServer installer:   Video Group:        video
PlexMediaServer installer:   Metadata Dir:       /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer installer:   Temp Directory:     /var/lib/plexmediaserver/tmp_transcoding
PlexMediaServer installer:   Lang Encoding:      en_US.UTF-8
PlexMediaServer installer:   HW transcoding:     Not found
PlexMediaServer installer:
PlexMediaServer installer: Completing final configuration.
dpkg: error processing package plexmediaserver (--install):
 subprocess installed post-installation script returned error exit status 2
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Errors were encountered while processing:
 plexmediaserver
tekno@DESKTOP-TMKRN4C:~$ nano
tekno@DESKTOP-TMKRN4C:~$ nano /tmp/plexinstaller.log
tekno@DESKTOP-TMKRN4C:~$ cat /tmp/plexinstaller.log
# Plex Media Server installation configuration info:  Thu Jun 20 20:49:21 CDT 2019
Init=0
Systemd=1
IsEnabled=0
IsRunning=0
NewInstall=1
HaveOverride=0
OverrideFile=""
PlexUser="plex"
PlexGroup="plex"
VideoGroup="video"
AppSuppDir="/var/lib/plexmediaserver/Library/Application Support"
PlexTempDir="/var/lib/plexmediaserver/tmp_transcoding"
LangEncoding="en_US.UTF-8"
HaveHardware=0
NeedUser=0
NeedGroup=0
NeedDirs=0
NeedVideo=0
NeedUdev=0
NeedOwner=0
Verbose=1

Moderator edit: Readability

@Technojunky, You’re installing this on Windows in the Linux compatibility layer?

Postinst returns 0 or 1 or 255. It doesn’t return 2
Of the systems you list above, which is this output from?

yes, win10 insider 18922.rs_prelease.190614-1427, in a linux/debian shell on top of WSL2

note, WSL2 may appear to support systemd, but there is no systemctl

I realize this is a completely off the wall test, but I tried it anyway.

who here wouldn’t want to run native linux pms on windows ?!? :wink:

Were we to postulate the plethora of rumors floating around… :joy:

One would want to run Linux PMS on Windows when the Linux kernel replaces the NT kernel, wouldn’t they?

LOL

As for the installer, I wonder if I should add a few ‘safeguards’ ?

from what little I read, ms may provide more support for systemd in the future, but current implementation lacks it.

as to safeguards that is up to you, i don’t really expect pms to support it, but it would be pretty cool if it did run successfully. could help with development, maybe.

i think the main gotcha on wsl is lack of linux services control, so user would need appropriate init scripts (and know where/how to use them).

You trying it was good. It showed that I needed to verify which systemctl I was using.
I’ve already fixed that and building here now in my system to test here

I’ve found a very weird case when the plex user (plex:plex) was either created incorrectly by hand or is damaged by a previous system event / app removal. I have also added that for additional resiliency.

PMS was running when I started the upgrade. If I remember correctly, service plexmediaserver status returned it running, but it was unresponsive until a restart.

Note I’ve had problems with 1.15 in the past which made me go back to 1.14, could that simply be related in something leftover in 1.16, and not related to the installer?

I have plans to go back to 1.14, I could run the 1.16 installer after to see if the same thing happens.

Harry,
Thanks for getting back to me. I don’t know why it’s not being responsive to you but I did find one situation where the installer might not restart PMS on (Ubuntu 16+, Redhat 7+). I’ve already addressed it here and will have it in the next build

If you would like to go back to 14 now and remain there until the changes I’ve made are in the next build, that’s fine. It might be best for you. I might not get a proper build until Monday

I had a working setup on Ubuntu 18.04, running Plex 1.15. After updating to 1.16, my server is no longer reachable, even though the service is marked as “active”. So I tried downgrading to 1.15 which didnt solve the problem. Then I tried installing the .deb from this topic. Installation is successful:

oot@Ubuntu-1804-bionic-64-minimal ~ # dpkg -i plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb 
(Reading database ... 64701 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.16.1.1227-7d24c1d30_amd64.deb ...
Failed to stop plexmediaserver.service: Unit plexmediaserver.service not loaded.
Failed to disable unit: Unit file plexmediaserver.service does not exist.
PlexMediaServer installer: Pre-installation Validation.  
Unit plexmediaserver.service could not be found.
PlexMediaServer installer: Pre-installation Validation complete.  
Unpacking plexmediaserver (1.16.1.1227-7d24c1d30) over (1.15.2.793-782228f99) ...
dpkg: warning: unable to delete old directory '/etc/init': Directory not empty
Setting up plexmediaserver (1.16.1.1227-7d24c1d30) ...
PlexMediaServer installer:    
PlexMediaServer installer: Now installing based on:  
PlexMediaServer installer:   Process Control:    Systemd  
PlexMediaServer installer:   Plex User:          plex 
PlexMediaServer installer:   Plex Group:         plex 
PlexMediaServer installer:   Video Group:        video 
PlexMediaServer installer:   Metadata Dir:       /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer installer:   Temp Directory:     /var/lib/plexmediaserver/tmp_transcoding 
PlexMediaServer installer:   Lang Encoding:      en_US.UTF-8 
PlexMediaServer installer:   HW transcoding:     Not found  
PlexMediaServer installer:    
PlexMediaServer installer: Completing final configuration.  
PlexMediaServer installer: PlexMediaServer-1.16.1.1227-7d24c1d30 - Installation successful.  
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
root@Ubuntu-1804-bionic-64-minimal ~ # ps aux | grep plex
root      2562  0.0  0.0  18960  1008 pts/0    S+   18:30   0:00 grep --color=auto plex

Starting the service:

root@Ubuntu-1804-bionic-64-minimal ~ # sudo service plexmediaserver start
root@Ubuntu-1804-bionic-64-minimal ~ # sudo service plexmediaserver status
● plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-06-21 18:30:56 CEST; 3s ago
  Process: 2640 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" (code=exited, status=0/SUCCESS)
 Main PID: 2642 (sh)
    Tasks: 6 (limit: 4915)
   CGroup: /system.slice/plexmediaserver.service
           ├─2642 /bin/sh -c  PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print \$2}" | tr -d \" )"  PLEX_MEDIA_SERVER_INFO_DEVICE="PC"  PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"  PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(grep ^VERSION= /etc/os-re
           └─2652 /usr/lib/plexmediaserver/Plex Media Server

Jun 21 18:30:56 Ubuntu-1804-bionic-64-minimal systemd[1]: Starting Plex Media Server...
Jun 21 18:30:56 Ubuntu-1804-bionic-64-minimal systemd[1]: Started Plex Media Server.
root@Ubuntu-1804-bionic-64-minimal ~ # ps aux | grep plex
plex      2642  0.0  0.0   4628   832 ?        Ss   18:30   0:00 /bin/sh -c  PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print \$2}" | tr -d \" )"  PLEX_MEDIA_SERVER_INFO_DEVICE="PC"  PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"  PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(grep ^VERSION= /etc/os-release | awk -F= "{print \$2}" | tr -d \" )"  LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib  "/usr/lib/plexmediaserver/Plex Media Server"
plex      2652  0.0  0.0 396948 28512 ?        Sl   18:30   0:00 /usr/lib/plexmediaserver/Plex Media Server
root      2664  0.0  0.0  18960  1088 pts/0    S+   18:31   0:00 grep --color=auto plex

However, the server is not reachable anymore according to plex web, or by going to http://ip:32400. There are also no recent lines in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log.
Do you know what happened here, or what I did wrong? Not sure if I should post it here since it may be not related to the installer. If not, I apologize and will open a new thread.

Here is the installer log file:

root@Ubuntu-1804-bionic-64-minimal ~ # cat /tmp/plexinstaller.log 
# Plex Media Server installation configuration info:  Fri Jun 21 18:30:34 CEST 2019
Init=0
Systemd=1
IsEnabled=0
IsRunning=0
NewInstall=0
HaveOverride=0
OverrideFile=""
PlexUser="plex"
PlexGroup="plex"
VideoGroup="video"
AppSuppDir="/var/lib/plexmediaserver/Library/Application Support"
PlexTempDir="/var/lib/plexmediaserver/tmp_transcoding"
LangEncoding="en_US.UTF-8"
HaveHardware=0
NeedUser=0
NeedGroup=0
NeedDirs=0
NeedVideo=0
NeedUdev=0
NeedOwner=0
Verbose=1

@kebabtent

Thanks for reporting the installer.

It does look to me like you previously had Ubuntu 14 (?) and upgraded?
Your system is in a rough spot. Even dpkg is having problems. (nothing should be trying to delete /etc/init)

As for the PMS issue, would you please create a fresh thread? What you’re experiencing is common for a lot of users.

I will, thanks for the quick response. Edit done: Server no longer reachable after updating, on Ubuntu 18.04. Feel free to remove my posts here if you want to keep this thread clean :slight_smile:

Above issue resolved; RCA: permissions in directory Plex Media Server found to be owned by root:root.

Problem resolved. Not installer related.

Sounds good to me, thanks!