Permission Problems on Linux Mint?

I just put Linux Mint on my desktop. I’m trying to set up my Plex server to find my media on one of my hard drives, but the folders don’t show up when I try to browse for them, and Plex says they’re empty when I type the path in manually. I searched around on this forum and it seems like it’s a permissions problem. It looks like I need to change the permissions on the folder to make it accessible to other users. I tried using chown and chmod, but I haven’t been able to get it to work yet. Can someone tell me exactly what I need to type into the terminal to fix this?

Please see Linux Tips at the top of the Linux forum

I’ve put everything you’ll need there in a couple how-to guides

I don’t see a particular how-to guide that specifically speaks to this issue, but this seems to be the closest one: forums.plex.tv/discussion/279063/using-ext-or-ntfs-drives-internal-or-external-on-linux

I did steps A and B, but I’m confused about C:

C. Create the locations where we will graft everything into Linux

The location

[root@lizum chuck]# mkdir /disks /disks/c /disks/media3 /disks/chuck2t
[root@lizum chuck]# chown -R chuck:chuck /disks

[root@lizum chuck]# ls -la /disks
drwxr-xr-x 3 chuck chuck 4096 Jul 27 11:14 .
dr-xr-xr-x. 30 root root 4096 Jul 27 11:14 …
drwxrwxrwx 4 chuck chuck 4096 Jul 27 11:04 c
drwxrwxrwx 4 chuck chuck 4096 Jul 27 11:04 chuck2t
drwxrwxrwx 4 chuck chuck 4096 Jul 27 11:04 media3
[root@lizum chuck]#

So I have to make folders for the media on my drive? The folders are already there. What does it mean to graft something into Linux? Why are you making folders called c and media3 in this example? Should I name my folders the same thing? Isn’t there a way to just relax the security on the existing folders so that Plex can access them? I tried to do that in the GUI, but as soon as I change a permission setting it changes it back. I’m assuming that’s another security feature.

Welp. That didn’t format like I wanted it to…

I did not mean to copy the procedure literally!

Before we proceed, how new to Linux are you?

Quite new. I’m looking up tutorials to figure out some of the basic terminal commands. I know enough to recognize that ls means list storage and mkdir makes folders, but not much more than that.

I read somewhere that I can use “sudo chmod -R ugo+rw *” where * is the media folder, but I did that and it doesn’t seem to help. Although, maybe I need to restart Plex. I don’t know how to do that. On Windows you can just right-click, close, and the launch again. I think you use killall in Linux? I tried “killall plex”. Didn’t work. I tried “killall plexmediaserver”. Didn’t work. I Googled around and tried “sudo service plexmediaserver restart” and I got an error.

Let’s back up.

  1. To start/stop PMS on Ubuntu - sudo systemctl stop plexmediaserver and sudo systemctl start plexmediaserver . This isn’t windows, we don’t kill processes :slight_smile:
  2. Can you describe to me what you have and what you’re trying to do a little better? what I have so far is:
  • You have USB or Internal media drives with your media on it.
  • You’re trying to setup permissions so PMS can read your media and play it.

Can you show me, by typing df at the command line so I can see them as they exist natively in the OS and point out which drives you will use for PMS?

Also, if you have preferred names you want them known as to the OS (something easy to you), please let me know?

1 Like

Yes, that is exactly right. I currently have all my movies and TV shows saved in folders on an internal platter drive. (I might save them elsewhere in the future. I have no problem moving them around, but that’s where they are at the moment.) Plex can’t seem to see any files on that drive, so I’m assuming that’s a permissions problem. (I just tried to screenshot exactly what Plex was saying when I scanned my library, but now Plex is giving me this entirely different error when I try to launch it: i.imgur.com/iJI90Gd.png)

This is what I get when I type df: i.imgur.com/SNPS0BM.png

And this is where my media is: i.imgur.com/JitMUT0.png

So that’s on the sda1 drive, which I’ve nicknamed Storage.

Robert,
Thanks for that. First, for future reference, you can copy/paste text in here as well as upload screen captures directly. It’ll save time for you and us. You’ll know the upload is complete because the forum will show a URL reference in the text. As long as you don’t damage it, the image will show. The Preview tab let’s you see what I will see. If it’s not to your liking, click Edit and change or continue on with what you’re posting.

Now, to the issue of mounting:

  1. For each of those partitions (sda1, sdb1, and sdd1), we will need to know it’s formatting. As I showed in the how-to, the blkid command gives us that info. sudo blkid /dev/sda1 (repeat for each one and keep that info handy)
  2. We will create the new mount locations for it. I will propose a location and structure. I’m doing this because Mint likes to use /media for its purposes. It is taking exclusive control of your disks. This is what’s blocking PMS from seeing them.
  3. Lastly, we’ll set file permissions for PMS to access the files but you will retain ownership

I will put a comment # after each command as my information to you. You need not type it

sudo sh
blkid /dev/sda1
blkid /dev/sdb1
blkid /dev/sdd1

# Some location away from /media that won't conflict with anything else
mkdir /disks
mkdir /disks/storage /disks/seagate /disk/1tb

# make your username the owner of these and give you owner permissions to them
chown -R robert /disks
chmod -R 755 /disks

# Now we're going to use the information from  blkid above and tell Linux what it's about to mount and how
# For each line below,  Edit the word "type" with  what blkid returned.  If it printed "ntfs",  you type   ntfs   (no quotes).  same with the 'ext' formats.  Make certain to get this right.  You can copy/paste these into the command line. Remember to fix 'type' before hitting Enter .

echo '/dev/sda1   /disks/storage         type   defaults,rw,auto,nofail  1 3' >> /etc/fstab
echo '/dev/sdb1   /disks/1tb             type   defaults,rw,auto,nofail  1 3' >> /etc/fstab
echo '/dev/sdd1   /disks/seagate         type   defaults,rw,auto,nofail  1 3' >> /etc/fstab

# let's verify /etc/fstab (the file system mount table) looks as it should.  Each disk's "Type" must match the Type output by blkid
cat /etc/fstab

# if the partition types don't match , you need to use an editor,   I recommend gedit to do this.  
# (install if needed.. it's graphical , like wordpad without the formatting )
gedit /etc/fstab   # ONLY if you need to fix any typos

# Now we will test the mounts manually
mount /disks/storage
mount /disks/1tb
mount /disks/seagate

# If any of them give errors,  the errors must be fixed  (usually just a typo)   Use "gedit /etc/fstab" from this terminal window to do that

# Presuming everything is correct,  we'll now take care of permissions (If needed)
# NTFS partitions don't have permissions that Linux understands so there's nothing to do 
# EXT partitions do

# AS EXAMPLE,  if /disks/seagate  is ext formatted,  we would do the following.  ONLY do this if it's EXT* formatted .. Do it only on those which need it
# If the others are formatted with EXT* formatting,  edit the commands below and repeat as necessary
chown -R robert /disks/seagate
find /disks/seagate -type d -exec chmod 755 {} \;
find /disks/seagate -type f -exec chmod 644 {} \;

That’s it. One time setup is done :slight_smile:

Verify this by going into PMS, Create a Library and start looking in /disks. It should find your media just as you wish :slight_smile:

2 Likes

If PMS isn’t running, let’s start it

sudo systemctl start plexmediaserver

Open http://127.0.0.1:32400/web in your browser

If it fails to respond , or gives an error, we’ll find out why.

sudo systemctl status plexmediaserver

Copy/paste that output here… we’ll figure it out

Alright, I got the Block IDs and I edited the mount table. This is what it says when I mount the drives:

(Why do my screenshots always have a green tint to them? That’s weird.) Anyway, I did the remaining steps (Seagate is ext4. The rest are ntfs.) Plex still will not open. I figured I would just uninstall it and reinstall it, but it doesn’t show up in my Software Manager, so I followed these instructions to uninstall it. I tried to reinstall and got an error:

This is what sudo systemctl status plexmediaserver yields:

Looking very good.

You must umount the drive first… Linux doesn’t allow it to be mounted twice :slight_smile:

the df command shows where it is mounted under /media

sudo umount /dev/sda1
sudo umount /dev/sdb1
sudo umount /dev/sdd1

Now proceed with the mount.

I apologize for my oversight. the hour was late here

Alright. I unmounted and remounted all the drives. That seemed to work fine. I did the type d 755 command and that seemed to work, but the type f 644 command returned a bunch of permission denied and operation not permitted errors. I retried it using sudo, just to make sure, but I got the same errors. I guess it doesn’t really matter, though, because I think Seagate is my external drive, and I don’t store any Movies or TV on there.

This is what my fstab looks like, by the way:

(Oh hey, it doesn’t have a green tint this time! I wonder why.)

Your fstab looks great.

you said there was an error?

Now that everything is mounted as it should be, we can make the final command sequence again.

You may copy/paste these into the terminal window.

sudo find /disks -type d -exec chmod 755 {} \;
sudo find /disks -type f -exec chmod 644 {} \;
chown -R robert /disks

Now they are set.

You will be able to add a library section now by finding /disks in the left pane and navigate down into your disks to the top level of where all the movies and series are located. :slight_smile:

After executing “sudo find /disks -type d -exec chmod 755 {} ;”:

When I try to mount the Storage drive:

Also, this happens when I launch Plex:

Thank you for posting that. Those filesystems which are NTFS will produce this error. There is no harm.

Now we need to find out why PMS isn’t starting.

These two commands, which you can Copy/Paste the text from the terminal session into your reply here,

sudo journalctl -xe | grep -i plex

and

sudo systemctl status plexmediaserver

What I prefer to see (which is also easier for you), will look like this:
(to do this, highlight the text in the terminal window, right-click and ‘Copy’ the text. Paste it here)

[chuck@lizum ~.104]$ sudo systemctl status plexmediaserver
● plexmediaserver.service - Plex Media Server for Linux
   Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           └─override.conf
   Active: active (running) since Mon 2018-01-08 14:14:43 EST; 2s ago
  Process: 32382 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || 
 Main PID: 32384 (Plex Media Serv)
    Tasks: 36 (limit: 4915)
   CGroup: /system.slice/plexmediaserver.service
           ├─32384 /usr/lib/plexmediaserver/Plex Media Server
           └─32404 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-a5d3466ce/F

Jan 08 14:14:43 lizum.hessen.lan systemd[1]: Starting Plex Media Server for Linux...
Jan 08 14:14:43 lizum.hessen.lan systemd[1]: Started Plex Media Server for Linux.
[chuck@lizum ~.105]$ 

Ah, I get it. Here you go:

robert@Tesla ~ $ sudo journalctl -xe | grep -i plex
[sudo] password for robert:
Jan 08 10:59:12 Tesla sudo[3225]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/apt-get purge plexmediaserver
Jan 08 10:59:20 Tesla systemd[1]: [/etc/systemd/system/plexmediaserver.service:14] Invalid escape sequences in line, correcting: “/bin/sh -c ‘/usr/lib/plexmediaserver/Plex\ Media\ Server’”
Jan 08 10:59:20 Tesla systemd[1]: Stopped Plex Media Server for Linux.
– Subject: Unit plexmediaserver.service has finished shutting down
– Unit plexmediaserver.service has finished shutting down.
Jan 08 10:59:20 Tesla systemd[1]: [/etc/systemd/system/plexmediaserver.service:14] Invalid escape sequences in line, correcting: “/bin/sh -c ‘/usr/lib/plexmediaserver/Plex\ Media\ Server’”
Jan 08 10:59:20 Tesla systemd[1]: [/etc/systemd/system/plexmediaserver.service:14] Invalid escape sequences in line, correcting: “/bin/sh -c ‘/usr/lib/plexmediaserver/Plex\ Media\ Server’”
Jan 08 10:59:20 Tesla systemd[1]: [/etc/systemd/system/plexmediaserver.service:14] Invalid escape sequences in line, correcting: “/bin/sh -c ‘/usr/lib/plexmediaserver/Plex\ Media\ Server’”
Jan 08 10:59:25 Tesla sudo[3313]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/bin/rm -rf /var/lib/plexmediaserver
Jan 08 10:59:31 Tesla sudo[3320]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/usr/sbin/userdel plex
Jan 08 10:59:31 Tesla userdel[3321]: delete user ‘plex’
Jan 08 10:59:31 Tesla userdel[3321]: delete ‘plex’ from group ‘video’
Jan 08 10:59:31 Tesla userdel[3321]: removed group ‘plex’ owned by ‘plex’
Jan 08 10:59:31 Tesla userdel[3321]: removed shadow group ‘plex’ owned by ‘plex’
Jan 08 10:59:31 Tesla userdel[3321]: delete ‘plex’ from shadow group ‘video’
Jan 08 10:59:37 Tesla sudo[3346]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/bin/rm /etc/init/plexmediaserver.conf
Jan 08 10:59:44 Tesla sudo[3348]: robert : TTY=pts/0 ; PWD=/home/robert ; USER=root ; COMMAND=/bin/rm /etc/default/plexmediaserver
Jan 08 11:00:05 Tesla sudo[3373]: robert : TTY=unknown ; PWD=/home/robert ; USER=root ; COMMAND=/usr/bin/gdebi-gtk --non-interactive /home/robert/Downloads/plexmediaserver_1.10.1.4602-f54242b6b_amd64.deb
Jan 08 11:00:14 Tesla groupadd[3395]: group added to /etc/group: name=plex, GID=132
Jan 08 11:00:14 Tesla groupadd[3395]: group added to /etc/gshadow: name=plex
Jan 08 11:00:14 Tesla groupadd[3395]: new group: name=plex, GID=132
Jan 08 11:00:14 Tesla useradd[3399]: new user: name=plex, UID=124, GID=132, home=/var/lib/plexmediaserver, shell=/bin/bash
Jan 08 11:00:14 Tesla usermod[3404]: change user ‘plex’ password
Jan 08 11:00:14 Tesla chage[3409]: changed password expiry for plex
robert@Tesla ~ $ sudo systemctl status plexmediaserver
sudo: systemctl: command not found
robert@Tesla ~ $

Oops, forgot to preview instead of post. Looks like it didn’t format right. But you get the idea.

Where did you get the installation / setup instructions from?
There should be NO /etc/systemd/system/plexmediaserver.service file. (I wrote and maintain that installer)

The default file, as distributed, should only exist in /lib/systemd/system/plexmediaserver.service