Jump to content

EmbyServer on Kubuntu can create files, but cant write it


Darky0815

Recommended Posts

Darky0815

Hello!

I recently moved emby to a dedicated server. I installed Kubuntu and added cifs-commons (sudo apt install cifs-commons).

My media is on a Synology Diskstation DS918. The config of the library is set to store nfo files and pics alongside the movie in the corresponding movie-folder.

In my understanding (after reading a lot of similar problems from other people) that emby is using the user "emby" for file-access.

As mentioned from @Lukein different threads, in ubuntu the access to a smb-shares should be done via mounting the share and accessing the mount-point (because there all the user/passwd magic happens).

The persmissions on the Diskstations are set to read/write allowed for a user called "media"

So I added the following to my /etc/fstab (credentials are stored in the separate file /etc/samba/cred_media.txt):
//DS918.HomeNet/Media   /media/DS918_Media   cifs   uid=emby,gid=emby,vers=3.0,credentials=/etc/samba/cred_media.txt,file_mode=0770,dir_mode=0770 0 0

A quick look in the /media folder shows (right before mounting):

drwxr-xr-x  2 root root 4096 Apr 13 22:28 DS918_Media/
 

After mounting (sudo mount /media/DS918_Media):
drwxrwxrwx  2 emby emby    0 Apr 15 08:13 DS918_Media/

 

As current logged on user I can create and write/save files inside the folder structure of DS918_Media with no problems at all.

I can also impersonate the emby user ( sudo su -s /bin/bash emby ) --> Also no problems in creating, writing and saving files:
- I go into any subdirectory
- try touch x.x --> OK
- try nano x.x --> put in some stuff --> save and exit

-rwxrwxrwx 1 emby emby          9 Apr 15 09:43  x.x*
Voila - there is the file x.x with 9 Bytes in size.

 

My problem is, that emby - during the media scan - creates .nfo files with 0 (zero) bytes filesize. The log-file states that there is no write access (for testing a added a new movie before the scan):

2021-04-15 08:43:19.748 Debug App: Running FFProbeProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.748 Info MediaProbeManager: ProcessRun 'ffprobe' Execute: /opt/emby-server/bin/ffprobe -i file:"/media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv" -threads 0 -v info -print_format json -show_streams -show_chapters -show_format -show_data
2021-04-15 08:43:19.748 Debug MediaProbeManager: ProcessRun 'ffprobe' Started.
2021-04-15 08:43:19.827 Info MediaProbeManager: ProcessRun 'ffprobe' Process exited with code 0
2021-04-15 08:43:19.839 Debug App: Running MovieNfoProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.841 Debug App: MovieNfoProvider returned no metadata for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.841 Debug App: Running MovieDbProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.841 Info App: MovieDbProvider: Finding id for item: Aladdin
2021-04-15 08:43:19.841 Info HttpClient: GET https://api.themoviedb.org/3/search/movie?api_key=f6bd687ffa63cd282b6ff2c6877f2669&query=Aladdin&language=de
2021-04-15 08:43:19.873 Debug App: Running OmdbItemProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.876 Debug App: Running MovieDbImageProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.881 Info HttpClient: GET https://image.tmdb.org/t/p/original/hQYPVTGdpYAVX325fflq41Z4o2X.jpg
2021-04-15 08:43:19.917 Debug ProviderManager: Saving image to /media/DS918_Media/Kinderfilme/Aladdin.1992/poster.jpg
2021-04-15 08:43:19.922 Error ProviderManager: UnauthorizedAccessException: Emby Server is being write access to /media/DS918_Media/Kinderfilme/Aladdin.1992/poster.jpg. Please check your file permissions. Will retry saving to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/poster.jpg
2021-04-15 08:43:19.922 Debug ProviderManager: Saving image to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/poster.jpg
2021-04-15 08:43:19.924 Info HttpClient: GET https://image.tmdb.org/t/p/original/5OeY4U2rzePxWq2rkqMajUx2gz7.jpg
2021-04-15 08:43:19.971 Debug ProviderManager: Saving image to /media/DS918_Media/Kinderfilme/Aladdin.1992/fanart.jpg
2021-04-15 08:43:19.977 Error ProviderManager: UnauthorizedAccessException: Emby Server is being write access to /media/DS918_Media/Kinderfilme/Aladdin.1992/fanart.jpg. Please check your file permissions. Will retry saving to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/backdrop.jpg
2021-04-15 08:43:19.978 Debug ProviderManager: Saving image to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/backdrop.jpg
2021-04-15 08:43:19.979 Debug App: Running FanartMovieImageProvider for /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv
2021-04-15 08:43:19.981 Info HttpClient: GET https://assets.fanart.tv/fanart/movies/812/hdmovielogo/aladdin-51eefdc189e15.png
2021-04-15 08:43:20.044 Debug ProviderManager: Saving image to /media/DS918_Media/Kinderfilme/Aladdin.1992/clearlogo.png
2021-04-15 08:43:20.049 Error ProviderManager: UnauthorizedAccessException: Emby Server is being write access to /media/DS918_Media/Kinderfilme/Aladdin.1992/clearlogo.png. Please check your file permissions. Will retry saving to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/clearlogo.png
2021-04-15 08:43:20.049 Debug ProviderManager: Saving image to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/clearlogo.png
2021-04-15 08:43:20.049 Info HttpClient: GET https://assets.fanart.tv/fanart/movies/812/moviethumb/aladdin-51b4a138b6a6e.jpg
2021-04-15 08:43:20.154 Debug ProviderManager: Saving image to /media/DS918_Media/Kinderfilme/Aladdin.1992/landscape.jpg
2021-04-15 08:43:20.160 Error ProviderManager: UnauthorizedAccessException: Emby Server is being write access to /media/DS918_Media/Kinderfilme/Aladdin.1992/landscape.jpg. Please check your file permissions. Will retry saving to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/landscape.jpg
2021-04-15 08:43:20.160 Debug ProviderManager: Saving image to /var/lib/emby/metadata/library/87/87c0cc44d9fb60d67aa9c336e1606c0d/landscape.jpg
2021-04-15 08:43:20.195 Debug ProviderManager: Saving /media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.mkv to Nfo.
2021-04-15 08:43:20.200 Error ProviderManager: Error in metadata saver
	*** Error Report ***
	Version: 4.5.4.0
	Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
	Operating system: Linux version 5.8.0-49-generic (buildd@lcy01-amd64-026) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #55-Ubuntu SMP
	Framework: .NET Core 3.1.8
	OS/Process: x64/x64
	Runtime: opt/emby-server/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: /var/lib/emby
	Application path: /opt/emby-server/system
	System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.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.WriteSpan(ReadOnlySpan`1 source)
	   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
	   at NfoMetadata.Savers.BaseNfoSaver.SaveToFile(Stream stream, String path)
	   at NfoMetadata.Savers.BaseNfoSaver.Save(BaseItem item, 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: 

Any idea what is going on and how to fix this would be highly appreciated 🙂

Greetings

Darky

 

 

 



 


 

Link to comment
Share on other sites

mastrmind11

and you're sure the server is running as emby?  why is the user on the diskstation media and not emby?  just some ideas.

Link to comment
Share on other sites

Darky0815

I could change the user to emby on the Diskstation - would it be benefical? I will try it out.

But I thought that because I was able to write after changing the user to emby in the terminal (sudo su -s /bin/bash emby ) there would be no problem there!?

------

I tried it out and changed the fstab to use a user called emby which has also rw-access on the diskstation.

Same result and behaviour as before:

2021-04-15 14:59:02.282 Error ProviderManager: Error in metadata saver
	*** Error Report ***
	Version: 4.5.4.0
	Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
	Operating system: Linux version 5.8.0-49-generic (buildd@lcy01-amd64-026) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #55-Ubuntu SMP
	Framework: .NET Core 3.1.8
	OS/Process: x64/x64
	Runtime: opt/emby-server/system/System.Private.CoreLib.dll
	Processor count: 8
	Data path: /var/lib/emby
	Application path: /opt/emby-server/system
	System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/media/DS918_Media/Kinderfilme/Aladdin.1992/Aladdin.1992.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.WriteSpan(ReadOnlySpan`1 source)
	   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
	   at System.IO.MemoryStream.CopyTo(Stream destination, Int32 bufferSize)
	   at System.IO.Stream.CopyTo(Stream destination)
	   at NfoMetadata.Savers.BaseNfoSaver.SaveToFile(Stream stream, String path)
	   at NfoMetadata.Savers.BaseNfoSaver.Save(BaseItem item, 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: 

I found some additional information: According to some posts, it is necessary that the emby user in ubuntu and the emby user on diskstation need to have the same internal ID, but Iḿ not sure if this applies to my problem, too?

Edited by Darky0815
Additional text - result of testing
Link to comment
Share on other sites

Darky0815
1 hour ago, mastrmind11 said:

and you're sure the server is running as emby?  why is the user on the diskstation media and not emby?  just some ideas.

How could I verify which user is used? When I take a look at

ps -ef|grep emby

I can see this:

emby         677       1  0 14:49 ?        00:00:26 /opt/emby-server/system/EmbyServer -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server /bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
 

SO it looks for me, that "emby" is the correct user

Edited by Darky0815
clarification, testresult
Link to comment
Share on other sites

mastrmind11

strange.  im not an smb guy but your fstab looks correct.  can you switch to NFS and see if that works properly?

Link to comment
Share on other sites

Darky0815
17 hours ago, mastrmind11 said:

strange.  im not an smb guy but your fstab looks correct.  can you switch to NFS and see if that works properly?

Good idea. Thank you. I managed to link my diskstation using NFS. Now it is working.

😀

  • Like 1
Link to comment
Share on other sites

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...