[HOWTO] Fix Plex Media Server Update 0.9.12

Recent Plex Media Server update contains erroneous script which brings package management on some systems to non-working state. On my system the original issue looks like this:

The update leaves Plex Media Server in a working state since previous installations did the job this one can’t. The added bonus though is that package managers like apt-get and dpkg cease to fullfil their duties and it’s something not generally desirable.

The issue is relevant to Linux Mint 15+ and may also be relevant to Ubuntu 15.04 but I haven’t tested the latter specifically. The fix involves removing erroneous package, fixing it’s contents and reinstalling to get Plex and package managers to working state again.

Analysis

The key error message line is

It tells us that systemctl command referred to by the package’s postinst script cannot be found. This is no wonder since systemctl is a part of systemd service manager which is not used on Linux Mint 15+ and on Ubuntu 15+. These OSes use upstart instead. The reason postinst script tries to call that command is an erroroneus OS version detection approach. Here is what offending part of Plex Media Server 0.9.12 postinst script looks like:

The key line is

It tries to detect whether systemctl is available by looking at OS name (which apparently is not a very good idea). On systems besides Ubuntu this can result in an arbitrary value compared to 14 (on my Linux Mint 17 it is, well, 17). This leads the script into an incorrect branch, where it tries to call non-existing systemctl, raises error and leaves package management in non-working state.

Fix

Note: This will not affect your Plex Media Server library or configuration. Probably. At least it didn’t affect mine. You’ve been warned.

1. Remove the offending package

Try removing the package with usual means first:

This will likely result in similar error which actually is the manifestation of package manager unable to work around this issue:

What we have to do is to manually delete the package files which prevent dpkg from doing it’s work.

Navigate to dpkg package directory

Remove files relevant to erroneous plexmediaserver package

Purge remainings of erroneous plexmediaserver package from the system

At this point package management should be fixed. Your usual sudo apt-get upgrade should work well.

2. Fix erroneous script in plexmediaserver package

Navigate to the directory where your downloaded plexmediaserver_0.9.12.0.1071-7b11cfc_amd64.deb is located, suppose it’s ~/Downloads

Create a temporary directory for package contents

Unpack the plexmediaserver_0.9.12.0.1071-7b11cfc_amd64.deb package to the temporary directory

Open the ./tmp/DEBIAN/postinst script with your favorite editor and make this change

The goal here is to make script skip the part with

and make it run this part instead

so feel free to otherwise modify the criteria or drop the condition altogether and just make it run the right part.

Repack the temporary directory to a fixed package

At this point you got an installable Plex Media Server package, so let’s go ahead and install it.

3. Install fixed plexmediaserver package

Make sure Plex is up and running

That’s it. Now grab some food and watch some movies 🙂

6 Responses to “ [HOWTO] Fix Plex Media Server Update 0.9.12 ”

  1. Hi Nic, Thanks for the great explanation and fix. I seem to get stuck repacking the package where it just hangs. Any idea why that would be?
    Cheers

    • Hey Marcus, sorry for the late reply. I’m sure you’ve already figured out this issue but if not, post some of the console output you’re getting.

  2. Hi, i have the same error on ubuntu 15.04, the change you’ve made (17 for 14) it is the same i have to do in ubuntu? Regards.

  3. Those lines do not exist in the new version and the problem still exists

Leave a Reply