Random episodes on disk not found/ignored (old SB Library)

Hey!

Yesterday I tried Sonarr for the first time on my raspberry pi 2. It does look very promising, but there’s a big issue for me: some old episodes on the disk are not recognized as downloaded.

I tried reinstalling Sonarr, upgrading Mono (3.10 and 4.0.1), rescanning the folders - nothing helped. To help clear up my issue, please see the following screenshots:


It is possible that this only applies to the current season, but I’m pretty sure some series had 4 episodes recognized, somewhere in the middle of the current season with more recent episodes that haven’t been. Starting sonarr with --debug didn’t change the console output either.
This happens in the master branch as well as the develop branch (updating doesn’t work btw, had to do the apt way - no errors in the log, but it didn’t restart although it said so).

Any ideas what I could try? Thanks!

Check the permissions on the files from the rpi2 the user/group will need read/write access to the sorted TV directory to read existing files and import new files.

Thank you!

The daemon runs by the local pi user, from the init.d script:

RUN_AS=pi

I confirmed the process running as the pi user with htop.

All the files (Arrow and TBBT, even across multiple seasons) are having the following permissions:

-rw-rw-rw- 1 pi pi

So that should be fine, even if some subprocess may not run as pi.
Not directly related, but sonarr created the XBMC meta files fine as well.

Please hastebin some debug logs of the refresh of an affected series.

http://hastebin.com/ikuwumarew.coffee

I did space out the relevant parts. Not saying much, really.

Here’s the files:
ls -la /media/usb/video/tv/Arrow
http://hastebin.com/aniwabicur.diff

I did notice that the System tab reports usb0 and usb1 as existing partitions (usb is a link to usb1), but that shouldn’t change anything (and doesn’t, I already tried the “direct” path).

Can you try removing then re-adding Arrow (and post the logs again), for some reason its not processing it, either because its link to an episode already (which would be odd given the files are well named) or because its not seeing them, but a full output of add series should show which files Sonarr can see.

Clearing your logs before adding the series should keep it pretty short.

http://hastebin.com/hugofoloxo.coffee

I tried to keep the interference of the other series to a minimum. But I wonder where the

SQLite error (5): database is locked

comes from. I took a quick look at the source, databases shouldn’t interfere with the code anyway:

var searchOption = allDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
var filesOnDisk = _diskProvider.GetFiles(path, searchOption);

var mediaFileList = filesOnDisk.Where(file => MediaFileExtensions.Extensions.Contains(Path.GetExtension(file).ToLower()))
                                           .Where(file => !ExcludedFilesRegex.IsMatch(Path.GetFileName(file)))
                                           .ToList();

mediaFileList and possibly filesOnDisk is erroneously empty. Maybe a mono ↔ platform issue?

There are a number of people running on rPi already without this issue. I still think its permissions, if you run ps which user is mono running under?

Which version of Sonarr?

Checked it with htop, here again with ps:
pi 9956 102 6.6 75592 50412 ? Rl 01:49 0:21 /usr/bin/mono NzbDrone.exe

Currently running the dev branch, same issue with latest master or Mono 3.10:
Version: 2.0.0.3128
Mono Version: 4.0.1 (tarball Tue May 12 17:22:22 UTC 2015)

Ran a test to ensure we don’t skip files in the root of the series folder (not in season folders) and we don’t.

The only reason why the list of files would be:

Before processing there are other files which are excluded:

  • The filename starts with ._
  • Files are in special subfolder (extras, @eadir, a folder thats starts with .)
  • File is mapped to an episode already

Just to rule out it being mapped to an episode already, make sure another series isn’t pointed at the same path (check on Series editor).

I just pushed a few changes to clean up the code a bit, but functionally its the same.

Thanks again, Markus!

As soon as I figure out how to properly compile and debug it on my raspberry, I’ll have a closer look.

Saw your post on another thread, there have been some other similar issues that came down to the file system used and support on it in 32 vs 64 bit systems, not sure it applies, but might be worth taking a look at which filesystem is used.

That’s a good point, my old HD uses XFS, which is arguably a rather… exotic choice. Altough I’ve never run into issues before, I can see why we might run into one here.
Do you think there’s a workaround, other than reformatting the hdd?

I’m not really sure, you could try moving the files to another drive and test if Sonarr sees them (update the series to point to the new path), not sure if there is a work around though, I suspect formatting might be the only option.

I fstransformed the whole HDD, days later I was done. Sonarr now finds all episodes perfectly.
Absolutely no clue as to why XFS should be less compatible, but it looks like that was the issue. Thanks again, and a happy new year!