orbosphere 3 Posted May 20, 2021 Share Posted May 20, 2021 (edited) Hello, I'm running an Emby server on my Raspberry Pi, and I seem to be having trouble with scanning my library. I have two folders on the pi, "Movies", and "TV". Files are being shared on my network with SMB from an external drive attached to my router. The Pi mounts the SMB respective Movies and TV shares to /home/pi/readyshare/movies and /home/pi/readyshare/tv. Then in Emby, I have two libraries- one for TV, one for Movies. The strange thing is that the TV library is scanning in just fine, but for some reason, the Movies library either is not scanning or is saying 0 items found. Attached is a log file. I've tried to comb through it to look for any clues about why my Movies library isn't being scanned properly, but I'm not finding anything obvious. I've tried deleting my Emby libraries & re-adding them, rebooting my Pi server, clicked "Scan Library Files" everywhere I can find it... but no luck. Here's the other strange thing- at one point, I had both libraries scanning in correctly. On my first setup attempt with Emby, I added the libraries with direct network paths to the SMB share. It scanned all my files in correctly, but I was having issues with playback for some reason. After searching the forums, I found a suggestion that I should try mounting the shares to actual directories on my Pi, and then add those folders as the library paths in Emby. So I tried that- and set the optional network path in Emby to the SMB address. This resolved my playback issue! But, for some reason, the "Movies" library will not scan in any files no matter what I do. I don't think there is any permissions issue- both "Movies" and "TV" directories on my Pi have full permissions enabled. Please let me know if you have any tips on how to get my Movies library to properly scan files into Emby. Thanks! embyserver.txt Edited May 20, 2021 by orbosphere Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 20, 2021 Share Posted May 20, 2021 Hi, did you ensure the server has permissions to read the folders? Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 16 minutes ago, Luke said: Hi, did you ensure the server has permissions to read the folders? I don't suspect permissions to be the issue, but is there somewhere else I need to check? Here are the permissions on the directories. There isn't any difference between the two, and tv is working/scanning files just fine. pi@raspberrypi:~/readyshare $ ls -l total 0 drwxrwxrwx 1 501 root 0 May 17 10:52 movies drwxrwxrwx 1 501 root 0 May 18 11:15 tv Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 Here's a video that shows my library scan process. If I hover on my Movies library entry, and then select "Scan Library Files", a message briefly pops up saying it is scanning, but nothing is found. If I select "Scan Library Files" at the top of this view, a different progress bar appears, and a circular progress bar appears only on the TV library. I can then go check the scheduled task and see it continue to make progress. This takes a little bit, but upon finishing, my Movies library still reports 0 items. Screen Recording 2021-05-20 at 8.25.52 AM.mp4 Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 I've since moved my SMB mounts to /mnt/readyshare/tv and /mnt/readyshare/movies, I've ensured the permissions of those directories have rwx for a group that contains the "emby" user, and I've modified my /etc/fstab that does the mounting to ensure it mounts with the group id set to that group as well. Unfortunately, no luck. Same deal.. I can remove/re add a library to Emby, select my movies directory, try to scan.. doesn't seem like it is able to scan my movies in. I also re-tested by adding the library and directly pointing to the SMB address, instead of the mounted folder on linux. In that case, the scan works, it begins reading in my movies. But playback doesn't seem to work on my iOS / appleTV devices for some reason.. (although those same SMB shares play just fine via VLC or Kodi) So I'm hoping to get the mounted-through-linux shares to work, because playback through Emby then works. I'm completely stumped why my TV folder is scanning just fine, while the adjacent Movies folder seems like it just can't be read by Emby... Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted May 20, 2021 Share Posted May 20, 2021 (edited) Can you post another log as previous log shows "Not a directory" issue for both libraries. But there are other topics where TV has worked and Movies have not just like you have shown and always comes back to permissions. But a Linux guru will have to comment further. Have you look at this File Permissions Guide for New Linux Users Edited May 20, 2021 by Happy2Play Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 (edited) sure- yeah I can understand how its likely a permissions issue. But it has me stumped, here's my latest test: user "emby" is in group "homebridge" that group is set for the following directories: pi@raspberrypi:/mnt $ getent group homebridge homebridge:x:995:homebridge,emby pi@raspberrypi:/mnt $ ls readyshare pi@raspberrypi:/mnt $ cd readyshare/ pi@raspberrypi:/mnt/readyshare $ ls -l total 0 drwxrwxrwx 1 501 homebridge 0 May 17 10:52 movies drwxrwxrwx 1 501 homebridge 0 May 18 11:15 tv pi@raspberrypi:/mnt/readyshare $ I've mounted SMB shares to these two directories using the following entries in my /etc/fstab: //192.168.1.1/Video/TV /mnt/readyshare/tv cifs username=Anonymous,password=Anonymous,gid=homebridge,dir_mode=0777,file_mode=0777,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1,vers=1.0 0 //192.168.1.1/Video/Movies /mnt/readyshare/movies cifs username=Anonymous,password=Anonymous,gid=homebridge,dir_mode=0777,file_mode=0777,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1,vers=1.0 0 potential issue from log: 2021-05-20 17:47:46.628 Error LibraryMonitor: Error watching path: /mnt/readyshare/movies *** Error Report *** Version: 4.6.0.50 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}_armhf.deb Operating system: Linux version 4.19.66-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 12:02:08 BST 2019 Framework: .NET Core 3.1.13 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system System.IO.IOException: System.IO.IOException: Not a directory at System.IO.Enumeration.FileSystemEnumerator`1.FindNextEntry(Byte* entryBufferPtr, Int32 bufferLength) at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext() at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken) at System.IO.FileSystemWatcher.StartRaisingEvents() at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) at Emby.Server.Implementations.IO.LibraryMonitor.<>c__DisplayClass37_0.<StartWatchingPath>b__0() Source: System.IO.FileSystem TargetSite: Void FindNextEntry(Byte*, Int32) I guess next I'll try to be explicit about permissions for user emby rather than the group I added emby to... embyserver-4.txt Edited May 20, 2021 by orbosphere Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 20, 2021 Share Posted May 20, 2021 Have you taken a look at this? Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 thanks, yes I've looked at that. But now after reading through it again more closely, as that post suggests, I've ensured my fstab entries include: "rw,uid=username,gid=groupname" to the mount options (user emby, group homebridge) My movies dir, and its contents: drwxrwxrwx 1 emby homebridge 0 May 17 10:52 movies drwxrwxrwx 1 emby homebridge 0 May 18 11:15 tv -rwxrwxrwx 1 emby homebridge 1540666427 Apr 27 2014 Up. -rwxrwxrwx 1 emby homebridge 778619610 Oct 24 2015 Vac -rwxrwxrwx 1 emby homebridge 733988864 Aug 6 2006 'V F drwxrwxrwx 1 emby homebridge 0 Mar 31 2019 'Vol -rwxrwxrwx 1 emby homebridge 1293552945 Aug 31 2013 WAL -rwxrwxrwx 1 emby homebridge 52183 Aug 31 2013 WAL -rwxrwxrwx 1 emby homebridge 733997056 Nov 17 2005 'War -rwxrwxrwx 1 emby homebridge 733999104 Nov 17 2005 'War -rwxrwxrwx 1 emby homebridge 3057181910 Jan 9 14:04 'Wat -rwxrwxrwx 1 emby homebridge 805993264 Nov 7 2015 'We -rwxrwxrwx 1 emby homebridge 735948800 Dec 5 2008 'Wed -rwxrwxrwx 1 emby homebridge 911602334 Nov 2 2013 "We' Log still shows this error when I after I try to initiate a scan: 2021-05-20 18:17:10.206 Debug TaskManager: Scan media library Completed after 0 minute(s) and 2 seconds 2021-05-20 18:17:10.511 Error LibraryMonitor: Error watching path: /mnt/readyshare/movies *** Error Report *** Version: 4.6.0.50 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}_armhf.deb Operating system: Linux version 4.19.66-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 12:02:08 BST 2019 Framework: .NET Core 3.1.13 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system System.IO.IOException: System.IO.IOException: Not a directory at System.IO.Enumeration.FileSystemEnumerator`1.FindNextEntry(Byte* entryBufferPtr, Int32 bufferLength) at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext() at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken) at System.IO.FileSystemWatcher.StartRaisingEvents() at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) at Emby.Server.Implementations.IO.LibraryMonitor.<>c__DisplayClass37_0.<StartWatchingPath>b__0() Source: System.IO.FileSystem TargetSite: Void FindNextEntry(Byte*, Int32) embyserver-6.txt Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 20, 2021 Author Share Posted May 20, 2021 I've run another test- I installed Emby Server on another machine, this time running macOS. Otherwise setup is the same- the same SMB shares are mounted on this Mac. I setup emby library for movies, and point it to /Volumes/Video/Movies, which is where the Mac sees this mounted SMB share. I also set the optional network path as smb://readyshare/Video/Movies I save it, initiate scan, BAM! it works. So what's different about emby's Mac server from the linux server? OR what's going wrong about my mounted SMB share on linux? I'd still really like to solve this, as I'd rather run Emby on my Pi which is already always-on, and not a Mac laptop that isn't meant for that type of use... Please let me know if there is any additional info I can provide about my linux emby setup. Thanks. Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 21, 2021 Author Share Posted May 21, 2021 Ok, sorry for the trouble- never mind on this. I re-added via SMB directly and didn’t bother with the Linux mounts. The scanning worked, and playback on iOS is working fine now as well. I’ll just go with this setup… Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 21, 2021 Share Posted May 21, 2021 48 minutes ago, orbosphere said: Ok, sorry for the trouble- never mind on this. I re-added via SMB directly and didn’t bother with the Linux mounts. The scanning worked, and playback on iOS is working fine now as well. I’ll just go with this setup… Thanks for the feedback. Truthfully this is not the suggested approach anymore, although if you're happy, we're happy Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 21, 2021 Author Share Posted May 21, 2021 45 minutes ago, Luke said: Thanks for the feedback. Truthfully this is not the suggested approach anymore, although if you're happy, we're happy Are there any known drawbacks? I've now tested playback on iOS & appleTV and it is working for me, so I'm happy! On my first setup attempt I was seeing playback failures, and the logs were showing some kind of SMBClient errors, so I bailed on that early on. Not sure why this time its different... but things are working for now so I should stop messing with it! Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 21, 2021 Share Posted May 21, 2021 The SMB implementation you get from your host OS is more complete than the one we've embedded in emby server. But for basic usage, you might be fine. Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 23, 2021 Author Share Posted May 23, 2021 Unfortunately looks like I am still having some trouble. The setup worked for a few days- I had success watching some TV shows in lower file quality. But tonight I tried watching some movies in 1080, and the system seems to choke- the video stutters / freezes every second or so. I then rebooted my Pi, tried again, and now it seems it cannot play at all. Server is on the Raspberry Pi 4 Emby app is on AppleTV They are on wifi, but I strongly do not think that is my issue. I can play the exact same 1080 video files on my appleTV without any issues through the VLC app or Kodi. Its only in Emby where I am getting the really severe stutter (and now playback failing entirely). So I suspect the system is trying to transcode and having issues with that? But I really do not want it to transcode at all- I want direct play of my files over SMB. Because the playback works great with VLC or Kodi... (but I'm dying to switch to Emby for its better UI & state sync between multiple devices!) My appleTV Emby app has its playback settings set to the best network possible- 4K 120Mb. But based on the logs, it seems that it is trying to transcode anyway. Is there any way to FORCE direct playback only? The other strange thing... the server dashboard seems to show that Emby thinks its providing direct playback. But logging seems to indicate ffmpeg is firing up but having issues. If ffmpeg is being used on the server side, doesn't that imply its trying to do some kind of transcoding? Attached is the screenshot from the dashboard where Emby says "Direct playing". At this time my TV screen is just black- it is not actually playing. But check the attached logs- ffmpeg is trying and failing. And it looks like possibly an SMB issue as well. But I have also just tested this exact file, over SMB, with the VLC AppleTV app, and playback works flawlessly- I just tested it a minute ago. I've also tried the emby player on AppleTV using MPV player on and off- neither is working for me right now. My perfect scenario would be 100% disabling any type of transcoding / ffmpeg usage, and use Emby just to deliver the library and thumbnails / media info, and the path to the file. I want my playback to be direct usage of the file over SMB without Emby doing anything in between. Please let me know if you have any other troubleshooting ideas. I really love what I can see in Emby- I had been working on writing similar software myself and would much rather save the time and just use Emby instead, if I can get it to work! and I think I'm very close... Thanks embyserver-2.txt ffmpeg-directstream-99901458-4822-4af9-b64d-638ca0899197_1.txt Link to comment Share on other sites More sharing options...
Luke 37099 Posted May 23, 2021 Share Posted May 23, 2021 OK yea this is where I would suggest going back to mounting the SMB shares in the operating system first to a local path, and then adding the local path into Emby Server. Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 23, 2021 Author Share Posted May 23, 2021 (edited) Ok, thanks- I've now tried that, but back to the original problem. Scanning for files is finding 0 files in that library. I've read the linux file permissions guide. I've mounted the SMB shares with ownership of the directories set to the "emby" user. SMB shares are mounted via these entries in fstab: //192.168.1.1/Video/TV /mnt/readyshare/tv cifs username=Anonymous,password=Anonymous,rw,uid=emby,gid=homebridge,dir_mode=0777,file_mode=0777,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1,vers=1.0 0 //192.168.1.1/Video/Movies /mnt/readyshare/movies cifs username=Anonymous,password=Anonymous,rw,uid=emby,gid=homebridge,dir_mode=0777,file_mode=0777,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1,vers=1.0 0 drwxrwxrwx 1 emby homebridge 0 May 22 21:52 movies drwxrwxrwx 1 emby homebridge 0 May 18 11:15 tv Files inside these folders have the same permissions as well. Still same problem- scan files on this library is not finding anything. Emby server on macOS was able to scan it.. I feel like I have the permissions set correctly for my mounted SMB shares, they are owned by "emby" and that user has rwx on the files & folders. Is there anything else I'm missing? Or additional debug steps I can follow to try and identify what's going wrong? Thanks. embyserver-4.txt Edited May 23, 2021 by orbosphere Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 24, 2021 Author Share Posted May 24, 2021 It looks like whenever I try to scan files, I get this error in the log: 2021-05-24 11:03:43.157 Error LibraryMonitor: Error watching path: /home/pi/readyshare/movies *** Error Report *** Version: 4.6.0.50 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}_armhf.deb Operating system: Linux version 4.19.66-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1253 SMP Thu Aug 15 12:02:08 BST 2019 Framework: .NET Core 3.1.13 OS/Process: arm/arm Runtime: opt/emby-server/system/System.Private.CoreLib.dll Processor count: 4 Data path: /var/lib/emby Application path: /opt/emby-server/system System.IO.IOException: System.IO.IOException: Not a directory at System.IO.Enumeration.FileSystemEnumerator`1.FindNextEntry(Byte* entryBufferPtr, Int32 bufferLength) at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext() at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance.AddDirectoryWatchUnlocked(WatchedDirectory parent, String directoryName) at System.IO.FileSystemWatcher.RunningInstance..ctor(FileSystemWatcher watcher, SafeFileHandle inotifyHandle, String directoryPath, Boolean includeSubdirectories, NotifyFilters notifyFilters, CancellationToken cancellationToken) at System.IO.FileSystemWatcher.StartRaisingEvents() at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) at Emby.Server.Implementations.IO.LibraryMonitor.<>c__DisplayClass37_0.<StartWatchingPath>b__0() Source: System.IO.FileSystem TargetSite: Void FindNextEntry(Byte*, Int32) But on the Pi, I can navigate into that directory and view its contents of video files and other directories without issue. And user "emby" is set as owner with full permissions. On the pi it seems to be treated as a directory just fine, but something about Emby server is getting tripped up by it. Link to comment Share on other sites More sharing options...
Solution Q-Droid 653 Posted May 24, 2021 Solution Share Posted May 24, 2021 (edited) I don't have access to a Pi or mess with CIFS/SMB for Emby but you can try this to see if there is an access/permissions problem for the emby user. sudo su -s /usr/bin/bash emby find /home/pi/readyshare/movies > /dev/null Any output you get should point to an error. In the case of no output then it means the emby user was able to access movies and all sub-directories in that path. Then you can try this to cover more bases. find /home/pi/readyshare/movies -ls > /dev/null Edited May 24, 2021 by Q-Droid 1 Link to comment Share on other sites More sharing options...
orbosphere 3 Posted May 25, 2021 Author Share Posted May 25, 2021 1 hour ago, Q-Droid said: I don't have access to a Pi or mess with CIFS/SMB for Emby but you can try this to see if there is an access/permissions problem for the emby user. sudo su -s /usr/bin/bash emby find /home/pi/readyshare/movies > /dev/null Any output you get should point to an error. In the case of no output then it means the emby user was able to access movies and all sub-directories in that path. Then you can try this to cover more bases. find /home/pi/readyshare/movies -ls > /dev/null Thank you very much for this tip- This command: find /home/pi/readyshare/movies > /dev/null led me to find that one specific directory in my movies folder seems to have been causing the issue. I don't know why... but the output of this command said: find: ‘/home/pi/readyshare/movies/Coco (2017) 1080p ’: Not a directory That directory couldn't be opened from the Pi for some reason. But my Mac had no issue opening that directory and viewing its contents. The permissions that my Mac saw of of the offending folder: drwxrwxrwx@ 1 jhays staff 16384 May 17 10:48 Coco (2017) 1080p So I created a new folder, moved the contents to that one, and deleted the offending folder. I then went to Emby server settings and initiated Scan Library Files- success! Emby started pulling down meta data for my movies. Now testing on my AppleTV- I'm still seeing some cases where transcoding is initiating and failing on certain files. But others are playing fine without transcoding. That seems like a separate issue- I'll do some further testing and open a new thread if needed. For now I'll consider this issue fixed- thanks to everyone who offered support, and major thanks to Q-Droid for his big hint that helped me out. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now