40

I am attempting to turn an older PC into a home media server with Ubuntu 12.04 using Plex Media Server. I have a newer WD 2 TB external USB HD with all of my media on it.

I can not for the life of me figure out why Plex will not recognize the files on this hard drive. It shows the external as there, Ubuntu shows the files and allows me to play them, view them, etc. Plex shows the name "External".

But when I click it, it is 100% empty and shows nothing to add. I can access the files on the external through file sharing just fine, on my windows computers but would love to be able to use Plex for streaming with our Roku.

I am fairly new to Ubuntu, I have used Plex with the same HD on Windows and it worked fine. I have read multiple articles on this and nothing seems to be doing the trick.

How can I solve this?

grayed01
  • 409

18 Answers18

50

You have to make sure that the user plex has access not only to the drive, but the folder that the drive is mounted in. After a lot of tinkering I wound up going this route:

Edit the Mount Options (Disks -> "More Actions" (the two gears under the "Volumes" map) -> Edit Mount Options) such that:

nosuid,nodev,nofail

is in the area for storing the options in the /etc/fstab file (the textbox under "Symbolic Icon Name")

and set the Mount Point to be:

/media/<user>/<HDD Name>

and remount your HDD so that it will appear in the specified location.


Next, add yourself to the plex user group by going to the Terminal and enter:

sudo adduser "$USER" plex

Now, you can modify the ownership of the relevant files and directory so that they are owned by ${USER}:plex. You can give plex read-access to the drive by going to the Terminal and enter:

sudo chgrp plex "/media/${USER}/"
sudo chmod g+rX "/media/${USER}/"

sudo chgrp plex "/media/${USER}"/<HDD Name>/ sudo chmod g+rX "/media/${USER}"/<HDD Name>/

It may also be necessary to ensure that ACL permissions are properly configured, so the following might also be necessary:

sudo setfacl -m g:plex:rx /media/<user>/

FYI: If a file/directory displays a + symbol as part of its permissions (e.g. drwxr-xr-x+) that means that ACL controls are active for that file/directory.


Now that Plex has access to the drive, you need to make sure that it has access to all files in the relevant directories. This can be done by repeating the following for all of your media library folders:

chmod -R g+rX /media/<user>/<HDD Name>/<Library Folder>

This solved my issues for the two extra drives I've added to my HTPC. Hope it helps.

PS: As @douggro mentioned, Plex has a good article on the subject, but they changed up the structure of their site, so it took me a while to find it from his link, so here's a more current link to the page: Plex Linux Permissions Guide

Sam
  • 1,184
22

As several people have mentioned, the issue is likely due to the plex user not having the correct permissions. I had a similar problem, and was able to fix it using a few easy steps.

Open this config file:

sudo nano /etc/default/plexmediaserver

Find this line:

PLEX_MEDIA_SERVER_USER = plex

Replace plex with your username, and save the file. Once I restarted my computer, Plex was able to access the folders on the external drive.

You may be able to run sudo mount -a and/or sudo service plexmediaserver restart instead of rebooting.

Credit: htpcguides.com

dnlbrky
  • 329
11

I don't know what's going on, but the only thing that helped me with ext4 drive was setting in "Disks" app "Automatic Mount Options" - "OFF" and setting "Mount Point" "/mnt/foobar" instead of "/media/username/foobar".

janot
  • 1,790
10

You need to configure fstab to set the proper permissions.

There is a whole page about how to do this on the Plex site, see: https://support.plex.tv/hc/en-us/articles/200288606-Mounting-NTFS-Drives-on-Linux

To make it short:

  • Find the UUID of your drive:

    sudo blkid | grep ntfs

  • create a directory where you will mount the drive:

    sudo mkdir /media/ext_NTFS_USB_Drive

  • edit file /etc/fstab with command:

    gksu gedit /etc/fstab

  • add a line to this file and save.

    UUID=485CBF485CBF3014 /media/ext_NTFS_USB_Drive ntfs-3g permissions,auto 0 0

    where the UUID is the one your drive and the mount point is the folder you created.

  • now mount the drive:

    sudo mount /media/ext_NTFS_USB_Drive

    (you might get an error saying the drive is already mounted, in Nautilus for example. Just unmount it - Safely Remove Drive, or click the Eject Icon in Nautilus)

Now in Plex, you need to change the location of the media folder you were trying to add to somewhere inside: /media/ext_NTFS_USB_Drive

7

Try adding Plex to the plugdev group.

Open a terminal (Press ControlAltT) and enter

sudo gpasswd -a plex plugdev

Verify that plex was added to the plugdev group by entering:

groups plex

which should display what groups plex belongs too. Next, reboot the computer and start plex to verify this corrected the problem.

James
  • 17,576
  • 5
  • 25
  • 38
5

It's the folder mount point of your extern hdd that's giving trouble.

It hasn't got the right rights, the easiest way to change this without terminal commands except opening nautilus as root goes as follows:

open nautilus with sudo:

sudo nautilus (or any other system browser opened with root)

hover over your extern hd with the mouse arrow to see the full path of your hd, or click on it and then press Ctrl+l to see the full path in the adress bar.

example: /media/nick/extern_hdd1

extern_hdd1 is mounted to the folder nick, go to media to change the permissions of the folder nick, to do this press ctrl+l and paste /media/ in the address bar or browse to media manually.

right click on the folder nick go to properties and change the following:

Owner : nick (in your own case your own user name) Folder access : Create and delete files File Access : ---

Group : plugdev Folder Access : Access files File Access : ---

Others Folder Access : Access files File Access : ---

That's it!

Nick
  • 51
3

Maybe this was different back when posted ;Using ubuntu 18.04 lts; had to run

sudo systemctl edit plexmediaserver

Added 2 lines there

[Service]
User=user-that-can-access-media-mount
Group=group-of-user-above

Then sudo chown -R user-that-can-access-media-mount:group-of-user-above /var/lib/plexmediaserver

Then restarted the server

sudo service plexmediaserver restart 
Pete_ch
  • 131
2

It is most likely a permissions issue with Plex. Read this page for info on Plex permissions. Also consider creating a folder on the external dedicated to your media then creating a mount point for it in your fstab entries, mounting it as the user plex.

janot
  • 1,790
douggro
  • 2,587
2

I fixed my problem by just removing the user out of the line. I was under root in gedit, in the etc/fstab. I noticed that I could play videos on another drive and it was mounted as /media/HHD. So I just removed the user and the rebooted and now Playing the Moive Cars for my 3 yr old

UUID=528A041A7B1FE95D   /media/user/Movies_2TiB ntfs-3g

So it looks like

UUID=528A041A7B1FE95D   /media/Movies_2TiB  ntfs-3g

I've been reading and trying things for two days now .. but how simple this was.

I hope that this helps someone out there and saves them time.

andrew.46
  • 39,359
1

Finally I used Menu → Preferences → Disks to compare properties of the two drives. Only one difference was under Edit mount options… The internal SSD was set to manual mount options with the Mount at Start-up box checked. The USB drive was set to automatic mount options with the box unchecked.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
1

The chmod worked for me and I am using a vfat and an ntfs drive both and they both work great now, thanks for the advice. This is the 2 lines from my fstab drive, just replace the <....> with the correct drive info:

UUID=<Drive ID> /media/<user>/<NewVolume1>  ntfs-3g permissions,auto,nosuid,nodev,nofail    0   0

UUID=EEBB-75D5 /media/<user>/<NewVolume1>   vfat    defaults,uid=1000,gid=1000,nosuid,nodev,nofail  0   0
hg8
  • 13,582
RIck
  • 11
1

After struggling with this problem I found an extremely simple solution. I installed and ran a program called ntfs-config. Plex could then read the contents of my two ntfs drives, one external and the other internal with only two clicks per drive.

JoseB62
  • 11
  • 1
0

I was still facing issues using 18.04;

So I installed Eiciel *(ACL program)

I found that because I had older installs of OS's that had the same username, I had to add all the duplicates. Once done, the change to their plexmediaserver.service file worked;

Stephen Rauch
  • 1,156
  • 6
  • 15
  • 21
0

I did not have to edit any files or change my drive content permissions, or give plex access to my user account. All I ended up doing is making a new folder under /media called "plex" so it was /media/plex, and gave it permissions plex:plex as follows:

cd /media
sudo mkdir plex
sudo chown plex:plex plex

Then, I listed my drives to see the device so I could mount it to the plex folder:

sudo blkid -o list

The above command showed that my ext4-formatted external drive happened to be on /dev/sdb1, so I mounted it as follows:

sudo mount -t ext4 -o defaults /dev/sdb1 /media/plex

That mounted the drive to /media/plex. My movies are inside of that drive under another sub-folder called movies, so all the files are actually in:

/media/plex/movies

Anyways, I went back into Plex and added the library, it let me click on the /movie/plex folder no problem, it even found the sub-folders and everything worked perfectly, it detected all the movies!

No need to reboot or restart the server or anything.

I'm on Ubuntu Studio 18.04.2 LTS using Plex Media Server 1.15.4.994.

Kevin Bowen
  • 20,055
  • 57
  • 82
  • 84
edy
  • 1
  • 1
0

Just run this command first:

/mnt$ sudo chown :plex sda1/

then:

cd to sda1 and do: 
/mnt/sda1$ sudo chown -R :plex *

Name your asset folders files as /folder/file as in movie-name (year)/movie-name (year).mp4 And for TV to be detected use series-name (year)/series-name S01E01 (year).mp4

Ubuntovative is here
  • 1,162
  • 2
  • 15
  • 41
0

Not sure if this is the most secure way of doing it but other attempts failed, this works:

sudo usermod -a -G pi plex
sudo usermod -a -G plugdev plex
sudo chmod 775 /media/pi
0

Navigate to the media folder by typing this in the terminal

cd /media/

Then type

sudo chmod 777 <user>

Enter the admin password. You are good to go. Now try to access the folders in the external HDD from plex.

Note :

<user>

is the folder name found inside the media folder. (when you navigate to cd /media/ in the terminal)

0

The only solution working for me :

You need to change the user for the Plex Media Server, instead of the user "plex" you must use your linux user.

sudo vim /etc/default/plexmediaserver (or use nano instead of vim)

PLEX_MEDIA_SERVER_USER=yourLinuxUser

sudo mkdir /plex

sudo chmod -R 777 $USER:$USER /plex

sudo chown -R $USER:$USER /plex

Place all your media files and folders in /plex

It should now work immediately. For me it does. If not restart your computer.

ricko zoe
  • 141