No Write Access to Freenas iocage

traCk

Dabbler
Joined
Nov 12, 2015
Messages
22
Recently added a tuner for the DVR functionality of Plex and have discovered my Plex instance has no write access to the folder structure. I have searched and seen this issue come up a few times, but I frankly am struggling on implementing a fix. I see the most common fix comes in the form of creating a 'plex' user account in freenas to give permissions, but short of making that user and trying to replace the 'root' user with 'plex' in the jail settings where I see and changing owner of that dataset to 'plex' and allowing write access I am a little lost. Anyone care to give me some guidance?
 

samuel-emrys

Contributor
Joined
Dec 14, 2018
Messages
136
This could be one of two issues:
1. The plex user does not have write access to the dataset you're trying to write to, as you mentioned
2. The dataset was mounted as read only in the fstab file

Before discussing a solution, there are a couple of things I should clarify. A plex user and group will have been automatically created for you, regardless of your installation method. If you used the plugin, this should have happened in plugin installation, and if you used the pkg install, they are also created automatically. I am assuming that your dvr directory is located within /mnt/media on the FreeNAS host. These solutions are presented from the command line interface, and assume you know how to SSH in and access your jails.

For the first issue, you can confirm whether this is the case by issuing the following command from within your plex jail:
ls -l /path/to/directory

i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr
There are a few components to this. The drwxrwxr-- component describes the permissions of the file/folder. The leading 'd' indicates that it's a directory. The following 'rwx' indicates the owning user has read, write and execute permissions. The 'rwx' following that indicates that the owning group has read, write and execute permissions, and the 'r--' following that indicates that the "other" set of users have only read permissions. The next components are 'root' and 'wheel'. In this case root refers to the owning user of the file/directory, and wheel is the owning group of that file/directory. The dvr component at the end is the name of the file/directory. If your folder has permissions that match this, this is likely why it's not working for you. The solution to this is one of three things:
1. You could change the owning user: chown -R plex:wheel /mnt/media/dvr
2. You could change the owning group/add the plex user to the wheel group
To change the owning group to the *group* named plex: chown -R root:plex /mnt/media/dvr
To add the *user* plex to the wheel group: pw groupmod wheel -M plex
3. You could expand the permissions of the "other" users: chmod -R 777 /mnt/media/dvr

My suggestion would be to do a combination of 1 and 2, and change both the owning user and owning group to the plex user and group:
chown -R plex:plex /mnt/media/dvr
Of course, if you have other daemons that might need access to this folder, it might be prudent to create a media_share group or something, and change ownership to plex:media_share or similar, where each of the daemons requiring access are members of this media_share group. Refer to the user management and permissions documentation for a fuller explanation, and the tools at your disposal.

The second possible issue is that the dataset was mounted as read only in your fstab file. To check if this is the case, log into your FreeNAS host console, and change the default editor from vi to nano:
setenv EDITOR nano
Then inspect the fstab file for your plex jail. Note: I'm assuming your plex jail is named "plex", if it's not, replace any instance of "plex" with the name of your jail:
iocage fstab -e plex

You should be presented with something similar to the following:

/mnt/media/dvr /mnt/iocage/jails/plex/root/mnt/media/dvr nullfs rw 0 0

If your entry looks similar to this, then this is likely not the issue. IF, however, the entry following 'nullfs' is 'ro' and not 'rw', you'll need to change this to 'rw'. Then to quit the editor, press Ctrl +X, y and enter. Hope this helps.
 

traCk

Dabbler
Joined
Nov 12, 2015
Messages
22
This could be one of two issues:
1. The plex user does not have write access to the dataset you're trying to write to, as you mentioned
2. The dataset was mounted as read only in the fstab file

Before discussing a solution, there are a couple of things I should clarify. A plex user and group will have been automatically created for you, regardless of your installation method. If you used the plugin, this should have happened in plugin installation, and if you used the pkg install, they are also created automatically. I am assuming that your dvr directory is located within /mnt/media on the FreeNAS host. These solutions are presented from the command line interface, and assume you know how to SSH in and access your jails.

For the first issue, you can confirm whether this is the case by issuing the following command from within your plex jail:
ls -l /path/to/directory

i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr
There are a few components to this. The drwxrwxr-- component describes the permissions of the file/folder. The leading 'd' indicates that it's a directory. The following 'rwx' indicates the owning user has read, write and execute permissions. The 'rwx' following that indicates that the owning group has read, write and execute permissions, and the 'r--' following that indicates that the "other" set of users have only read permissions. The next components are 'root' and 'wheel'. In this case root refers to the owning user of the file/directory, and wheel is the owning group of that file/directory. The dvr component at the end is the name of the file/directory. If your folder has permissions that match this, this is likely why it's not working for you. The solution to this is one of three things:
1. You could change the owning user: chown -R plex:wheel /mnt/media/dvr
2. You could change the owning group/add the plex user to the wheel group
To change the owning group to the *group* named plex: chown -R root:plex /mnt/media/dvr
To add the *user* plex to the wheel group: pw groupmod wheel -M plex
3. You could expand the permissions of the "other" users: chmod -R 777 /mnt/media/dvr

My suggestion would be to do a combination of 1 and 2, and change both the owning user and owning group to the plex user and group:
chown -R plex:plex /mnt/media/dvr
Of course, if you have other daemons that might need access to this folder, it might be prudent to create a media_share group or something, and change ownership to plex:media_share or similar, where each of the daemons requiring access are members of this media_share group. Refer to the user management and permissions documentation for a fuller explanation, and the tools at your disposal.

The second possible issue is that the dataset was mounted as read only in your fstab file. To check if this is the case, log into your FreeNAS host console, and change the default editor from vi to nano:
setenv EDITOR nano
Then inspect the fstab file for your plex jail. Note: I'm assuming your plex jail is named "plex", if it's not, replace any instance of "plex" with the name of your jail:
iocage fstab -e plex

You should be presented with something similar to the following:

/mnt/media/dvr /mnt/iocage/jails/plex/root/mnt/media/dvr nullfs rw 0 0

If your entry looks similar to this, then this is likely not the issue. IF, however, the entry following 'nullfs' is 'ro' and not 'rw', you'll need to change this to 'rw'. Then to quit the editor, press Ctrl +X, y and enter. Hope this helps.

Thank you so much, I'll take a look into this and hopefully make some headway.
 

traCk

Dabbler
Joined
Nov 12, 2015
Messages
22
This could be one of two issues:
1. The plex user does not have write access to the dataset you're trying to write to, as you mentioned
2. The dataset was mounted as read only in the fstab file

Before discussing a solution, there are a couple of things I should clarify. A plex user and group will have been automatically created for you, regardless of your installation method. If you used the plugin, this should have happened in plugin installation, and if you used the pkg install, they are also created automatically. I am assuming that your dvr directory is located within /mnt/media on the FreeNAS host. These solutions are presented from the command line interface, and assume you know how to SSH in and access your jails.

For the first issue, you can confirm whether this is the case by issuing the following command from within your plex jail:
ls -l /path/to/directory

i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr
There are a few components to this. The drwxrwxr-- component describes the permissions of the file/folder. The leading 'd' indicates that it's a directory. The following 'rwx' indicates the owning user has read, write and execute permissions. The 'rwx' following that indicates that the owning group has read, write and execute permissions, and the 'r--' following that indicates that the "other" set of users have only read permissions. The next components are 'root' and 'wheel'. In this case root refers to the owning user of the file/directory, and wheel is the owning group of that file/directory. The dvr component at the end is the name of the file/directory. If your folder has permissions that match this, this is likely why it's not working for you. The solution to this is one of three things:
1. You could change the owning user: chown -R plex:wheel /mnt/media/dvr
2. You could change the owning group/add the plex user to the wheel group
To change the owning group to the *group* named plex: chown -R root:plex /mnt/media/dvr
To add the *user* plex to the wheel group: pw groupmod wheel -M plex
3. You could expand the permissions of the "other" users: chmod -R 777 /mnt/media/dvr

My suggestion would be to do a combination of 1 and 2, and change both the owning user and owning group to the plex user and group:
chown -R plex:plex /mnt/media/dvr
Of course, if you have other daemons that might need access to this folder, it might be prudent to create a media_share group or something, and change ownership to plex:media_share or similar, where each of the daemons requiring access are members of this media_share group. Refer to the user management and permissions documentation for a fuller explanation, and the tools at your disposal.

The second possible issue is that the dataset was mounted as read only in your fstab file. To check if this is the case, log into your FreeNAS host console, and change the default editor from vi to nano:
setenv EDITOR nano
Then inspect the fstab file for your plex jail. Note: I'm assuming your plex jail is named "plex", if it's not, replace any instance of "plex" with the name of your jail:
iocage fstab -e plex

You should be presented with something similar to the following:

/mnt/media/dvr /mnt/iocage/jails/plex/root/mnt/media/dvr nullfs rw 0 0

If your entry looks similar to this, then this is likely not the issue. IF, however, the entry following 'nullfs' is 'ro' and not 'rw', you'll need to change this to 'rw'. Then to quit the editor, press Ctrl +X, y and enter. Hope this helps.




Ok so this worked, if you would entertain me so I may better understand my issue.

When I checked the owner it came back with 1000 1000 which is my plex user id, after chown to plex: plex user I created it worked. I originally changed this permission through the GUI, so I assume the GUI is what assigned it the 1000 1000. Is this normal?

Also when i would change the dataset ownership in the GUI the other - write was always unchecked when I went back in to it again. I assume was my problem but should I have been able to do this through the GUI?

Thanks much!
 

samuel-emrys

Contributor
Joined
Dec 14, 2018
Messages
136
Ok so this worked, if you would entertain me so I may better understand my issue.

When I checked the owner it came back with 1000 1000 which is my plex user id, after chown to plex: plex user I created it worked. I originally changed this permission through the GUI, so I assume the GUI is what assigned it the 1000 1000. Is this normal?

Also when i would change the dataset ownership in the GUI the other - write was always unchecked when I went back in to it again. I assume was my problem but should I have been able to do this through the GUI?

Thanks much!
The issue is that users and groups are represented by uid and gid rather than the alias for these ("plex" in your case). These are a property of the directory independent of its mount location. When you created the user and group on your FreeNAS host named "plex", it would have prompted you to specify a uid/gid (or just a uid, this would attempt to create a gid with the same value). The default value for this is 1000 (for the first user/group), so you would have ended up with uid=1000(plex) gid=1000(plex). Inside the jail, however, the auto-creation of the plex user and group won't have necessarily used these uid and gid values. You can see what values are assigned inside the jail by typing id plex

Because, as mentioned earlier, the permissions don't consider the user and group alias, and only queries the uid and gid values, it is important that both of these match the user inside and outside of the jail. i.e., your plex user and group that you configured on the FreeNAS host should be the same as the plex user and group inside the jail. Hope this helps
 

rivey

Contributor
Joined
Sep 20, 2017
Messages
123
This could be one of two issues:
1. The plex user does not have write access to the dataset you're trying to write to, as you mentioned
2. The dataset was mounted as read only in the fstab file

Before discussing a solution, there are a couple of things I should clarify. A plex user and group will have been automatically created for you, regardless of your installation method. If you used the plugin, this should have happened in plugin installation, and if you used the pkg install, they are also created automatically. I am assuming that your dvr directory is located within /mnt/media on the FreeNAS host. These solutions are presented from the command line interface, and assume you know how to SSH in and access your jails.

For the first issue, you can confirm whether this is the case by issuing the following command from within your plex jail:
ls -l /path/to/directory

i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr
There are a few components to this. The drwxrwxr-- component describes the permissions of the file/folder. The leading 'd' indicates that it's a directory. The following 'rwx' indicates the owning user has read, write and execute permissions. The 'rwx' following that indicates that the owning group has read, write and execute permissions, and the 'r--' following that indicates that the "other" set of users have only read permissions. The next components are 'root' and 'wheel'. In this case root refers to the owning user of the file/directory, and wheel is the owning group of that file/directory. The dvr component at the end is the name of the file/directory. If your folder has permissions that match this, this is likely why it's not working for you. The solution to this is one of three things:
1. You could change the owning user: chown -R plex:wheel /mnt/media/dvr
2. You could change the owning group/add the plex user to the wheel group
To change the owning group to the *group* named plex: chown -R root:plex /mnt/media/dvr
To add the *user* plex to the wheel group: pw groupmod wheel -M plex
3. You could expand the permissions of the "other" users: chmod -R 777 /mnt/media/dvr

My suggestion would be to do a combination of 1 and 2, and change both the owning user and owning group to the plex user and group:
chown -R plex:plex /mnt/media/dvr
Of course, if you have other daemons that might need access to this folder, it might be prudent to create a media_share group or something, and change ownership to plex:media_share or similar, where each of the daemons requiring access are members of this media_share group. Refer to the user management and permissions documentation for a fuller explanation, and the tools at your disposal.

The second possible issue is that the dataset was mounted as read only in your fstab file. To check if this is the case, log into your FreeNAS host console, and change the default editor from vi to nano:
setenv EDITOR nano
Then inspect the fstab file for your plex jail. Note: I'm assuming your plex jail is named "plex", if it's not, replace any instance of "plex" with the name of your jail:
iocage fstab -e plex

You should be presented with something similar to the following:

/mnt/media/dvr /mnt/iocage/jails/plex/root/mnt/media/dvr nullfs rw 0 0

If your entry looks similar to this, then this is likely not the issue. IF, however, the entry following 'nullfs' is 'ro' and not 'rw', you'll need to change this to 'rw'. Then to quit the editor, press Ctrl +X, y and enter. Hope this helps.


I have been trying to figure this out but I am a noob that does not have a very good understanding of using under the hood FreeNAS.

Your post looks like it might solve my problem. I have plex completely working except the live TV recording will not record. my entry following 'nullfs' is 'ro' and not 'rw'. I understand that I will have to edit this value, but for the life of me, I have been unable to figure out how. Can someone provide a more detailed explanation of how to do this? I am sure there are others like me with this issue also. Thanks for anything that you can do.

The funny thing is that I was able to have it working until I was force to completely redo my server and then only the Plex DVR record function would not work. I am feeling very inadequate at this point.
 

samuel-emrys

Contributor
Joined
Dec 14, 2018
Messages
136
my entry following 'nullfs' is 'ro' and not 'rw'. I understand that I will have to edit this value, but for the life of me, I have been unable to figure out how
How did you discover that it reads `ro` and not `rw`? If you're using a text editor, which one?
 

rivey

Contributor
Joined
Sep 20, 2017
Messages
123
How did you discover that it reads `ro` and not `rw`? If you're using a text editor, which one?

I followed your instructions in post #2
"i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr "

It read ro and not rw.
 

samuel-emrys

Contributor
Joined
Dec 14, 2018
Messages
136
I followed your instructions in post #2
"i.e.:

ls -l /mnt/media

This will yield an output containing permission information similar to as follows:
drwxrwxr-- 8 root wheel 9 Aug 17 14:46 dvr "

It read ro and not rw.
Well, now I'm even more confused, because the commands you quoted won't give you the output you say you got. I'll assume for a second you meant you executed fstab -e plex. If you forgot to run setenv EDITOR nano prior to running this command, the text editor it opens the `fstab` file in is vi, which has an unintuitive interface if you haven't learnt to use it, and for these purposes I would advise avoiding it.

If you did run setenv EDITOR nano prior to executing fstab -e plex, then the text editor the `fstab` file should open up in is `nano`. This has a much more intuitive interface, you simply need to use the arrow keys to navigate to the relevant `ro` statement and change it to `rw`, then press Ctrl +X to save and exit, and enter `y` at the following prompt to confirm the changes and the filename to save to. The `fstab` file for your jail should then be updated. Probably a good idea to restart the jail after to make sure these changes have been applied and don't cause any issues starting it back up again: iocage restart plex
 

rivey

Contributor
Joined
Sep 20, 2017
Messages
123
Well, now I'm even more confused, because the commands you quoted won't give you the output you say you got. I'll assume for a second you meant you executed fstab -e plex. If you forgot to run setenv EDITOR nano prior to running this command, the text editor it opens the `fstab` file in is vi, which has an unintuitive interface if you haven't learnt to use it, and for these purposes I would advise avoiding it.

If you did run setenv EDITOR nano prior to executing fstab -e plex, then the text editor the `fstab` file should open up in is `nano`. This has a much more intuitive interface, you simply need to use the arrow keys to navigate to the relevant `ro` statement and change it to `rw`, then press Ctrl +X to save and exit, and enter `y` at the following prompt to confirm the changes and the filename to save to. The `fstab` file for your jail should then be updated. Probably a good idea to restart the jail after to make sure these changes have been applied and don't cause any issues starting it back up again: iocage restart plex

I will verify the process in the morning after I see a client for a service call. I will get back to you and document every step. Thanks for the help.
 
Top