Plex Converted files cannot be written to disc

tblomega

Cadet
Joined
May 22, 2023
Messages
6
Unfortunately I have been having a bad case of 'If it is not one thing, it is another', and the issue I am about to ask about is the latest and so far most ambiguous about how to even approach solving, doesn't help this is my very first rodeo with TrueNAS, and I am exceptionally green and prone to bad luck on the Linux front as well.

Anywho, the hardware is a dell R710 with a PERC H200 flashed into IT mode so truenas would accept the disks, of which there are 3 seagate exos X20 20TB drives in a raidZ and a 4 TB crucial sata SSD as a cache, Truenas itself is booted off 2 500gig sas drives still running through the dell PERC H700 doing a hardware managed raid 1 but nothing that card manages is visible to truenas for the use as a storage pool.

The problem is after much ado figuring out how to make shares and permissions and getting apps to even work (needed a reboot after the first try and launch) I got some of my data onboard and plex up and running.

Plex has '/mnt/plex/transcode', '/mnt/plex/library', and '/mnt/plex/config' pass through to its transcode, data, and config folder options respectively.

My media files show up and play fine so yay!

Clicking 'optimize for mobile' however yields a "converted files cannot be written to the servers disk" error.

Googling about I did find a 2018 thread on this form https://www.truenas.com/community/threads/plex-iocage-write-permission-issue.69216/ however it refers to a iocage something or other and I have no earthly idea what that is or how one does anything with it also that post is years old.

I ALso found this post over on reddit https://www.reddit.com/r/PleX/comments/6zay8b/plex_on_freenas_11_converted_files_cannot_be/ wherein the comments seem to be on the right track with: TangoFoxtrotBravo saying "•6 yr. ago OK plex:plex broke the ability for me to move files out of the plex folders on my FreeNAS. To had to go back into the jail shell and re-run this as:chown -R plex:wheel media"

But this again is talking about some sort of 'jail' I know nothing about and he follows it up later about saying 'wheel' needs to be added as a group in different places.....

and whilst that is reminiscent of other guides and projects I have followed in the past it is beyond my present ability to extrapolate how to use this information at present.....
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Clicking 'optimize for mobile' however yields a "converted files cannot be written to the servers disk" error.

I have no idea about Plex on TrueNAS in particular. However, I can tell you from porting Plex to a custom FreeBSD app framework that Plex does require the existence of a temporary directory to hold output; this might be under Settings->Transcoder->Transcoder temporary directory, or it might be a subdirectory in your actual library. In which case you might want to check the permissions of that directory and blow it wide open, or at least open sufficiently enough to work. I don't use optimized versions but I suspect that if you click on "Optimize" for a library item, it will give you a dialog that allows you to choose whether to store it "in folders with original items" (which may be failing for you due to permissions) or it will allow you to choose a directory that is part of your library, and put a "Plex Versions" in there. For example, if your storage location is /Network/Media/Movies, it will try to create "/Network/Media/Movies/Plex Versions". You can manually create this and give it 1777 perms with chmod to make it writable. Getting the correct combination of permissions for your particular setup may not be easy, but chmod 1777 should allow it to work.
 

tblomega

Cadet
Joined
May 22, 2023
Messages
6
I have no idea about Plex on TrueNAS in particular. However, I can tell you from porting Plex to a custom FreeBSD app framework that Plex does require the existence of a temporary directory to hold output; this might be under Settings->Transcoder->Transcoder temporary directory, or it might be a subdirectory in your actual library. In which case you might want to check the permissions of that directory and blow it wide open, or at least open sufficiently enough to work. I don't use optimized versions but I suspect that if you click on "Optimize" for a library item, it will give you a dialog that allows you to choose whether to store it "in folders with original items" (which may be failing for you due to permissions) or it will allow you to choose a directory that is part of your library, and put a "Plex Versions" in there. For example, if your storage location is /Network/Media/Movies, it will try to create "/Network/Media/Movies/Plex Versions".

Plex has '/mnt/plex/transcode', '/mnt/plex/library', and '/mnt/plex/config' pass through to its transcode, data, and config folder options respectively


The chmod bit was new and actionable though so I went to "system settings>Shell" and typed "sudo chmod 1777 /mnt/Data/Plex"

no errors or output from the command

restarted the plex docker container

tried again

same error as before
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
The chmod bit was new and actionable though so I went to "system settings>Shell" and typed "sudo chmod 1777 /mnt/Data/Plex"

That's not going to be sufficient, it only changes the /mnt/Data/Plex directory.

I gave you two different directory locations to try, both the temp for the transcoder and the optimized versions directory, which would need to exist and then be set 1777 in order to have a chance of doing something meaningful. You will need to look up what appropriate values are based on the settings in your Plex webUI.
 

tblomega

Cadet
Joined
May 22, 2023
Messages
6
That's not going to be sufficient, it only changes the /mnt/Data/Plex directory.

I gave you two different directory locations to try, both the temp for the transcoder and the optimized versions directory, which would need to exist and then be set 1777 in order to have a chance of doing something meaningful. You will need to look up what appropriate values are based on the settings in your Plex webUI.

First I notice a typo iof oversight due to typing off memory n my original post and my previous quote of it the path is /mnt/Data/Plex

I was changing the permissions there as the transcode, library, and config folders that get passed to the docker/app for plex live inside that folder so by changing the parent folder I was hoping to change the child folders by extension. Please note that /mnt/Data/Plex and all it's sub folders is a directory tree I created to hold the external files that get mapped inside the docker, that is not the path for the docker itself.

The transcode folder is /mnt/Data/Plex/Transcode
the data or library folder is /mnt/Data/Plex/Library
The config folder is /mnt/Data/Plex/config

and all 3 are configured to be passed as the real locations of the files into the plex docker app.

That said I will be ensuring their permissions are set to 1777 here in a moment just incase that did not propagate from the plex parent folder.
 

tblomega

Cadet
Joined
May 22, 2023
Messages
6
So indeed the child folder's permissions were not set see the first screenshot below where I also set them.

Also I have a domain and separate from project plex on the NAS but Rather regarding project Populate data onto my nas from old storage sources I had previously been meddling with that and I guess it got accidentally set (or more likely set when I didn't yet have a full handle on what I was doing and it's repercussions (still don't if we are being real)).

That said I vaguely recalled where I was when meddling with all of that so I went back there and set it back to root, set full permissions and ticked the box to apply recursively - See second screenshot

Tested between the first and second screenshot and after doing what is shown in the second screenshot

The problem unfortunately remains unchanged....


truenas-plex1.PNG
truenas-plex2.PNG
 

tblomega

Cadet
Joined
May 22, 2023
Messages
6
I got it now

I noticed that in the 'ls -l' permission readout that w was missing from the last bit despite setting to 1777 (I still don't understand the 4 digit version of numeric permissioning; also from what I understand the 777 portion should have had rwx set for everything...)

Reading up on permissions from https://www.elated.com/understanding-permissions/ and chmod --help I came up with the following command after which the conversions worked:

sudo chmod -R go+w [folder_name_here]

-R is recursive so in theory and seemingly in practice all sub files and folders are also set to this
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I noticed that in the 'ls -l' permission readout that w was missing from the last bit despite setting to 1777 (I still don't understand the 4 digit version of numeric permissioning; also from what I understand the 777 portion should have had rwx set for everything...)

The value is octal (base-8) notation; you seem to understand the rightmost three digits so I'll explain the leftmost one.

A file or directory can be marked with set-user-ID (4xxx), set-group-ID (2xxx), or the sticky bit (1xxx).

Setting a suid bit on a file makes it run with the UID of the file owner, if it is executed.

If you set suid on a directory, it causes new child files and subdirectories to be owned by the owner of the directory. This is another way to accomplish "fixes" of the sort you need, but it does not work reliably because it can be affected by mount point flags, etc. It's sort of obscure. You can read about it in the chmod(1) manpage.

Setting the sticky bit on a directory changes it to work like /tmp works, where each user can affect files that they own, but you cannot mess with files owned by someone else. This is a stealth way to get UNIX to ignore certain types of permissions issues where you are uncertain what the actual UID of the owner will end up being. It's actually the combination of both the sticky bit and a+rwx permissions that cause that specific behaviour.
 
Top