Plexamp Fails to Load as Startup Service

I could use a little help getting my headless Plexamp install to load at boot. I have it running fine but it refuses to start unless I keep a terminal window open… which isn’t ideal. I’m on Dietpi Bullseye and everything is up to date as of today. I ran the following commands, but the service fails to load at boot. I also checked my id and I’m running as root after updating plexamp.service to match.

sudo cp plexamp.service /lib/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable plexamp
sudo systemctl start plexamp

After running each of these commands, there’s no output (which I gather is normal) and there’s no error message.

I’d be grateful for a little insight on what I might be doing wrong. Thanks!

did you chmod +x the plexamp.service file (aka make it executable)
also make sure it’s chown matches the ones already in there

try systemctl status plexamp to see if there are errors

Thanks, Warhawk. I didn’t chmod anything. Not sure how to do that?

This is the output of “systemctl status plexamp”

 root@DietPi:~# systemctl status plexamp
**●** plexamp.service - Plexamp
Loaded: loaded (/lib/systemd/system/plexamp.service; enabled; vendor preset: enabled)
Active: **failed** (Result: exit-code) since Tue 2023-04-11 03:12:26 BST; 53min ago
Process: 704 ExecStart=/usr/bin/node /home/root/plexamp/js/index.js **(code=exited, status=200/CHDIR)**
Main PID: 704 (code=exited, status=200/CHDIR)
CPU: 1ms
Apr 11 03:12:26 DietPi systemd[1]: plexamp.service: Scheduled restart job, restart counter is at 5.
Apr 11 03:12:26 DietPi systemd[1]: Stopped Plexamp.
Apr 11 03:12:26 DietPi systemd[1]: **plexamp.service: Start request repeated too quickly.**
Apr 11 03:12:26 DietPi systemd[1]: **plexamp.service: Failed with result 'exit-code'.**
Apr 11 03:12:26 DietPi systemd[1]: **Failed to start Plexamp.**

This is the ls -l of the plexamp directory, if it helps…

-rw-r--r-- 1 1001 122 213947 Feb  3 20:06 cacert.pem
drwxr-xr-x 2 1001 122   4096 Feb  3 20:06 html
drwxr-xr-x 2 1001 122   4096 Feb  3 20:06 js
drwxr-xr-x 5 1001 122   4096 Feb  3 20:11 node_modules
-rw-r--r-- 1 1001 122    267 Apr 11 03:10 plexamp.service
drwxr-xr-x 5 1001 122   4096 Feb  3 20:11 treble
-rwxr-xr-x 1 1001 122    506 Feb  3 20:06

Did you copy the directory from somewhere? Because it contain user id 1001 and group id 122, who are owning the files. But these user id’s are unknow to the system. Therefore, they are displayed as id’s and not real user/group names.

I guess your service has permission issues.

I assume 1001 is root? The files aren’t copied. It’s a virgin install on a brand new dietpi bullseye image freshly etched just for this RPi. I curled the plexamp tar file directly from Plex. The server is up and running, I just can’t get it to run as a service. If it’s a permission issue, any suggestions on how to attack it? I’m still learning how to use the CLI, so I’m hoping you don’t mind spelling commands out. Thank you!

no, user root is ID 0.
ID 1001 seems to be a custom ID, usually manually created.

from where? Do you have a link?

I don’t think the issue has anything to do with DietPi, seems to be configuration challenge for your servie. Do you following any guide to setup?

I just chowned everything in the plexamp folder to root and reran the final cp and systemctl commands… no change.

To answer your Q about installation steps- After a fresh Bullseye installation I performed the following CLI commands:

Terminal Commands:

  • sudo apt-get update && sudo apt-get upgrade
  • curl -sL | sudo -E bash -
  • sudo apt-get install -y nodejs
  • curl > plexamp.tar.bz2
  • tar -xvf plexamp.tar.bz2
  • node plexamp/js/index.js
  • Enter Plex Claim: Claim | Plex
  • node plexamp/js/index.js
  • Go to new server http://#.#.#.#:32500
  • Check cast settings
  • Quit plexamp and edit username:
    • nano plexamp/plexamp.service
  • Set Plex to run at startup as a service
    • cd plexamp
    • sudo cp plexamp.service /lib/systemd/system/
    • sudo systemctl daemon-reload
    • sudo systemctl enable plexamp
    • sudo systemctl start plexamp
  • sudo reboot

which user should execute this service? As far as I can see, service config contain user PI which is not existing on DietPi. But I guess you tried to change to user root?

Home directory of user root is not /home/root/, it should be /root/ only

BTW: the strange permission of your files are coming from the archive you download. There the owner runner and group docker are defined.

I recommend to change to the user who should run the service.

BTW: Plex (if already installed) has an own user called plex

PlexMediaServer install:
PlexMediaServer install: Now installing based on:
PlexMediaServer install:   Installation Type:   New
PlexMediaServer install:   Process Control:     systemd
PlexMediaServer install:   Plex User:           plex
PlexMediaServer install:   Plex Group:          plex

Maybe you can use this one to run your script/service.

root@DietPiR6S:~# cat /etc/passwd | grep plex
1 Like

Holy crap -

I made this change to file in lib/systemd/system and it worked.

Danke, Joulinar! I owe you a bier!

For anyone having issues getting this to work, I also had to update from buster to bullseye.


feel free to have a look to Contribute to DietPi

Always good to be on latest Debian version Bullseye. Next Debian version Bookworm is already in front of us :smiley:

Done. Thanks again for your help!

1 Like