File deletion fails on first attempt through union mount

What is the problem you are having with rclone?

My setup is pretty common. I have a Google Drive remote mounted through a crypt remote. I also have a union remote which combines the crypt remote and local disk storage to simplify Radarr/Sonarr file management. My mount commands are as follows.

Crypt remote:
rclone mount --drive-impersonate=[email redacted] --allow-other --buffer-size 128M --dir-cache-time 168h --drive-chunk-size 64M --log-level INFO --vfs-cache-mode off --vfs-read-chunk-size 128M --vfs-read-chunk-size-limit off gcrypt:crypt /media/gcrypt

Union remote:
rclone mount --allow-other media-union: /data/media

When deleting files on cloud storage through the union remote, rclone will almost always through an "Operation not permitted" error on the first attempt, then succeeds on the second. If I delete the file through the crypt remote, e.g. /media/gcrypt/media instead of /data/media, I don't get an error. I also do not get this error if I create an empty file and then attempt to delete it, regardless of whether the file was created through the union remote or directly through the crypt remote.

If I use rm instead of rclone delete, I get the same error, the file disappears on the union mount, but still exists on the crypt mount.

This causes issues for me with Sonarr/Radarr, as when they upgrade old media with higher quality versions, the deletion will fail and I end up with two copies of the same thing.

Also, I'd like to add that this is not a permission error related to Radarr/Sonarr or Docker. I can run docker exec -it radarr bash to get an interactive shell inside the Radarr container and the same behavior occurs as when I attempt to run rm outside the container.

What is your rclone version (output from rclone version)

1.56.0. This also occurred on 1.55.0.

Which OS you are using and how many bits (eg Windows 7, 64 bit)

64-bit Debian Linux.

Which cloud storage system are you using? (eg Google Drive)

Google Drive.

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone delete -vv /data/media/movies/Nobody\ \(2021\)/Nobody\ \(2021\)\ Remux-1080p.en.srt

The rclone config contents with secrets removed.

[gsuite]
type = drive
client_id = [redacted]
client_secret = [redacted]
scope = drive
token = [redacted]
root_folder_id = [redacted]

[gcrypt]
type = crypt
remote = gsuite:crypt
filename_encryption = standard
directory_name_encryption = true
password = [redacted]
password2 = [redacted]

[media-union]
type = union
remotes = gcrypt:crypt/media /media/3TB/media

A log from the command with the -vv flag

2021/08/29 00:56:49 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "delete" "-vv" "/data/media/movies/Nobody (2021)/Nobody (2021) Remux-1080p.en.srt"]
2021/08/29 00:56:49 DEBUG : Creating backend with remote "/data/media/movies/Nobody (2021)/Nobody (2021) Remux-1080p.en.srt"
2021/08/29 00:56:49 DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
2021/08/29 00:56:49 DEBUG : fs cache: adding new entry for parent of "/data/media/movies/Nobody (2021)/Nobody (2021) Remux-1080p.en.srt", "/data/media/movies/Nobody (2021)"
2021/08/29 00:56:49 DEBUG : Waiting for deletions to finish
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.en.forced.srt: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.en.srt: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.mkv: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Remux-1080p.mkv: Excluded
2021/08/29 00:56:49 ERROR : Nobody (2021) Remux-1080p.en.srt: Couldn't delete: remove /data/media/movies/Nobody (2021)/Nobody (2021) Remux-1080p.en.srt: operation not permitted
2021/08/29 00:56:49 ERROR : Attempt 1/3 failed with 2 errors and: failed to delete 1 files
2021/08/29 00:56:49 DEBUG : Waiting for deletions to finish
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.en.forced.srt: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.en.srt: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Bluray-2160p.mkv: Excluded
2021/08/29 00:56:49 DEBUG : Nobody (2021) Remux-1080p.mkv: Excluded
2021/08/29 00:56:49 ERROR : Attempt 2/3 succeeded
2021/08/29 00:56:49 DEBUG : 2 go routines active

One week bump. Any ideas?

I don't use rclone union so not really sure as I use mergerfs.

Perhaps @ncw has an idea.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.