saltyorg / Saltbox

Ansible-based solution for rapidly deploying a Docker containerized cloud media server.
https://docs.saltbox.dev
GNU General Public License v3.0
571 stars 65 forks source link

Downloads should only go to local #140

Closed japandler closed 1 year ago

japandler commented 1 year ago

Describe the bug Having downloads write to unionfs merge can generate some interesting errors, depending on setup with multiple HDDs, etc. It's better to have the downloads write to local disks, run whatever post-processing, and then have it merged up.

To Reproduce Steps to reproduce the behavior:

  1. I'm running a server with 2 HDDs. One's mounted directly to /mnt
  2. Install saltbox's feederbox
  3. Attempt to download anything via NZBget or SabNZBd. You may get the error I've copy/pasted below
  4. Poking around, it looks to be coming from rclone or mergerfs, though neither report any actual errors.

Expected behavior You should expect to see the download go through smoothly.

Screenshots Didn't grab any before figuring out the problem.

Logs

 fout.write(data)
2023-03-20 03:27:54,935::INFO::[notifier:123] Sending notification: Error - Disk error on creating file /mnt/unionfs/downloads/nzbs/sabnzbd/incomplete/The.Mandalorian.S03E02.1080p.DSNP.WEBRip.DDP5.1.x264-NTb/1bbdc6d422af49ae9c4df7a8aabe70ec.part02.rar (type=error, job_cat=None)
2023-03-20 03:27:54,934::ERROR::[assembler:113] Disk error on creating file /mnt/unionfs/downloads/nzbs/sabnzbd/incomplete/The.Mandalorian.S03E02.1080p.DSNP.WEBRip.DDP5.1.x264-NTb/1bbdc6d422af49ae9c4df7a8aabe70ec.part02.rar
2023-03-20 03:27:54,935::INFO::[assembler:121] Traceback: 
Traceback (most recent call last):
  File "/app/sabnzbd/assembler.py", line 193, in assemble
OSError: [Errno 29] Invalid seek
During handling of the above exception, another exception occurred:
  File "/app/sabnzbd/assembler.py", line 86, in run
  File "/app/sabnzbd/assembler.py", line 178, in assemble
    self.assemble(nzo, nzf, file_done)
    with open(nzf.filepath, "ab", buffering=0) as fout:
PermissionError: [Errno 1] Operation not permitted
2023-03-20 03:27:54,937::INFO::[downloader:395] Pausing
2023-03-20 03:27:54,937::INFO::[notifier:123] Sending notification: SABnzbd - Paused (type=pause_resume, job_cat=None)
2023-03-20 03:27:54,938::INFO::[downloader:415] Forcing disconnect
2023-03-20 03:27:54,938::DEBUG::[downloader:925] Thread 3@********.com: forcing disconnect
2023-03-20 03:27:54,940::DEBUG::[assembler:85] Decoding part of /mnt/unionfs/downloads/nzbs/sabnzbd/incomplete/The.Mandalorian.S03E02.1080p.DSNP.WEBRip.DDP5.1.x264-NTb/1bbdc6d422af49ae9c4df7a8aabe70ec.part03.rar

If issue occurs during Ansible playbook, run playbook with -vv to output detailed debug log.

System Information

Additional context I was able to resolve this issue by changing the config paths from /mnt/unionfs to /mnt/local. Asking for us to have a portion of documentation that either calls this out, or a setting that allows us to change it specifically for our torrents and NZBs.

owine commented 1 year ago

Given that you flipped the path in the Saltbox config and it fixed your issue, it sounds like what you are requesting already exists?

saltydk commented 1 year ago

This looks more like a problem with your edits than a mergerfs issue. Be more specific about how your setup is constructed here.

PuppyLover101 commented 1 year ago

Either way you can just edit the downloads to /mnt/local/downloads/... and then remote path on the arrs.

jodiekurnia commented 1 year ago

I have a suggestion to the devs, add "--read-only" on rclone mount remote cloud, that way you didn't have to change documentation, and this problem will not appear any more. upload by cloudplow will still work.

saltydk commented 1 year ago

No one tells you to use the remote path, that is handled by mergerfs. Not to mention read only breaks renames. Closing this.

jodiekurnia commented 1 year ago

No one tells you to use the remote path, that is handled by mergerfs. Not to mention read only breaks renames. Closing this.

really? in saltbox docs for setting up qbittorrent here https://docs.saltbox.dev/apps/qbittorrent/?h=qbittor#3-setup it uses unionfs folder.

Save files to location: /mnt/unionfs/downloads/torrents/qbittorrent/completed/

Keep incomplete torrents in: /mnt/unionfs/downloads/torrents/qbittorrent/incoming/

Copy .torrent files to: /mnt/unionfs/downloads/torrents/qbittorrent/torrents/

Copy .torrent files for finished downloads to: /mnt/unionfs/downloads/torrents/qbittorrent/torrents/

Additionally you can set monitored folder to: /mnt/unionfs/downloads/torrents/qbittorrent/watched/
saltydk commented 1 year ago

Do you realize that unionfs is mergerfs and not remote?

jodiekurnia commented 1 year ago

dude, please read initial bug reported, download goes to unionfs, and it somehow write directly to remote, not local. In my case I change rclone_vfs adding --read-only.

saltydk commented 1 year ago

There are plenty of other ways it can happen, like you restarting the mergerfs service without restarting the containers because you, or him, don't know how it works. But I'm locking this as it doesn't need solving. The read only "fix" is idiotic as it breaks functionality.

jodiekurnia commented 1 year ago

There are plenty of other ways it can happen, like you restarting the mergerfs service without restarting the containers because you, or him, don't know how it works. But I'm locking this as it doesn't need solving. The read only "fix" is idiotic as it breaks functionality.

well, I do a clean install, and not touching anything, and yet it I still getting this error.. or maybe you should change the docs to point "/mnt/local/" instead?

saltydk commented 1 year ago

Support is for discord. Regardless mergerfs doesn't allow writes to remote anyway. If you want to suggest changes maybe try understanding how it works first? Remote is set to no create, which doesn't allow writes.