Dpkg error 1 - ubuntu server

Server Version#:1.26.2.5797 → cannot upgrade to 1.27.2.5929
Player Version#: N/A

I am in dpkg hell - have tried so many “solutions” and still stuck.

Error:
PlexMediaServer install: Pre-installation Validation complete. Errors: 0, Warnings: 1
dpkg: error processing archive /var/cache/apt/archives/plexmediaserver_1.27.2.5929-a806c5905_amd64.deb (–unpack):
new plexmediaserver package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/plexmediaserver_1.27.2.5929-a806c5905_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

What have I tried:
sudo dpkg --configure -a
sudo apt install -f

No luck.

Then
sudo apt remove --purge plexmediaserver
sudo ls -l /var/lib/dpkg/info | grep -i plexmediaserver
sudo mv /var/lib/dpkg/info/plexmediaserver.* /tmp
sudo apt update

sudo apt install plexmediaserver

Still the same error.

I even edited the dpkg status list:
sudo nano /var/lib/dpkg/status

Plex entries:
Package: plexmediaserver
Status: install ok not-installed
Priority: optional
Section: video
Architecture: amd64

I have changed the second line to:
Status: install ok installed

Because it is installed and running :slight_smile:

I really don’t want to reinstall Plex, and rebuild the database - there is a lot of music on it and it took me a great deal of time to get all the albums correct in the database

The version I have runs just fine, but I would like to receive the updated functionality when it arrives.

Anyone having a pointer to what I should be doing next?

Please go get the file /tmp/plexinstaller.log and share it here.

I will look and see what if anything there provides a clue.

Have you run out of space in /tmp or the root partition where DPKG unpacks?

Thanks @ChuckPa - I appreciate the help

  1. /tmp folder does not hold a plexinstaller.log file - :frowning:
  2. the root partition has 190 GB free space

I tried: sudo find / -iname plexmediaserver.log - it rendered no result

OK, we need to do some hard work.

  1. Get the DEB file and put it in its own subdir in your home directory and get into it.
  2. ar x name_of_package.deb to extract the components
  3. You’ll see control.tar.gz
  4. tar xf control.tar.gz to pull out the scripts
  5. Now you’ll find the preinstall script
  6. Preinstall is inventory only so there is no harm running it.
  7. sudo ./plexmediaserver.preinst
  8. it’ll spit out the errors & line number where it complains.

Please relay that info to me.

If you’ve got an 11th or 12th gen CPU then I know what the problem is.
“Illegal number” or similar error on an IF ([ xxxx -gt something ] )

Thanks again @ChuckPa

I folowed the instructions - note that plexmediaserver.preinst would not run, but there was an executable named preinst… so I ran sudo ./preinst

Here is the output

PlexMediaServer install: Pre-installation Validation.
PlexMediaServer install: Systemd configuration error detected:
PlexMediaServer install: File “/etc/systemd/system/plexmediaserver.service” is leftover from an earlier Debian/Ubuntu bug.
PlexMediaServer install: Please transfer any customizations (APP_DIR, User, Group, TMPDIR, and/or UMask) to a proper “/override.conf”
PlexMediaServer install: and reinstall.
PlexMediaServer install: Unit override “/etc/systemd/system/plexmediaserver.service” found.
PlexMediaServer install: Only “/etc/systemd/system/plexmediaserver.service.d/override.conf” is supported.
PlexMediaServer install: Warning: “/var/lib/plexmediaserver/Library/Application Support” isn’t owned by “plex”, UID: 998. Found “matt”, UID: 1000 instead. Continuing.
PlexMediaServer install:
PlexMediaServer install: Pre-installation Validation failed.
PlexMediaServer install: Configuration information discovered:
PlexMediaServer install: Installation Type: Update
PlexMediaServer install: Process Control: systemd
PlexMediaServer install: Plex User: plex
PlexMediaServer install: Plex Group: plex
PlexMediaServer install: Video Group: render
PlexMediaServer install: Metadata Dir: /var/lib/plexmediaserver/Library/Application Support
PlexMediaServer install: Temp Directory: /dev/shm (set in Preferences.xml)
PlexMediaServer install: Lang Encoding: en_US.UTF-8
PlexMediaServer install: Processor: i7-6700
PlexMediaServer install: Intel i915 Hardware: Found
PlexMediaServer install: Nvidia GPU card: Not Found
PlexMediaServer install:
PlexMediaServer install: Pre-installation Validation complete. Errors: 0, Warnings: 1

Could this line: “/var/lib/plexmediaserver/Library/Application Support” isn’t owned by “plex”, UID: 998. Found “matt”, UID: 1000 instead. Continuing." be the culprit?

Thanks,

Matt

Matt,
The error is just above that.

PlexMediaServer install: Systemd configuration error detected:
PlexMediaServer install: File “/etc/systemd/system/plexmediaserver.service” is leftover from an earlier Debian/Ubuntu bug.
PlexMediaServer install: Please transfer any customizations (APP_DIR, User, Group, TMPDIR, and/or UMask) to a proper “/override.conf”
PlexMediaServer install: and reinstall.

You have the Unit Override file in /etc/systemd. I can’t support that because it conflicts with /lib/systemd/system/plexmediaserver.service.

What I do support is the official Service Override in /etc/systemd/system/plexmediaserver.service.d/override.conf

The installer message is telling you what to do – Take your customization variables and put them in a proper override.conf then delete the full unit override.

Details are here :slight_smile:

Thanks @ChuckPa

That is very interesting - especially since I did not do any customisation on this (trust me, I would not know how, let alone why! :slight_smile: )

I will see if I understand how to fix this - and post my steps.

@mattkoop

Easy-peasy :smiling_imp:

Please show me the contents of /etc/systemd/system/plexmediaserver.service.

From there, I’ll help you sort it out.

thanks again !

There will be no surprise with the damage unwitting fingers can do if controlled by an inexperienced mind :slight_smile:

Here is the requested data:

[Unit]
Description=Plex Media Server for Linux
After=network.target

[Service]
Environment=“PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support”
Environment=PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
Environment=PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
Environment=PLEX_MEDIA_SERVER_TMPDIR=/tmp
Environment=LD_LIBRARY_PATH=/usr/lib/plexmediaserver
Environment=LC_ALL=en_US.UTF-8
Environment=LANG=en_US.UTF-8
ExecStartPre=/bin/sh -c '/usr/bin/test -d “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” || /bin/mkdir -p "${PLEX_M>
ExecStart=/bin/sh -c ‘/usr/lib/plexmediaserver/Plex\ Media\ Server’
Type=simple
User=matt
Group=matt
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

Note - I had changed both User and Group to plex (from matt). After that Plex Media Server simply would not start.

plex as the group does have read/write access to the media server folder and subfolders

The mud is clearing up, but cannot yet see the bottom of the pond

Regards

Matt

:rotating_light:

So you did make a customization! :rofl:

  1. /etc/systemd/system/plexmediaserver.service is either left over from a non-upgraded PMS installation for Ubuntu 16
    -OR-
  2. “Inexperienced hands” unwittingly following some “Internet Expert’s” advice ,

:slight_smile:

  1. Here’s how we fix this. (You’ll laugh)
sudo bash
systemctl stop plexmediaserver  (it should already be stopped)
rm /etc/systemd/system/plexmediaserver.service     <-  this is the No-No
mkdir /etc/systemd/system/plexmediaserver.service.d

Now, using your favorite text editor (I like gedit or vi), and still in sudo bash mode,

gedit /etc/systemd/system/plexmediaserver.service.d/override.conf

In that file, we create the following (if you still want to run as user matt:matt

#
[Service]
#
# Change plex to run as user 'matt'
#
User=matt
Group=matt
  1. Save the file

  2. Tell systemd that the service files have changed
    systemctl daemon-reload

  3. Restart Plex
    systemctl start plexmediaserver

Please let me know if:

  1. You still want to run as user matt:matt
  2. If ls -la "/var/lib/plexmediaserver/Library/Application Support" shows the files and directories owned by plex:plex or matt:matt

The unwitting hands strike again… but this time guided by someone who actually knows what he is doing…

SUCCESS! :smiley:

I did need to update /var/lib/dpkg/status file to include Version and Description in the plexmediaserver entry - once that was done, the program update completed without a hitch.

As for the customisation - think when I just installed it, I may have (read: had - as nobody else would have) given ownership to me - unwitting fingers and all…

Thanks a bunch @ChuckPa ! I am really grateful for your persistence in solving this puzzle.

I hope this trail is useful to others with the same issue.

:see_no_evil:

:rofl:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.