User does not change

server-raspberry-pi

#1

I have been trying to get plex to work on my raspberry pi. I have followed the instructions here: https://thepi.io/how-to-set-up-a-raspberry-pi-plex-server/
It works great up until where I need to change permissions. I need to change the permissions because the hard drive that is hooked up to it is owned by pi. However when I change the user to pi and restart the service. It does not ever run plex media server as pi, only as plex.
I need help, thank you in advance. I can't find anything helpful online.


#2

@uglymagoo can help you better but that procedure was obsoleted over a year ago when systemd related init as pid 1.

I have created Linux Tips for help with such things as you wish to do now. https://forums.plex.tv/categories/linux-tips

Of specific interest to you is customizing your Plex configuration. https://forums.plex.tv/discussion/286395/customizing-your-plex-configuration


#3

Thank you so much for your help. I have followed the instructions in the customizing your plex configuaration page, and I have made progress with my plex server. It now starts a few of the processes as pi, but a few of the processes that were running when it was under plex are not there. I cannot see the server from the browser. It starts /usr/lib/plexmediaserver/plex media server, but it does not start the plex plug-in, plex dlna server, plex tuner service, or a second second plex plug-in.
I only know this because if I change it back to plex, those are the processes that start running. When I change it back to pi, I only get one.
I am assuming it has something to do with permissions, but I don't know on what. Do you have any suggestions for me?
I really appreciate your help. I actually feel like I am learning a lot about linux and what goes into a server.


#4

do you have enough functionality to get the Plex logs from PMS? (settings - server - help - download logs)

if not, /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs contains everything I might need in addition to

sudo journalctl -xe | grep -i plex


#5

I do not have enough functionality to download the logs, and /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs is empty. However, this is my journalctl output:

Although I just thought of something that might be it. You said that the article I followed was obsoleted a year ago. Is there a new way I should install on a raspberry pi? I looked at the installation page, and it is ubuntu based, but it is 32bit instead of 64bit. Is there a newer set of instructions I should I to try and install on a raspberry pi?


#6

You can't run PMS as user root

Dec 29 18:54:52 frandsenplex sudo[1011]: pam_unix(sudo:session): session closed for user root
Dec 29 18:55:05 frandsenplex sudo[1038]: pi : TTY=pts/0 ; PWD=/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs ; USER=root ; COMMAND=/bin/journalctl -xe
`


#7

Show me your /etc/systemd/system/plexmediaserver.service.d/override.conf please ?


#8

Of coarse!! I really can't thank you enough. I have spent upwards of 15 hours trying to get this to work.
```

Customize Plex's config

Identify this as a service override

[Service]

Move the data directory

Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/plexdir/Library/Application Support"

These values are only needed if you wish to change user & group

User=pi
Group=pi

This is needed to change the default umask

UMask=0002 # this must be 4 digits of octal

From what I understand(which isn't much because I am still a noob) I thought pi is just a normal user, and not root. I don't really understand how I am trying to start it up as root...

**Moderator Edit:  Used triple-grave on  preceding and succeding lines for formatting**

#9

Sorry for the weird formatting on the last comment.


#10

I have corrected the formatting for readability.

Once you've made the edit, as I instruct in the how-to

  1. sudo systemctl daemon-reload (tell systemd you've made changes)
  2. sudo systemctl restart plexmediaserver ( restart PMS)

note:

Before restarting:

  1. Stop PMS
  2. Change file & directory ownership 3 Now restart PMS through systemd

#11

You were right, I had to change the permissions and ownership of the override file. I also had to change the ownership of the /var/lib/plexmediaserver folder. After that, it all started up perfectly. I am so grateful for your help. I am amazed at how quickly you responded and how helpful you were. Thank you.


#12

I'm glad everything is working for you and that I could help.

I do my best to respond quickly but sometimes life does get in the way . haha

For future reference, /etc/systemd/system and all the files underneath it are owned by root. Only those in the Plex related directories (e.g. /var/lib/plexmediaserver and below need ownership changed to that of the new username (owner)


#13

Generally, what is the benefit of changing the plex user from plex to pi?
I did it just because the tutorials told me and it worked.
Now after loosing some time to learn how it works with systemd I started thinking about it.


#14

@aamzr said:
Generally, what is the benefit of changing the plex user from plex to pi?
I did it just because the tutorials told me and it worked.
Now after loosing some time to learn how it works with systemd I started thinking about it.

There is no benefit and the third party tutorials are doing it wrong. Neither the official Plex Linux guides nor my “official” Pi guide tell you to do something like that :slight_smile: It’s just that most tutorials on the net are written by people, who do not know what they are talking about :slight_smile:


#15

EDIT: Sorry, going to post a new topic when I’ve done more research. Sorry for necroposting to this old thread!


#16

@moviebrain If your external drive uses ext3/ext4 or any other Linux file system, then I have a nice and clean solution for you: Just create the directory “Plex Versions” at the top of your corresponding library directory and make it owned by plex (e.g. mkdir "Plex Versions" && sudo chown plex:plex "Plex Versions"). Then select the appropriate “Versions storage location” when creating optimized versions, i.e. not “in folders with original items”.

https://support.plex.tv/articles/213095317-creating-optimized-versions/

If your drive is FAT32 or NTFS you might have to change the mount options in /etc/fstab. Please tell us about your current fstab entry for your external drive.


#17

Thank you @uglymagoo wow, of course it would be that easy :slight_smile: my brain doesn’t always completely understand permissions. Thanks for your hard work :slight_smile: it works flawlessly!

Yep, it’s ext4, and making the one folder world-readable but writable only to plex is so very clean! I sometimes forget that the things highly restricted users write can still be read by the admin user too!