Permissions issue with transcoder

Server Version#: 1.26.0.5715
Player Version#: Many

I appear to be having some odd permissions issues with transcoding. I’ve set transcoding to run here: /tmp/transcode-tmp

Plex runs as user plex, group nas - correctly. When subfolders get created under transcode-tmp, they usually get created owned by plex/nas. However, every now and then, they are created with the owner being a user. For the life of me, I can’t figure this out, but I think it’s somewhat tied to EAE transcoding.

A couple of days ago I saw this line:

Plex Media Server.log:Apr 19, 2022 08:21:02.077 [0x7fee72b9cb38] INFO - [Transcode/B27C4F64-2F69-48AF-B36A-54B261F8B6C7] CodecManager: starting EAE at "/tmp/pms-abd7f433-3818-4f00-85f7-43cdabcdc7a5/EasyAudioEncoder"

in my logs. First of all - that folder isn’t under /tmp/transcode-tmp, but secondly, that folder was created with the wrong user owning it. Therefore, a couple of days later, I got this error:

Plex Media Server.log:Apr 20, 2022 07:21:50.073 [0x7fee71021b38] ERROR - [Transcoder] [truehd_eae @ 0x7fad0181c6c0] EAE watchfolder is not writable: /tmp/pms-abd7f433-3818-4f00-85f7-43cdabcdc7a5/EasyAudioEncoder/Convert to WAV (to 8ch or less)/7D450ECA-41DF-4FB3-A15F-978256484120_362055-0-test.tmp

It looks to me like there are some scenarios where the transcoder runs as the wrong user - and I can’t, for the life of me, figure out why.

Any ideas?

Linux does not allow a non-privileged process such as Plex to violate its username and switch to another user to run as.

The only way I know of is when SETUID/SETGID is asserted on a directory where user plex:plex is writing.

Given you’re using plex:nas as the UID/GID, may I see your override.conf ?

I agree - that’s why I’m struggling so much with this. It appears like everything is fine, and plex is running as plex:nas :

[Service]

User=plex
Group=nas
plex     4118334  1.6  0.5 207692 86824 ?        Ssl  Apr19  32:09 /usr/lib/plexmediaserver/Plex Media Server
plex     4118370  0.0  0.0  64448 12720 ?        SNl  Apr19   0:57 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.26.0.5715-8cf78dab3 /usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/System.bundle
plex     4118410  0.1  0.0  41256   244 ?        Sl   Apr19   2:03 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Shared 1.26.0.5715-8cf78dab3 32600
plex     4118449  0.1  0.3 109296 64104 ?        Sl   Apr19   2:16 Plex Plug-in [com.plexapp.agents.subzero] /usr/lib/plexmediaserver/Resources/Plug-ins-8cf78dab3/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.26.0.5715-8cf78dab3 /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Sub-Zero.bundle
plex     4118535  0.0  0.0   4312   212 ?        S    Apr19   0:05 /usr/lib/plexmediaserver/Plex Relay -p 443 -N -R 0:127.0.0.1:32401 -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/relayHostKey.txt -o LogLevel=VERBOSE -o PreferredAuthentications=password -o PubkeyAuthentication=no -l XXXXX -F /dev/null YYYYY
plex     4118777  0.3  0.0   2592    84 ?        S    Apr19   6:55 Plex EAE Service

That top (or is it ps) output looks fine.

When this happens again,

  1. Pause playback. Don’t terminate it.
  2. Open the terminal session
  3. ls -laR of your transcoder temp directory and redirect to a file.
  4. Zip and attach the file here. (forum allows ZIP / GZ attachments)

I will try - the symptom I get is an error in the playback straight away, I’ll try to capture. Could take a week or two.

Alternative… Please let me see this: (if it’s a permissions problem)

All you need to do is:

  1. Verify DEBUG logging is on.
  2. Recreate the EAE failure.
  3. Download the Logs ZIP file
  4. Attach it here.

I’ll do the rest

OK, didn’t have debug logging on, but just replicated!

./Transcode:
total 24
drwxr-xr-x  3 plex  nas  4096 Apr 22 17:38 .
drwxrwxrwt 18 cemil nas 16384 Apr 22 17:40 ..
drwxr-xr-x  2 plex  nas  4096 Apr 22 17:38 Sessions

./Transcode/Sessions:
total 8
drwxr-xr-x 2 plex nas 4096 Apr 22 17:38 .
drwxr-xr-x 3 plex nas 4096 Apr 22 17:38 ..

./transcode-tmp:
total 24
drwxr-xr-x  3 cemil nas  4096 Apr 22 02:01 .
drwxrwxrwt 18 cemil nas 16384 Apr 22 17:40 ..
drwxr-xr-x  4 cemil nas  4096 Apr 20 15:03 Transcode

./transcode-tmp/Transcode:
total 16
drwxr-xr-x 4 cemil nas 4096 Apr 20 15:03 .
drwxr-xr-x 3 cemil nas 4096 Apr 22 02:01 ..
drwxr-xr-x 2 cemil nas 4096 Apr 22 02:01 Detection
drwxr-xr-x 2 cemil nas 4096 Apr 22 02:01 Sessions

./transcode-tmp/Transcode/Detection:
total 8
drwxr-xr-x 2 cemil nas 4096 Apr 22 02:01 .
drwxr-xr-x 4 cemil nas 4096 Apr 20 15:03 ..

./transcode-tmp/Transcode/Sessions:
total 8
drwxr-xr-x 2 cemil nas 4096 Apr 22 02:01 .
drwxr-xr-x 4 cemil nas 4096 Apr 20 15:03 ..

That new folder - /tmp/Transcode is outside my designated temp folder - as just confirmed in my server settings.

/tmp/transcode-tmp

Playback was started roughly Apr 22 17:38.

Error in log:

Apr 22, 2022 17:38:46.672 [0x7fee6b48ab38] ERROR - [Transcode/3C6466EB-B26A-40A0-9EDF-3FDD38989080] IsFileWritable: failed to create file '"/tmp/transcode-tmp/816120f8-5e25-4b9f-9d6d-516946e7435b"'
Apr 22, 2022 17:38:46.672 [0x7fee6b48ab38] WARN - [Transcode/3C6466EB-B26A-40A0-9EDF-3FDD38989080] IsDirWritable: directory '"/tmp/transcode-tmp"' is not writable
Apr 22, 2022 17:38:46.673 [0x7fee6b48ab38] ERROR - [Transcode/3C6466EB-B26A-40A0-9EDF-3FDD38989080] IsFileWritable: failed to create file '"/tmp/transcode-tmp/900df092-462e-4877-b3cd-c785154c0c04"'
Apr 22, 2022 17:38:46.673 [0x7fee6b48ab38] WARN - [Transcode/3C6466EB-B26A-40A0-9EDF-3FDD38989080] IsDirWritable: directory '"/tmp/transcode-tmp"' is not writable
Apr 22, 2022 17:38:48.846 [0x7fee69fd0b38] ERROR - [Transcoder] [truehd_eae @ 0x7f5f7b537b40] EAE watchfolder is not writable: /tmp/pms-abd7f433-3818-4f00-85f7-43cdabcdc7a5/EasyAudioEncoder/Convert to WAV (to 8ch or less)/3C6466EB-B26A-40A0-9EDF-3FDD38989080_1559568-0-test.tmp
Apr 22, 2022 17:38:48.846 [0x7fee6b739b38] ERROR - [Transcoder] Error while opening decoder for input stream #0:1 : Generic error in an external library
Apr 22, 2022 17:38:48.854 [0x7fee6b1ceb38] ERROR - IsFileWritable: failed to create file '"/tmp/transcode-tmp/a2defde1-0488-4d29-b7fe-cd4652997096"'
Apr 22, 2022 17:38:48.854 [0x7fee6b1ceb38] WARN - IsDirWritable: directory '"/tmp/transcode-tmp"' is not writable

Follow-on: chown plex:nas that entire folder structure, hit play again, get this error:

Apr 22, 2022 17:46:38.054 [0x7fee6b835b38] ERROR - [Transcoder] [truehd_eae @ 0x7f426e6bfb40] EAE watchfolder is not writable: /tmp/pms-abd7f433-3818-4f00-85f7-43cdabcdc7a5/EasyAudioEncoder/Convert to WAV (to 8ch or less)/25866771-107A-49E4-8E45-EC287D13A686_1562897-0-test.tmp
Apr 22, 2022 17:46:38.055 [0x7fee6b0aeb38] ERROR - [Transcoder] Error while opening decoder for input stream #0:1 : Generic error in an external library
Apr 22, 2022 17:46:38.134 [0x7fee6b835b38] WARN - [Transcode] Got a request to stop a transcode session without a valid session GUID.
Apr 22, 2022 17:46:38.321 [0x7fee6b63eb38] ERROR - Unknown metadata type: folder
Apr 22, 2022 17:46:40.058 [0x7fee6b661b38] ERROR - Unknown metadata type: folder
Apr 22, 2022 17:46:42.511 [0x7fee6b835b38] ERROR - Unknown metadata type: folder
Apr 22, 2022 17:46:48.547 [0x7fee6b5b9b38] INFO - AutoUpdate: no updates available

That folder (/tmp/pms-abd7f433-3818-4f00-85f7-43cdabcdc7a5) did not exist 2 minutes ago.

A full restart of PMS appears to have fixed (for now), but something weird is definitely going on. I believe this all started when I changed the location of my transcode folder. I wonder if the /tmp/transcode-tmp/ is screwing with it (the trailing tmp/)?

I replicated what you’re seeing except that I do not have a subdirectory specification.
(I use /dev/shm as my transcoder temp because it’s always there after reboots)

I see:

  1. All video transcoding files go to the Transcoder temp directory as expected.
  2. Dolby conversion temp files (Plex EAE) service are written to /tmp
  3. Directories in /tmp persist after PMS stops but , due to tmpfs rules of /tmp, are removed when the host restarts.

I’ve asked Engineering for clarification.

Query: Did you change the Plex user & group but not reboot the host?

I ask this because, if /tmp is hardwired into the Dolby EAE (which is very likely given that it’s Dolby code) then we have an explanation as to what’s happening and that this occurred only because the UID/GID changed without /tmp being cleared (which is really weird)

Query 2:

PMS makes TMPDIR available to you to customize.
The default TMPDIR is /tmp.

Care to experiment and place (in the service file) Environment="TMPDIR=/path/to/your/transcoder/temp"

I am concerned about how does /tmp/transcode-tmp get created in the case when /tmp is a traditional memory-based tmpfs filesystem. PMS does expect the transcoder temp directory to exist

@cemilbrowne

There was another variable to set :slight_smile:

TranscoderTempDirectory

It will use the directory named here or the cache directory if unset, or TMPDIR if that’s not writable.

Priority order:

  1. The directory named by this preference if set
  2. Cache directory (under PMS) unless there is a problem.
  3. TMPDIR if all else fails.

This means you should check Cache and all below it for ownership.
TMPDIR is the last resort.

This does mean you can put just the transcoder temp (for EAE) somewhere other than video.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.