SOLVED Plex Codec Issue

Skyler

Dabbler
Joined
Feb 8, 2014
Messages
28
I've been having an issue with Plex, specifically related to codecs. When a file needs to be transcoded, Plex will occasionally need to download a new codec. Here's the error I receive in Plex:

Plex Playback Error.png


Error in Plex Logs:

Plex Error Log.png



The issue is the codec folder/file is created with a .tmp file type. If I manually rename the folder and remove the .tmp the video transcodes as expected.

Codec .tmp file.png


I cannot figure out why ".tmp" is being added. I assume this is a permissions issue, but don't know how to resolve it. As you can see from the screenshot above, I use a separate directory to store plugin config data. Which means this directory is not within the Plex Jail.

Has anyone else experienced this issue or know how to resolve it? I've tried deleting all of the files in the Codecs folder and allowing Plex to rebuild, but the issue persists.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,681
This suggests to me that it is downloading the file into the .tmp file, and then perhaps trying to use rename to move it into place. This kind of thing is commonly done to prevent a partial file from being installed. Permissions issues for overwrite or rename could definitely prevent this from succeeding.
 

Skyler

Dabbler
Joined
Feb 8, 2014
Messages
28
I'll be the first to admit I'm not great with permissions. I followed this guide when installing Plex years ago.

iocage exec plex mkdir -p /config
iocage exec plex mkdir -p /mnt/video
iocage fstab -a plex /mnt/tank1/apps/plex /config nullfs rw 0 0
iocage fstab -a plex /mnt/tank1/video /mnt/video nullfs ro 0 0
iocage exec plex chown -R plex:plex /config
iocage exec plex sysrc "plexmediaserver_enable=YES"
iocage exec plex sysrc plexmediaserver_support_path="/config"
iocage exec plex service plexmediaserver start

/config is a mount point with RW permissions. I've read other threads that says it requires exec permission instead of noexec, but that wasn't specific to Truenas/Freenas and may not apply. Additionally, /config points to a different dataset within my pool called "Apps". This is where all of my plugin config content is located.

Datasets.png



The other interesting bit is that Plex is attempting to download a zip file:

[Transcode] HTTP/2.0 (0.2s) 200 response from GET https://downloads.plex.tv/codecs/16.../EasyAudioEncoder-freebsd-x86_64-standard.zip

But there is no zip file in my Codec directory. It's possible it's downloading it, extracting it, deleting it, and then I'm left with this .tmp folder. Navigating into the .tmp folder shows a non-zero size file:

Full path.png


Simply renaming the folder and removing the .tmp has been my workaround for years. I just don't fully understand why the .tmp is being added in the first place. I'm opening to trying anything at this point. It's annoying having to manually rename the codecs every time a new one is needed.
 
Last edited:

Skyler

Dabbler
Joined
Feb 8, 2014
Messages
28
One more interesting bit of evidence that might help. After renaming the folder, the zip file now shows up when having to transcode.

Zip File.png


This is starting to look even more like a permissions issue. Question is how do I resolve it? The plex user should have full control over all of these files. How do I validate? Also, these are downloaded on an as-needed basis. How can I confirm that the plex user has control over newly downloaded files?
 

Skyler

Dabbler
Joined
Feb 8, 2014
Messages
28
Another update on my investigation to solve this. The Plex user/group only exists within the Plex jail. I have not created a global Plex user/group within Truenas. Perhaps this is my issue since /config is located on a different dataset? It is however mounted with Read/Write and plex user/group owns the /config directory.

If I open the shell within the Plex jail and run the ls -l command I see "plex plex" listed on all of the files. However, if I run the ls -l command outside of the jail on the /App/Plex/Plex Media Server/Codec directory I see "972 972".

972.png


I'm also unable to chmod the Codec directory to 777 even though I'm SSH'd as root. Root is not the owner of these files though, plex is.

Do I need to create a global user and group for plex in order for this to work?
 

Skyler

Dabbler
Joined
Feb 8, 2014
Messages
28
SOLVED

Creating a global plex user/group as uid/gid 972 was the answer. This thread was extremely helpful in understanding permissions between datasets.
 

rbock87

Cadet
Joined
Apr 27, 2022
Messages
1
SOLVED

Creating a global plex user/group as uid/gid 972 was the answer. This thread was extremely helpful in understanding permissions between datasets.
I've had this same issue after updating to version 1.26.1.5762 but noticed it seems to be related to the EAC3 codec, but I also don't have the .tmp folder described above.
How do you create a global user if plex plugin already creates a plex user and group.
 
Joined
Apr 28, 2022
Messages
2
I've had this same issue after updating to version 1.26.1.5762 but noticed it seems to be related to the EAC3 codec, but I also don't have the .tmp folder described above.
How do you create a global user if plex plugin already creates a plex user and group.
I have the same issue after updating to version 1.26.1.5762 too. I already have this user/group, I do not have the .tmp folder. I tried downloading the latest codec from https://downloads.plex.tv/codecs/17.../EasyAudioEncoder-freebsd-x86_64-standard.zip (Got 1764 from the folder name in the codec folder (/mnt/xxx/iocage/jails/Plex/root/Plex Media Server/Codecs)).

Going to try downgrading to see if that fixes this issue.
 
Joined
Apr 28, 2022
Messages
2
I have the same issue after updating to version 1.26.1.5762 too. I already have this user/group, I do not have the .tmp folder. I tried downloading the latest codec from https://downloads.plex.tv/codecs/17.../EasyAudioEncoder-freebsd-x86_64-standard.zip (Got 1764 from the folder name in the codec folder (/mnt/xxx/iocage/jails/Plex/root/Plex Media Server/Codecs)).

Going to try downgrading to see if that fixes this issue.
Sorry I don't see an edit button to edit my other comment so I will reply to it.

I fixed the issue by performing the following steps:
  1. Delete content in the Codec folder
  2. Download the latest Codec, and place it in the Codec folder
  3. Go to your Plugin in the UI, and hit Update
This seems to have fixed it for me.
 

billbillw

Dabbler
Joined
Jan 6, 2023
Messages
33
Necro post here, but thanks to this discussion, I figured out why my Plex wouldn't playback TrueHD files to my Roku and web clients. Even a year later, on TrueNAS Scale using the official Plex Chart, this is not fixed out of the box. I had to remove the .tmp from the encoder folder name and create a plex user. It seems like they could build this into the app setup.
 

drobo

Dabbler
Joined
Mar 4, 2019
Messages
18
Just installed a fresh Truenas Scale / Plex App and also had to remove the .tmp from the Encoder directory name to get transcoding to work, absolutely bonkers that is still an issue multiple months later..
 

camberry

Cadet
Joined
Feb 8, 2023
Messages
2
Just had this problem with Truenas Scale. To help someone else:
  1. Find the PConfig folder location
    1. Apps>Plex click the three-dot menu and go to edit
    2. Scroll down to the "storage" section
    3. Config Volume section copy the host path for plex config volume if you have one defined
  2. Goto System Settings>Shell
    1. cd "<host path for plex config volume>/Library/Application Support/Plex Media Server/Codecs" (make sure to have the "")
    2. ls and you should see a folder named something like EasyAudioEncoder-1962-linux-x86_64.tmp
    3. The ".tmp" is the problem. That directory needs to be renamed
    4. in shell use command: mv EasyAudioEncoder-1962-linux-x86_64.tmp EasyAudioEncoder-1962-linux-x86_64 (use the name of the .tmp folder instead if it is different)
    5. type ls and see that the ".tmp" should be removed from the directory.
This should fix the problem.
 

huizingajm

Cadet
Joined
Nov 1, 2023
Messages
8
Sorry if it is too old to bring to life. If so I will create a new thread. I am trying to change the file name but I cannot access the folder with SMB and trying to get NFS setup is not working either.

Can anyone point to directions of how to access that truenas location from a Win10 machine.
 
Top