Sonarr - can't move/rename files Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Sonarr - can't move/rename files

Post by Flipbug »

Hi all,

What I am trying to achieve on my Raspberry Pi 4 with DietPi:
  • 1. Sonarr automatically queues up torrents for desired TV shows
  • 2. Transmission downloads the TV shows to a directory on a network share (NTFS, Samba)
  • 3. Sonarr renames and moves the downloaded TV shows to a different directory on the same network share
  • 4. Sonarr triggers Kodi to scrape the episode
So far 1-2 are working really well. I mounted the network storage with dietpi-drive_manager.

However I am stuck on 3. Sonarr keeps displaying errors like this in the logs:

Code: Select all

Couldn't import episode /mnt/Media/Download-complete/Family.Guy.S18E04.1080p.WEB.x264-TBS[rarbg]/family.guy.s18e04.1080p.web.x264-tbs.mkv: Access to the path is denied.
My research suggests this is because the Samba share has been assigned write permissions only for the user that mounted it (dietpi) because this is how Linux handles user access to external NTFS storage. So I'm thinking the answer is just to have Sonarr run as the dietpi user. But how do I do this?

It's notable that Transmission has no trouble writing to the drive. It doesn't seem to have a dedicated user so I'm assuming it launches as the dietpi user.
beachbum0727
Posts: 6
Joined: Thu Oct 24, 2019 8:35 pm

Re: Sonarr - can't move/rename files

Post by beachbum0727 »

Having same issue on my raspberry pi 3b+ on dietpi.

I can see Sonarr and Radarr start copy process but it just says PARTIAL file and when it reaches the right file size then it just deletes the file and starts over.

My permissions are set to everyone and every group can read/write.

I'm about to go purchase a new raspberry pi 4 to take advantage of the USB3.0 but i think ill go with raspbian minimal install and just install all apps using another tool.

Please post if you can figure an answer for this issue.
User avatar
MichaIng
Site Admin
Posts: 2417
Joined: Sat Nov 18, 2017 6:21 pm

Re: Sonarr - can't move/rename files

Post by MichaIng »

@Flipbug
When you mounted the NTFS drive via dietpi-drive_manager, it emulates UNIX permissions via ntfs-3g service, so no need to set a fixed user+group for that mount, but assure that the dir+files is owned by dietpi group with 775/664 permissions (so the whole group has write permissions, not just the dietpi user).
If you mounted it manually, assure that the fstab entry contains the "permissions" option, respectively mount command with "-o permissions".

@beachbum0727
Please also go through the above hits. Which file system does your external drive have?
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Re: Sonarr - can't move/rename files

Post by Flipbug »

Thanks for responding, @MichaIng.

/mnt/Media/ is my mounted NTFS samba share. It was mounted using dietpi-drive_manager, which I ran as root.

I have now done the following:
sudo chgrp -R dietpi /mnt/Media/
ls -ld /mnt/Media/

Code: Select all

drwxrwxrwx 1 dietpi dietpi 0 Oct 27 21:10 /mnt/Media/

Unfortunately the error in Sonarr is still occurring.
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Re: Sonarr - can't move/rename files

Post by Flipbug »

I'm wondering if the issue is being caused by Transmission locking the file. I've seen similar behaviour on Windows with torrent clients. How can I get Transmission to release the file after downloading and seeding for a duration? Or should i just use a different torrent client?
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Re: Sonarr - can't move/rename files

Post by Flipbug »

Switched to Qbittorrent. Same issue. It must be a permissions problem, but as far as I can tell, the permissions are fine... The torrent clients can freely write to this drive and move files around, it's just Sonarr that can't.
SPI0
Posts: 9
Joined: Sun Jul 29, 2018 10:24 pm

Re: Sonarr - can't move/rename files

Post by SPI0 »

It seems the mono version is the culprit: https://www.reddit.com/r/radarr/comment ... _all_of_a/

But haven't tried to downgrade yet.
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Re: Sonarr - can't move/rename files

Post by Flipbug »

Thanks heaps @SPIO.

I've read the article and came up with these steps to downgrade Mono and reinstall Sonarr:

Uninstall Sonarr via Dietpi-software
Completely uninstall Mono

Code: Select all

sudo apt-get remove mono*
Edit sources

Code: Select all

nano /etc/apt/sources.list.d/mono-xamarin.list
change:
deb https://download.mono-project.com/repo/raspbianbuster buster main
to:
deb https://download.mono-project.com/repo/raspbianbuster stretch/snapshots/5.20.1.34 main
update

Code: Select all

sudo apt-get update
install mono

Code: Select all

sudo apt-get install mono-runtime
install sonarr <- I can't find the command for this. I tried installing via the Dietpi-software installer but it overwrote my mono changes and installed the new version.
Last edited by Flipbug on Fri Nov 08, 2019 5:25 am, edited 5 times in total.
User avatar
MichaIng
Site Admin
Posts: 2417
Joined: Sat Nov 18, 2017 6:21 pm

Re: Sonarr - can't move/rename files

Post by MichaIng »

Hey guys, there is indeed an issue with Mono 6 when writing to a file system that does not support UNIX permissions: https://github.com/MichaIng/DietPi/issues/3179

For NTFS you can work around the issue by adding the "permissions" mount option (default when using dietpi-drive_manager), which emulates permissions, so chown and chmod can be used and Mono succeeds series import. For FAT variants there seem to be no way besides degrading to Mono 5, e.g. by removing the Mono APT repository, purge the package and reinstall from Raspbian/Debian repository.

But generally I recommend to use file systems which are natively supported by Linux, like ext4, btrfs and such, which do not have the high CPU usage and R/W access. If you need access from Windows, a network drive is the more comfortable solution anyway, so no physical unplug/plug required? ;)
Flipbug
Posts: 10
Joined: Tue Oct 15, 2019 3:33 am

Re: Sonarr - can't move/rename files

Post by Flipbug »

MichaIng wrote: Tue Nov 05, 2019 9:47 pm Hey guys, there is indeed an issue with Mono 6 when writing to a file system that does not support UNIX permissions: https://github.com/MichaIng/DietPi/issues/3179

For NTFS you can work around the issue by adding the "permissions" mount option (default when using dietpi-drive_manager), which emulates permissions, so chown and chmod can be used and Mono succeeds series import. For FAT variants there seem to be no way besides degrading to Mono 5, e.g. by removing the Mono APT repository, purge the package and reinstall from Raspbian/Debian repository.

But generally I recommend to use file systems which are natively supported by Linux, like ext4, btrfs and such, which do not have the high CPU usage and R/W access. If you need access from Windows, a network drive is the more comfortable solution anyway, so no physical unplug/plug required? ;)
Makes sense! When I get my new drive I'll use ext4 :) It makes sense to keep the performance cost down for the Raspberry Pi as much as possible.

In the meantime if my Mono downgrade doesn't work I'll probably just stick with manual transfers until then.
Post Reply