I’ve just upgraded from 1.14.1.5488 to 1.15.0.659, and got this error during the installation of the new package:
Installing new version of config file /etc/init/plexmediaserver.conf ...
Created symlink /etc/systemd/system/multi-user.target.wants/plexmediaserver.service → /lib/systemd/system/plexmediaserver.service.
Job for plexmediaserver.service failed because the control process exited with error code.
See "systemctl status plexmediaserver.service" and "journalctl -xe" for details.
**dpkg:** error processing package plexmediaserver (--install):
installed plexmediaserver package post-installation script subprocess returned error exit status 1
After the installation, my server wouldn’t restart and after a bit of digging I realised that 1.15 had installed a systemd init script which was running instead of the upstart one that had been used previously.
Presumably as a result of this it was expecting the library location to be /var/lib/plexmediaserver, rather than /var/lib/plex (which is where my library lived).
To fix this I moved the /var/lib/plex to /var/lib/plexmediaserver and all seems to be well, and lastly deleted /etc/init/plexmediaserver.conf and /etc/default/plexmediaserver to tidy up.
I’m raising this here firstly as a resource for anyone else who has a similar problem, but also because this sounds like a bug in the deployment scripts for 1.15.0.659 - this situation would ideally be handled more gracefully.
PS. While I’m here, I want to say thanks for an amazing bit of software. I’ve been a plex user since at least 2011 (based on the timestamps of my plex dirs), and it’s grown to be a system that my family use every day. I particularly love the syncing to iOS devices which means I can download something overnight and have it automatically sync to my iPad to watch on the train to work the next morning. Kudos!
As of Ubuntu 16, PMS has always used systemd because it is the Ubuntu 16 default.
First, the default location is /var/lib/plexmediaserver (Plex’s home directory)
Second, /etc/init/plexmediaserver.conf is not used in a systemd environment. nor is /etc/default/plexmediaserver
The default, and supported, means to customize Plex on a systemd system is via /etc/systemd/system/plexmediaserver.service.d/override.conf
Hi Chuck,
Thanks for replying. Actually, when I check more thoroughly I see you’re right that Plex has enabled systemd for some time (although the deb file does still contain both upstart and systemd scripts). However, up to around 0.9.16 the systemd script was installed in /etc/systemd/system/plexmediaserver.script:
Although later versions installed the script to /lib/systemd/system, the /etc/systemd/system/ one was never deleted, so it continued to be used in preference to the /lib one. That was true until 1.15.0, which deletes /etc/systemd/system/plexmediaserver.conf, meaning any customisations in there are lost. This, it seems, was the cause of my problem, since I must have been the one to add this line to /etc/systemd/system/plexmediaserver.conf, which was removed when I installed 1.15.0.659:
EnvironmentFile=-/etc/default/plexmediaserver
Compare and contrast:
$ wajig listscripts plexmediaserver_1.14.1.5488-cc260c476_amd64.deb | grep -C 10 "systemctl enable"
# Automatically added by dh_installini
if [ -f /proc/1/comm ]; then
if [ "`cat /proc/1/comm`" = "systemd" ]; then
rm -f /etc/init.d/plexmediaserver
# Initiate config consolidation and pull overrides into the correct location.
# if [ ! -f /usr/lib/plexmediaserver/.migrated ]; then
# /usr/lib/plexmediaserver/MigratePlexServerConfig.sh
# Add migrated check file
# touch /usr/lib/plexmediaserver/.migrated
# fi
systemctl enable plexmediaserver.service
systemctl start plexmediaserver.service
else
if [ -e "/etc/init/plexmediaserver.conf" ] && [ "`cat /proc/1/comm`" = "init" ] && [ -f /sbin/start ]; then
# start fails if already running
start plexmediaserver || :
fi
fi
fi
# End automatically added section
$ wajig listscripts plexmediaserver_1.15.0.659-9311f93fd_amd64.deb | grep -C 10 "systemctl enable"
echo "##################################################################"
echo
fi
# Automatically added by dh_installini
if [ -f /proc/1/comm ]; then
if [ "$(cat /proc/1/comm)" = "systemd" ]; then
rm -f /etc/init.d/plexmediaserver
rm -f /etc/systemd/system/plexmediaserver.service
systemctl enable plexmediaserver.service
systemctl start plexmediaserver.service
else
if [ -e "/etc/init/plexmediaserver.conf" ] && [ "`cat /proc/1/comm`" = "init" ] && [ -f /sbin/start ]; then
# start fails if already running
start plexmediaserver || :
fi
fi
fi
# End automatically added section
I see why it may have caused difficulties to have old files left over in /etc from earlier installs, but since /etc/systemd/system is intended for user-defined files, it seems unfriendly to just delete a file from there without warning.
I had no time for fiddling so I went back to plexmediaserver_1.14.1.5488-cc260c476_amd64.deb on my Debian server. But thx Andrew, now I have a clue what to do if I intend to upgrade. And same as you I feel this as a bug, every previous upgrade was smooth for me, until plexmediaserver_1.15.0.647-67e950f12_amd64.deb and then plexmediaserver_1.15.0.659-9311f93fd_amd64.deb - both failed for me…
Ubuntu 16+ is about to become the minimum. I am working with management now about when & how this is communicated as well as when the date should be set. Plex doesn’t publish roadmaps but this might be the exception. That’s why it’s being discussed and why I am mentioning here as a courtesy.
Ubuntu 15 with Upstart was a mistake on their part… They knew it and immediately, with 16.04, discontinued it in favor of systemd like everyone else.
On OpenSuSE, init is no longer supported. This means OpenSuSE 15+ is required.
Fedora has been systemd since Fedora 16 (now at 28) so no changes there.
Ubuntu changed to systemd three years ago.
It’s not reasonable or possible to maintain support for everything forever in the computer field. Everything evolves. The biggest reasons are the runtime libraries themselves. Over time, as newer technologies are released, older technologies and methods are deprecated and eventually removed.
My best advise to you is Upgrade to 16 or better now. You will be happier and better off for it.
When I do implement the changes, I can guarantee full compatibility with Ubuntu 16+ systemd.
As for your cleanup issues,
systemd uses /etc/systemd/system/plexmediaserver.service.d/override.conf . Placing a full plexmediaserver.service file there is a full unit-override and, per the systemd specfiication, leaves the user vulnerable and isolated from the normal update process.
I did my best to clean up all those extra files. You found a case where I missed some. See the need for standardization?
I will gladly help you make the transition to a full systemd system with your customizations properly in place and be running the new PMS 1.15 and above versions. A lot of work went into 1.15.0 . You’ll be glad when you do get to see it.
Why are you releasing a version that is going to break a lot of installs in a point release? People going from 1.14 to 1.15 are not going to be expecting a change to the fundamental way that Plex runs. Additionally, sysv OS’s (RHEL/CentOS 6 being big ones) are not EOL for another 2 years. Why is this happening?
Does this mean that in the future the it will no longer be possible to “repack” (for lack of a better term) the PMS for systems using sysvinit (eg Devuan)?
Hi Chuck,
I’m not sure how much of your reply is intended for me, but for clarity:
I’m already on Ubuntu 18.04
Mentioning upstart in my original post was a musdiagnosis on my part, the real problem was the unexpected deletion of a config file (specifically /etc/systemd/system/plexmediaserver.conf)
I relatively quickly fixed the upgrade problem I had by just moving /var/lib/plex to /var/lib/plexmediaserver, and I’m now happily running plex 1.15.
The only real complaint that I have is that the upgrade script would, without warning, delete a file that lives in an area typically used for user customisations. In an ideal world, something like the standard conflict resolution options in deb upgrades (“Your file differs from the package maintainers version; keep, install or diff”) would have been presented.
I appreciate that edge cases like this are often hard to anticipate though, and this issue is perhaps only noteworthy because plex upgrades are normally so smooth.
The only file I needed to remove this one time only is /etc/systemd/system/plexmediaserver.service and was a leftover from Ubuntu’s initial mistakes deploying systemd. I had to get control of that for everyone’s sake.
Since Aug 2016, I have been deploying to /lib/systemd/system/plexmediaser.service
and putting customizations in /etc/systemd/system/plexmediaserver.service.d/override.conf which is as defined by the systemd specification.
I do not touch the contents of that override.conf file.
This works for everyone because there are certain restrictions. The startup variables and other major service control flags are maintained in /lib
You can specify any of the variables I specify here
Plex has offered server downloads for years for RHEL/CentOS. There was never a version specified until very recently when version 7 was thrown in there. All previously released RPM’s for RHEL/CentOS have worked perfectly fine with sysv with zero customization required.
I don’t understand this stance coming from Plex. I paid for a lifetime subscription and now a point release is going to block me from ever updating my server again which has worked this way for many years unless I clean install my box?! Sorry, that is a bit crazy and I have never seen any other software package do this in a point release. My box does a lot of things, wiping it to switch OS’s is not a small effort.
Sorry if I’m mixing topics here, I don’t mean to distract from OP’s thread. I just find this to be a surprising change of course from how Plex has always been offered in the past.
I will apologize as the hour is late (01.03am) as I write, I’m still helping folks long after normal business hours, and it has been an incredibly long week for me.
My prose are not the best and I am clearly not well rested.
I willl gradly take this up on Monday in a separate thread and speak in more intelligent prose.
Hi ChuckPA, hope you had long enough weekend with sufficient amount of HQ sleep I just wanted to mention that my Debian is Jessie and systemd based too, had no time to dig more, my family is soooo Plex dependant that I can afford no outage will let you know soon if my issue is same like Andrews. Take care