# Dpkg error 1 - ubuntu server

**URL:** <https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [July 23, 2022, 3:29am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738 "2022-07-23T03:29:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 23, 2022, 3:29am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/1 "2022-07-23T03:29:58Z")

</div>

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 🙂

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 23, 2022, 5:13am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/2 "2022-07-23T05:13:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 24, 2022, 1:48am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/3 "2022-07-24T01:48:26Z")

</div>

Thanks @ChuckPa - I appreciate the help

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

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 24, 2022, 2:21am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/4 "2022-07-24T02:21:18Z")

</div>

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]` )

---

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 24, 2022, 5:49am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/5 "2022-07-24T05:49:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 24, 2022, 1:52pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/6 "2022-07-24T13:52:11Z")

</div>

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 🙂

> [@Linux Tips](https://forums.plex.tv/t/linux-tips/276247/3):
>
> Customizing your Plex configuration on systemd based systems This information is intended for those systems where cat /proc/1/comm returns systemd. On systems which use Systemd (Ubuntu 16+, Fedora, Centos 7, Debian 8,) you create this customization file which SystemD reads prior to launching PMS. This file is independent of the default configuration and service control mechanisms in /lib/systemd/system/plexmediaserver.service. Your customization override is preserved across updates, uninstal…

---

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 24, 2022, 9:42pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/7 "2022-07-24T21:42:50Z")

</div>

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! 🙂 )

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 24, 2022, 9:55pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/8 "2022-07-24T21:55:35Z")

</div>

@mattkoop

Easy-peasy 😈

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

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

---

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 25, 2022, 7:01am UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/9 "2022-07-25T07:01:22Z")

</div>

thanks again !

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

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 25, 2022, 1:45pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/10 "2022-07-25T13:45:49Z")

</div>

🚨

> [@mattkoop](#):
>
> User=matt  
> Group=matt

So you did make a customization! 🤣

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 ,

🙂

1. Here’s how we fix this. (You’ll laugh)

```auto
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,

```auto
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`

```auto
#
[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`

---

<div class="post-metadata">

**Author:** ![mattkoop](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mattkoop](https://forums.plex.tv/u/mattkoop)\
**Post date:** [July 25, 2022, 10:21pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/11 "2022-07-25T22:21:13Z")

</div>

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

SUCCESS! 😃

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [July 25, 2022, 11:11pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/12 "2022-07-25T23:11:39Z")

</div>

> [@mattkoop](#):
>
> There will be no surprise with the damage unwitting fingers can do if controlled by an inexperienced mind 🙂

> [@mattkoop](#):
>
> 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.

🙈

🤣

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [October 23, 2022, 11:11pm UTC](https://forums.plex.tv/t/dpkg-error-1-ubuntu-server/801738/13 "2022-10-23T23:11:43Z")

</div>

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