Skip to content

[Suggestion] Add note about potential permissions issues #616

Closed
@FaySmash

Description

@FaySmash

Since I've started using tubesync, everything worked but the removal of the files in the /downloads/cache directory. But I've noticed these lines in the log:

2025-01-11T10:26:03.119770319Z [MoveFiles] Moving file "/downloads/cache/test.mkv" to "/downloads/video/test.mkv"
ERROR: [Errno 1] Operation not permitted
Traceback (most recent call last):
  File "/usr/lib/python3.11/shutil.py", line 825, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/downloads/cache/test.mkv' -> '/downloads/video/test.mkv'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 1634, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 1790, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 1849, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 3021, in process_video_result
    self.process_info(new_info)
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 177, in wrapper
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 3567, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 3752, in post_process
    info = self.run_pp(MoveFilesAfterDownloadPP(self), info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 3711, in run_pp
    files_to_delete, infodict = pp.run(infodict)
                                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/postprocessor/common.py", line 22, in run
    ret = func(self, info, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/yt_dlp/postprocessor/movefilesafterdownload.py", line 47, in run
    shutil.move(oldfile, newfile)  # os.rename cannot move between volumes
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/shutil.py", line 845, in move
    copy_function(src, real_dst)
  File "/usr/lib/python3.11/shutil.py", line 437, in copy2
    copystat(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.11/shutil.py", line 376, in copystat
    lookup("utime")(dst, ns=(st.st_atime_ns, st.st_mtime_ns),
PermissionError: [Errno 1] Operation not permitted

The underlying problem was the shutil function move, which called the function copy2 which called the function copystat which called the function lookup which failed because of "Operation not permitted" and the script execution stopped, without calling os.unlink(src), leaving the file in the /cache folder.

Because this error was very annoying to track down, maybe there could be an added section in the documentation, with a note to set the UID/GID for the container so that the moving process can finish completely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions