Jut updated an Ubuntu 18.04 server with 1.18.5.2309 and although no errors displayed during the apt upgrade, the plexmediaserver was NOT restarted after the upgrade. I had to manually issue a this command to get it running.
sudo systemctl start plexmediaserver
Is this a known issue or should I be looking some where for a clue on what went wrong?
Sorry, but no /tmp/plexinstall.log isn’t there. I just finished two more Ubuntu 18.04 updates and they also had the identical issue, no restart of the server after the update. I also did a raspberrypi update but that one worked, the server was correctly restarted.
Hi. I’ve found and locally fixed a bug with the preinstall script not correctly parsing my override.conf
Systemd docs describe their config as “ini-style files”, so my automation uses ansible’s ini file generator to create the override.conf. Systemd handles it fine, but the new preinst does not. The problem is spaces between the key and the value, ie
The Preinstall writes /tmp/plexinstall.log at the end of the evaluation stage.
When package installation is complete, state is restored
(while in transition - force start after install is asserted)
Enable/Disable state is however observed now. I do not alter Enable/Disable state which had been previously done in older packaging. The only time I assert Enable is during a fresh installation on a new machine.
If the server was rebooted after installation and was disabled, it will not start at boot.
Can you provide me a full string of what is in that override.conf file?
I want to parse better and raise the warning if possible.
Please explain what you’re doing with the GetValue() change.
It looks like you’re relaxing the syntax check?
IMHO, which I’m happy to discuss, they may be Item-Value pairs, they don’t carry the freedom of the old Window INI files. Primary example:
Environment="PLEX_APP_SUPP_DIR=/location with spaces/here"
They follow sh syntax instead tcsh syntax AFAIK
Still, even though I didn’t detect the fault (which I should), that configuration would never have run even before, true?
Space before and after the equals sign should be ignored; the = sign is the actual delimiter.
To highlight (and perhaps improve on) the change
sed -e 's/^Environment=//' # Original file
sed -e 's/^Environment\s\?=\s\?//' # My first attempt above
sed -e 's/^Environment\s*=\s*//' # On reflection, this might be better
Previously that command was stripping out the “Environment=” from the start of lines in the override.conf file (before further processing to actually get the value after the environment variable name). But if there are spaces before or after equals, the pattern doesn’t match, so doesn’t get stripped. This messes up the subsequent processing.
\s\? matches zero or one whitespace character (apparently in the default sed mode you have to escape the standard regex ? symbol). So in this case it works for lines with or without spaces around the first ‘=’.
The \s* version does the same but also works if there are multiple spaces before and/or after the ‘=’.
The systemd overrides were working fine before (and I think still are because this is causing my apt upgrade to fail):
PlexMediaServer install: Pre-installation Validation.
grep: pi: No such file or directory
PlexMediaServer install: Error: Directory ' PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR' used in /etc/systemd/system/plexmediaserver.service.d/override.conf does not exist.
dpkg: error processing archive /var/cache/apt/archives/plexmediaserver_1.18.5.2309-f5213a238_armhf.deb (--unpack):
new plexmediaserver package pre-installation script subprocess returned error exit status 1
I like that but I also must be very careful of processing the shell variable syntax in /etc/default/plexmediaserver which is strict Name=Value (no spaces).
If spaces made their way in to an Init-based system then I wouldn’t be detecting bad customization data which I have commited to provide in this packaging upgrade.
Where is this “ansible INI” script you speak of? I ask because this is the first time I’ve heard of it. Google tells me it’s another Linux variant ?
Ah, ok. If GetValue is being used for another file type as well I guess it might not be not so straightforward.
Ansible is one of those “Infrastructure as code” frameworks for deploying/configuring machines. It’s based on python and is cross-platform. It has an INI module that I was using to generate the override.conf format for me. I can fairly easily just template the file instead if it’s going to be tricky to support with spaces.
Mainly just to learn about Ansible (I’m a software engineer). It’s probably overkill but I use it to set up and update two raspberry pis with Plex and a few other services. One for me and one for my parents. It also came in very handy to get back up and running quickly when I upgraded my raspberry pi recently.