danergo 37 Posted August 7, 2025 Posted August 7, 2025 I added a *special* folder to library: my SD card. This comes in handy when I wish to access the SD card and preview its content, although it's a bit unortodox use-case for Emby - I know. This is a Debian system, and I'm on the latest (not beta) 4.8.11.0 version. Technical details: # Emby's library mount is /media/Mini4Pro, this is a mount point for my SD card. # I have checked some files, then ejected the SD card then shut down the system. # On reboot, I rescanned the library, but all previous files are remained in the library. # Who is owning /media? $ ls -all / | grep media drwxr-xr-x 1 emby emby 4096 Jul 13 19:17 media # What is in /media? $ ls -all /media/ total 144 drwxr-xr-x 1 emby emby 4096 Jul 13 19:17 . drwxr-xr-x 1 root root 4096 Aug 4 2017 .. drwxr-xr-x 3 emby emby 4096 Aug 29 2024 local drwxr-xr-x 6 emby emby 131072 Aug 7 19:26 storage I'm also attaching my log (debug enabled), which shows a full library scan, and it also shows when I try to play a file from that invalid library. Again, the problem is that the library's main folder (/media/Mini4Pro) is gone: Would you mind checking this, and see if it's an easy fix or doesn't worth fixing? Thank you embyserver(1).txt
Luke 42077 Posted August 7, 2025 Posted August 7, 2025 HI, when you remove a folder or library, the entries in the database start getting deleted in the background. Depending on the size of the library, this might take a little while.
danergo 37 Posted August 18, 2025 Author Posted August 18, 2025 Sorry @Luke, I haven't seen your reply. This database is very small (less than 100 items). Does it make sense to you? Thank you!
Luke 42077 Posted September 3, 2025 Posted September 3, 2025 @danergoare the folders still showing? How many Emby libraries have you created, and what folder paths are added to each one?
danergo 37 Posted September 3, 2025 Author Posted September 3, 2025 Hi @Luke: Yes, those folders are still showing. I have only 2 Emby libraries: "Home videos & photos" -> /media/storage "SD Card" -> /media/Mini4Pro Now /media/Mini4Pro is removed (SD card unmounted), but its content stayed in the library, but of course those videos are not playable.
danergo 37 Posted September 3, 2025 Author Posted September 3, 2025 I do have an error in the log during library scan (which takes 2 seconds only!) Version: 4.8.11.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}_arm64.deb Operating system: Linux version 6.1.99 (fa@jensen) (aarch64-linux-gcc (ctng-1.26.0-129g-FA) 14.2.0, GNU ld (GNU Binutils) 2.43.1) #33 SMP Tue Jan 21 11:32:39 CST 2025 Framework: .NET 6.0.36 OS/Process: arm64/arm64 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.DirectoryNotFoundException: System.IO.DirectoryNotFoundException: Could not find a part of the path '/media/Mini4Pro'. at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator`1.Init() at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options) at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized) at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at System.IO.DirectoryInfo.EnumerateFileSystemInfos(String searchPattern, EnumerationOptions enumerationOptions) at Emby.Server.Implementations.IO.ManagedFileSystem.EnumerateFileSystemInfos(DirectoryInfo dir, Boolean recursive) at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive, FileSystemCredentials credentials) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntriesInternal(String path) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path, Boolean clearCache) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path) at MediaBrowser.Controller.Entities.BaseItem.GetFileSystemChildren(IDirectoryService directoryService) at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService, LibraryOptions libraryOptions) at MediaBrowser.Controller.Entities.BaseItem.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, BaseItem[] collectionFolders, LibraryOptions libraryOptions, Dictionary`2 newItemIds, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) at Emby.Server.Implementations.Library.LibraryManager.ValidatePhysicalRoots(IProgress`1 progress, IDirectoryService directoryService, CancellationToken cancellationToken) Source: System.Private.CoreLib TargetSite: IntPtr CreateDirectoryHandle(System.String, Boolean) 2025-09-03 08:24:00.488 Info TaskManager: Scan media library Completed after 0 minute(s) and 2 seconds
Luke 42077 Posted September 9, 2025 Posted September 9, 2025 @danergowhen you tried to remove it, what exactly did you do?
danergo 37 Posted September 10, 2025 Author Posted September 10, 2025 @LukeI just ejected the SD card from the slot, ie. the path `/media/Mini4Pro` disappeared as that was the SD card's mountpoint. You can simulate the same behavior by removing a folder manually. Please note, my library is set to contain "/media/Mini4Pro". So the problem might be that library's root path is removed. But still this should not run onto error, but it should just hide/remove the library from the UI IMHO. What do you think?
Luke 42077 Posted September 10, 2025 Posted September 10, 2025 Actually I think it should remain visible everywhere until you remove it from library setup. Are you willing to start with a fresh database either now or when the 4.9 release hits? I believe this is already resolved in the sense that it won't happen again on newer releases. The question now though is how do you climb out of the hole and get this cleaned up.
danergo 37 Posted September 22, 2025 Author Posted September 22, 2025 On 9/10/2025 at 8:22 AM, Luke said: Actually I think it should remain visible everywhere until you remove it from library setup. Are you willing to start with a fresh database either now or when the 4.9 release hits? I believe this is already resolved in the sense that it won't happen again on newer releases. The question now though is how do you climb out of the hole and get this cleaned up. So you think starting a new library from scratch would solve this for me? Or shall I wait for 4.9 first? Thank you!
Luke 42077 Posted September 25, 2025 Posted September 25, 2025 On 9/22/2025 at 2:29 AM, danergo said: So you think starting a new library from scratch would solve this for me? Or shall I wait for 4.9 first? Thank you! With 4.9 coming any day now, it's probably best to wait and get a fresh database with that.
danergo 37 Posted September 29, 2025 Author Posted September 29, 2025 Hi @Luke, should I try it now with 4.9 Beta?
brothom 177 Posted September 29, 2025 Posted September 29, 2025 On 10/09/2025 at 07:34, danergo said: You can simulate the same behavior by removing a folder manually. Please note, my library is set to contain "/media/Mini4Pro". So the problem might be that library's root path is removed. But still this should not run onto error, but it should just hide/remove the library from the UI IMHO. Yep, this seems to only occur when an entire library's root folder is removed. I tried reproducing this as such: Created X:\Media\Movies\ <-- library X:\Media\Movies\Jurassic Park\Jurassic Park (1993)\Jurassic Park (1993).mkv X:\Media\Movies\Apocalypse Now (1979)\Apocalypse Now (1979).mkv Removed X:\Media\Movies\Jurassic Park\ Only Jurassic Park (1993) is removed Removed X:\Media\Movies\ All entries, previously within "X:\Media\Movies\" are still present in Emby and won't be deleted automatically. This logic is prefectly sensible, if a drive is disconnected or corrupted (usually by accident) the media entries are persisted. If you were to remove the library itself, the media entries that were in this library are also removed. What's stopping you from removing your library attached to "/media/Mini4Pro"? 1
danergo 37 Posted October 1, 2025 Author Posted October 1, 2025 (edited) I have different SD cards: Mini4Pro MySD1 MySD2 All are included in the library. But, obviously only one (or zero) is inserted at once => I wish either all or all but one to disappear on library scan (without removing them from the library config!) Edited October 1, 2025 by danergo
GrimReaper 4739 Posted October 1, 2025 Posted October 1, 2025 3 hours ago, danergo said: I have different SD cards: Mini4Pro MySD1 MySD2 All are included in the library. But, obviously only one (or zero) is inserted at once => I wish either all or all but one to disappear on library scan (without removing them from the library config!) That is not feasible, as Emby won't remove items from the library if whole mount point is disconnected/unreachable/offline (as @brothomsurmised above), a feature number of users, in particular those with network drives, asked for - only if folders/files underneath are not present, those items will be removed. You'll have to rethink your workflow. On 9/21/2022 at 11:52 PM, Luke said: If the entire mount is unreachable, then it stays in the library and the server assumes it is offline. But the mount is reachable and some folder underneath that is gone, then the server treats that as content having been deleted. 1
danergo 37 Posted October 2, 2025 Author Posted October 2, 2025 Did you guys see my error post above? Library scan clearly run onto an error in case that root folder (from library perspective) is removed. That's why I thought it's possible to remove that library folder automatically.
Luke 42077 Posted October 2, 2025 Posted October 2, 2025 On 9/22/2025 at 2:29 AM, danergo said: So you think starting a new library from scratch would solve this for me? Or shall I wait for 4.9 first? Thank you! Yea with 4.9 out now, it would be a good time for that.
danergo 37 Posted October 4, 2025 Author Posted October 4, 2025 @LukeI have just tried it with 4.9, but error is still showing up: 2025-10-04 11:38:50.235 Info App: ValidatePhysicalRoots validating 3618 Mini4Pro /media/Mini4Pro 2025-10-04 11:38:50.244 Info HttpClient: GET https://api.github.com/repos/MediaBrowser/Emby.Releases/releases 2025-10-04 11:38:50.245 Info HttpClient: Http response served from cache from https://api.github.com/repos/MediaBrowser/Emby.Releases/releases 2025-10-04 11:38:50.271 Info TaskManager: Queueing task SubtitleOcrDataTask 2025-10-04 11:38:50.272 Info TaskManager: Executing Download OCR Data 2025-10-04 11:38:50.383 Error App: Error in validateChildren for 3618 /media/Mini4Pro *** Error Report *** Version: 4.9.1.80 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}_arm64.deb Operating system: Linux version 6.1.99 (fa@jensen) (aarch64-linux-gcc (ctng-1.26.0-129g-FA) 14.2.0, GNU ld (GNU Binutils) 2.43.1) #33 SMP Tue Jan 21 11:32:39 CST 2025 OS/Process: arm64/arm64 Framework: .NET 8.0.11 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.DirectoryNotFoundException: System.IO.DirectoryNotFoundException: Could not find a part of the path '/media/Mini4Pro'. at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator`1.Init() at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized) at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at Emby.Server.Implementations.IO.ManagedFileSystem.EnumerateFileSystemInfos(DirectoryInfo dir, Boolean recursive) at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive, FileSystemCredentials credentials) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntriesInternal(String path) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path, Boolean clearCache) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path) at MediaBrowser.Controller.Entities.BaseItem.GetFileSystemChildren(IDirectoryService directoryService) at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService, BaseItem[] collectionFolders, LibraryOptions libraryOptions) at MediaBrowser.Controller.Entities.BaseItem.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, BaseItem[] collectionFolders, LibraryOptions libraryOptions, Dictionary`2 newItemIds, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) at Emby.Server.Implementations.Library.LibraryManager.ValidatePhysicalRoots(IProgress`1 progress, IDirectoryService directoryService, CancellationToken cancellationToken) Source: System.Private.CoreLib TargetSite: IntPtr CreateDirectoryHandle(System.String, Boolean) And cached library files still showing up. I believe it should be feasible to add a "dynamic" option to library preferences: by default it should be turned OFF (=current behavior), but when it's ON: unavailable files are not resulting errors but getting removed instantly from this "dynamic" library. What do you think? My second option is to just add "/media" as library, but I really don't wish to add that huge folder (just to let the ejected SD card files disappear).
Lessaj 467 Posted October 4, 2025 Posted October 4, 2025 I'm not entirely clear on what you want to have happen here, but it sounds like you actually -want- the library to be empty when the SD card(s) are removed. Is that right? If that is the case, then what you should do based on what you provided in the first post is you need to create the folder for the mount point, such as /media/Mini4Pro (set permissions/ownership accordingly, it can change once a FS is mounted to it), and then mount the SD filesystem to it. I'm not sure how this is being handled presently but your initial post did not show that there is a Mini4Pro folder under /media so I'm assuming it doesn't exist. By creating this folder before you mount the file system to it when it is unmounted then the folder will appear empty, if you have RTM enabled or just run a library scan Emby will detect that and clear out any items related to it. It's only failing to do that now because the folder doesn't exist at all, so it's keeping the items. If this folder is created as part of whatever you're using to mount it, either automatically by your DE or some other program, then I can see that being challenging but not impossible to solve. You can just create fstab entries that don't try to mount automatically on boot (cause they'll fail) and then whenever you attach whichever SD card you can sudo mount /path/to/dir. At that point with either RTM or a library scan Emby will see the new content and start to add it.
Luke 42077 Posted October 4, 2025 Posted October 4, 2025 8 hours ago, danergo said: @LukeI have just tried it with 4.9, but error is still showing up: 2025-10-04 11:38:50.235 Info App: ValidatePhysicalRoots validating 3618 Mini4Pro /media/Mini4Pro 2025-10-04 11:38:50.244 Info HttpClient: GET https://api.github.com/repos/MediaBrowser/Emby.Releases/releases 2025-10-04 11:38:50.245 Info HttpClient: Http response served from cache from https://api.github.com/repos/MediaBrowser/Emby.Releases/releases 2025-10-04 11:38:50.271 Info TaskManager: Queueing task SubtitleOcrDataTask 2025-10-04 11:38:50.272 Info TaskManager: Executing Download OCR Data 2025-10-04 11:38:50.383 Error App: Error in validateChildren for 3618 /media/Mini4Pro *** Error Report *** Version: 4.9.1.80 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}_arm64.deb Operating system: Linux version 6.1.99 (fa@jensen) (aarch64-linux-gcc (ctng-1.26.0-129g-FA) 14.2.0, GNU ld (GNU Binutils) 2.43.1) #33 SMP Tue Jan 21 11:32:39 CST 2025 OS/Process: arm64/arm64 Framework: .NET 8.0.11 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.DirectoryNotFoundException: System.IO.DirectoryNotFoundException: Could not find a part of the path '/media/Mini4Pro'. at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator`1.Init() at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized) at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at Emby.Server.Implementations.IO.ManagedFileSystem.EnumerateFileSystemInfos(DirectoryInfo dir, Boolean recursive) at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive, FileSystemCredentials credentials) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntriesInternal(String path) at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path, Boolean clearCache) at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path) at MediaBrowser.Controller.Entities.BaseItem.GetFileSystemChildren(IDirectoryService directoryService) at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService, BaseItem[] collectionFolders, LibraryOptions libraryOptions) at MediaBrowser.Controller.Entities.BaseItem.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, BaseItem[] collectionFolders, LibraryOptions libraryOptions, Dictionary`2 newItemIds, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService) at Emby.Server.Implementations.Library.LibraryManager.ValidatePhysicalRoots(IProgress`1 progress, IDirectoryService directoryService, CancellationToken cancellationToken) Source: System.Private.CoreLib TargetSite: IntPtr CreateDirectoryHandle(System.String, Boolean) And cached library files still showing up. I believe it should be feasible to add a "dynamic" option to library preferences: by default it should be turned OFF (=current behavior), but when it's ON: unavailable files are not resulting errors but getting removed instantly from this "dynamic" library. What do you think? My second option is to just add "/media" as library, but I really don't wish to add that huge folder (just to let the ejected SD card files disappear). Did you start with a fresh library database like we talked about?
danergo 37 Posted October 4, 2025 Author Posted October 4, 2025 1 hour ago, Luke said: Did you start with a fresh library database like we talked about? I deleted then re-created a new fresh library, and added the SDcard location to it.
Luke 42077 Posted October 4, 2025 Posted October 4, 2025 Quote I deleted then re-created a new fresh library What were the exact steps taken?
danergo 37 Posted October 5, 2025 Author Posted October 5, 2025 6 hours ago, Luke said: What were the exact steps taken? 1. Updated to 4.9 stable 2. Removed the sdcard library item from the libraries 3. Create a new library named "SD Card" and tried to add manually the folder "/media/Mini4Pro" -> didn't succeed as the path was invalid (sdcard was not inserted). 4. Insert the sd card 5. Repeat step3 with success. 6. Library scan for "SD Card" 7. Eject the card 8. Library scan for "SD Card" 9. Observing the above error
Luke 42077 Posted October 9, 2025 Posted October 9, 2025 OK what I actually meant was a fresh server database, which will result in a lot of things being reset. Is that OK?
danergo 37 Posted October 9, 2025 Author Posted October 9, 2025 @Lukesure thing. Shall I uninstall Emby first to reach a clean database or do I have a better approach? Thank you!
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