Jump to content

EMBY, Docker, and a Truenas Samba Share


Recommended Posts

Posted (edited)

Hi All,

I've been bashing my head on this all day so i'm sorry if this has been covered before

I have just moved my main storage over to a truenas box with all my data via samba. My emby install has been great until this move but i'm now running into permission issues now my library is over a samba share

My setup is as follows:
The main server is Ubuntu
Emby is running as the official docker image fully up to date
Storage is via samba

My truenas server has a dataset created that is owned by my user and group (jamie), both with id 1000
These ACL's are applied to all files on the system recursively

On ubuntu i have the following in fstab (\040 allows me to have a space but i have tested without a space in the share name)
//192.168.0.4/Network\040Data    /mnt/networkdata  cifs  username=****,password=****,_netdev,uid=1000,gid=1000,rw,file_mode=0777,dir_mode=0777  0  0

This mounts the files, shows them all owned as my user (jamie) on ubuntu, again with id's of 1000
From ubuntu i can create/delete files as needed from my user (jamie) and as the root user, from windows i can do the same

I have tried this more stripped back with just a username and password but this did not work

I then have the emby docker setup to mount /mnt/networkdata/ArrayVDisks to /mnt in the docker and everything is setup from there
I have the uid, gid, and gidlist all set to 1000 to match my user

Emby can play all files without issues but i spotted that recording refuse to start. Checking the logs i noticed errors like these
 

Spoiler

 



2021-06-19 20:56:31.679 Error ProviderManager: Error in metadata saver
	*** Error Report ***
	Version: 4.6.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Linux version 5.8.0-55-generic (buildd@lgw01-amd64-050) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #62~20.04.1-
	Framework: .NET Core 3.1.13
	OS/Process: x64/x64
	Runtime: system/System.Private.CoreLib.dll
	Processor count: 64
	Data path: /config
	Application path: /system
	System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/mnt/TV Recording/Movies/Bite (2015)/Bite (2015) - 2.nfo' is denied.
	 ---> System.IO.IOException: Permission denied
	   --- End of inner exception stack trace ---
	   at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
	   at System.IO.FileStream.FlushWriteBuffer()
	   at System.IO.FileStream.Dispose(Boolean disposing)
	   at System.IO.Stream.Close()
	   at NfoMetadata.Savers.BaseNfoSaver.SaveToFile(Stream stream, String path, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at NfoMetadata.Savers.BaseNfoSaver.Save(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at MediaBrowser.Providers.Manager.ProviderManager.SaveMetadata(BaseItem item, LibraryOptions libraryOptions, ItemUpdateType updateType, IMetadataSaver[] savers, CancellationToken cancellationToken)
	Source: System.Private.CoreLib
	TargetSite: Void WriteNative(System.ReadOnlySpan`1[System.Byte])
	InnerException: System.IO.IOException: Permission denied
	Source: 
	TargetSite: 


2021-06-19 21:03:56.841 Error LiveTV: Error recording to /mnt/TV Recording/Movies/Wonder Woman (2017)/Wonder Woman (2017) - 1.ts
	*** Error Report ***
	Version: 4.6.3.0
	Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
	Operating system: Linux version 5.8.0-55-generic (buildd@lgw01-amd64-050) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #62~20.04.1-
	Framework: .NET Core 3.1.13
	OS/Process: x64/x64
	Runtime: system/System.Private.CoreLib.dll
	Processor count: 64
	Data path: /config
	Application path: /system
	System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/mnt/TV Recording/Movies/Wonder Woman (2017)/Wonder Woman (2017) - 1.ts' is denied.
	 ---> System.IO.IOException: Permission denied
	   --- End of inner exception stack trace ---
	   at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
	   at System.IO.FileStream.WriteSpan(ReadOnlySpan`1 source)
	   at System.IO.FileStream.<>c.<WriteAsyncInternal>b__110_0(Task t, Object s)
	   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
	--- End of stack trace from previous location where exception was thrown ---
	   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
	--- End of stack trace from previous location where exception was thrown ---
	   at Emby.Server.Implementations.IO.StreamHelper.CopyToAsync(Stream source, Stream destination, Int32 bufferSize, Int32 emptyReadLimit, CancellationToken cancellationToken)
	   at Emby.LiveTV.TunerHosts.LiveStream.CopyFile(String path, Boolean seekFile, Int32 emptyReadLimit, Stream writer, IFileSystem fileSystem, IStreamHelper streamHelper, CancellationToken cancellationToken)
	   at Emby.LiveTV.TunerHosts.LiveStream.CopyToAsync(Stream writer, CancellationToken cancellationToken)
	   at Emby.LiveTV.DirectRecorder.RecordFromDirectStreamProvider(IDirectStreamProvider directStreamProvider, String targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
	   at Emby.LiveTV.EmbyTV.RecordStream(TimerInfo timer, DateTimeOffset recordingEndDate, ActiveRecordingInfo activeRecordingInfo)
	Source: System.Private.CoreLib
	TargetSite: Void WriteNative(System.ReadOnlySpan`1[System.Byte])
	InnerException: System.IO.IOException: Permission denied
	Source: 
	TargetSite: 

 

 

 

If i attach into the docker and run ls -la on the wonder wonder folder as an example, i get the following permissions
drwxrwxrwx    2 1000     1000             0 Jun 19 21:08 Wonder Woman (2017)

And the contents of that folder shows
-rwxrwxrwx    1 1000     1000             0 Jun 19 21:05 Wonder Woman (2017) - 1.nfo

That nfo file was one created by emby (ignore the -1 as i have another recording of it in there), the file is there but it still threw errors like the above to say it had no permission
I have also tried recording something i did not have., It created the movie folder, created the nfo file, then threw permissions issues for the nfo, then threw issues for the ts file

I have confirmed with top within the docker that the embyserver is indeed running as user 1000 as i have told it to

If i remove the samba share and write directly to a drive the file records and works fine so i know its a samba/mount issue somewhere but i really don't know where to start based on everything having full read/write access to all files

I have attached my embyserver.txt log in case that's of help alongside a screenshot of my truenas ACLS

Any help would be great as i am still fairly new to Truenas in itself but i have been using linux a long time and can not for the life of me see what is wrong

Regards,

Jamie

Capture.PNG

embyserver.txt

Edited by bigjme
Posted

As an update to anyone interested, i created a new blank nfs share and set emby to record there and it did start a recording so i am currently transferring all my data and will see if that works

  • Like 1
Posted

Thanks, keep us updated.

Posted

So i can confirm that switching to NFS did indeed work and recording are now processing as expected, for anyone that may find this useful, here are the settings i have:

fstab entry on ubuntu:
192.168.0.4:/mnt/Vault/Media    /mnt/media    nfs    _netdev    0 0

nfs share screenshot from within truenas. The mapall options make all mounts act as that user on the host

Spoiler

image.thumb.png.533c5b89542c53bb498ff299465ba879.png

Here are my nfs service settings in truenas

Spoiler

image.png.b5f564fe392e1da126e05c3223a29a80.png

Here are the truenas dataset details, all permissions were pushed recursively after data was moved
Ensure your data set names and pool names do not contain spaces as nfs does not play nice with that

Spoiler

image.thumb.png.959656659825b286271a83daa4935437.png

These settings are likely not the best and are not optimized in any way but doing this allowed everything to mount and work
This is also shared via samba so my windows machines can still access the data as well with the correct permissions

Again, emby is set with the uid, and gid the same as the details of my jamie user in truenas

Regards,
Jamie

Posted

Thanks for the feedback.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...