Unable to transfer files to Google Drive

What is the problem you are having with rclone?

Unable to transfer files to Google Drive. Using a service account through Gsuite (I am the admin) rclone mount --dir-cache-time 96h --cache-info-age 100h --vfs-cache-mode writes --allow-other -vv --drive-impersonate email@example.com drive: /opt/drive1 I have tried with no folder path, same issue. And without impersonation and no folder ID it transfers the files but I can't see it in Drive.
Yes, I have set Domain-wide delegation for the Service Account too.

Run the command 'rclone version' and share the full output of the command.

rclone v1.50.2
os/arch: linux/amd64
go version: go1.13.6

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 copy test.txt drive:

The rclone config contents with secrets removed.

[drive]
type = drive
client_id = redacted
client_secret = redacted
scope = drive
service_account_file = /root/file.json
root_folder_id = FOLDERPATH
team_drive =

[drivecrypt]
type = crypt
remote = drive:encrypt
filename_encryption = standard
directory_name_encryption = false
password = 
password2 = 

A log from the command with the -vv flag

2022/05/27 14:09:24 DEBUG : test.txt: Need to transfer - File not found at Destination
2022/05/27 14:09:25 ERROR : test.txt: Failed to copy: googleapi: Error 404: File not found: FOLDERPATH., notFound

That's a really, really old version of rclone so I'd upgrade that.

Is your root folder id pointing to a wrong spot? Try removing it and see what you get.

1 Like

The files will be ending up in the service accounts drive in this case (yes each service account has a 15 GB drive!).

That should work, with no root_folder_id in the config and a recent enough version of rclone.

1 Like

Thanks for the response, I realised the version was pretty old. So now I'm on v1.58.1.

I tried without the root_folder_id option, and it does copy files, however I still can't see it in the drive account. If I enter the folder ID in Google drive in my browser it says I need access to see the folder which is weird.
I tried again with a new root_folder_id that I created and I still get the 404 error.

Not seeing anything irregular in the logs other than the transfer showing the 404 when I set the folder ID 2022/05/28 11:19:38 DEBUG : test2.txt: Need to transfer - File not found at Destination 2022/05/28 11:19:38 ERROR : test2.txt: Failed to copy: googleapi: Error 404: File not found: X., notFound

Can you share the full debug log as that's just a snippet?

root@homelab:~# rclone copy test2.txt drive: -vv
2022/05/28 11:19:37 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "copy" "test2.txt" "drive:" "-vv"]
2022/05/28 11:19:37 DEBUG : Creating backend with remote "test2.txt"
2022/05/28 11:19:37 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/05/28 11:19:37 DEBUG : fs cache: adding new entry for parent of "test2.txt", "/root"
2022/05/28 11:19:37 DEBUG : Creating backend with remote "drive:"
2022/05/28 11:19:38 DEBUG : test2.txt: Need to transfer - File not found at Destination
2022/05/28 11:19:38 ERROR : test2.txt: Failed to copy: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:38 ERROR : Attempt 1/3 failed with 1 errors and: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:39 DEBUG : test2.txt: Need to transfer - File not found at Destination
2022/05/28 11:19:39 ERROR : test2.txt: Failed to copy: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:39 ERROR : Attempt 2/3 failed with 1 errors and: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:40 DEBUG : test2.txt: Need to transfer - File not found at Destination
2022/05/28 11:19:41 ERROR : test2.txt: Failed to copy: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:41 ERROR : Attempt 3/3 failed with 1 errors and: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound
2022/05/28 11:19:41 INFO  : 
Transferred:              9 B / 9 B, 100%, 2 B/s, ETA 0s
Errors:                 1 (retrying may help)
Elapsed time:         3.4s

2022/05/28 11:19:41 DEBUG : 8 go routines active
2022/05/28 11:19:41 Failed to copy: googleapi: Error 404: File not found: 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq., notFound

and the rclone command

root@homelab:~# rclone mount --drive-impersonate email@example.com --dir-cache-time 96h --cache-info-age 100h --vfs-cache-mode writes --allow-other -vv drive: /opt/drive2
2022/05/28 11:27:41 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "mount" "--drive-impersonate" "email@example.com" "--dir-cache-time" "96h" "--cache-info-age" "100h" "--vfs-cache-mode" "writes" "--allow-other" "-vv" "drive:" "/opt/drive2"]
2022/05/28 11:27:41 DEBUG : Creating backend with remote "drive:"
2022/05/28 11:27:41 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/05/28 11:27:41 DEBUG : drive: detected overridden config - adding "{BXSa5}" suffix to name
2022/05/28 11:27:41 DEBUG : fs cache: renaming cache item "drive:" to be canonical "drive{BXSa5}:"
2022/05/28 11:27:42 DEBUG : vfs cache: root is "/root/.cache/rclone"
2022/05/28 11:27:42 DEBUG : vfs cache: data root is "/root/.cache/rclone/vfs/drive{BXSa5}"
2022/05/28 11:27:42 DEBUG : vfs cache: metadata root is "/root/.cache/rclone/vfsMeta/drive{BXSa5}"
2022/05/28 11:27:42 DEBUG : Creating backend with remote "/root/.cache/rclone/vfs/drive{BXSa5}/"
2022/05/28 11:27:42 DEBUG : Creating backend with remote "/root/.cache/rclone/vfsMeta/drive{BXSa5}/"
2022/05/28 11:27:42 DEBUG : Google drive root '': Mounting on "/opt/drive2"
2022/05/28 11:27:42 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2022/05/28 11:27:42 DEBUG : : Root: 
2022/05/28 11:27:42 DEBUG : : >Root: node=/, err=<nil>
2022/05/28 11:27:44 DEBUG : : Statfs: 
2022/05/28 11:27:44 DEBUG : : >Statfs: stat={Blocks:274884313779 Bfree:274877906944 Bavail:274877906944 Files:1000000000 Ffree:1000000000 Bsize:4096 Namelen:255 Frsize:4096}, err=<nil>

What does your rclone.conf look like now? Did you change something as well?

I changed between no root folder id and the one provided below.

[drive]
type = drive
client_id = redacted
client_secret = redacted
scope = drive
service_account_file = /root/file.json
root_folder_id = 1ZAInS5knQsu1WSfGWMxbClwr4WJ1s6Hq

[drivecrypt]
type = crypt
remote = drive:encrypt
filename_encryption = standard
directory_name_encryption = false
password = 
password2 = 

hi,

in my remotes, they do not contain client_id and client_secret, as that would be in the .json.

normally this would not matter, as rclone will use the client_id and client_secret, from the .json.
tho not sure how root_folder_id and --drive-impersonate affect that

so this is a valid and working remote

rclone config show gdrivesa:
--------------------
[gdrivesa]
client_id = dummy
client_secret = dummy
type = drive
scope = drive
service_account_file = C:\data\rclone\rr\gdrive.sa\v02.json
--------------------

rclone about gdrivesa:
Total:   15 GiB
Used:    260.726 KiB
Free:    15.000 GiB
Trashed: 0 B
Other:   0 B
1 Like

Thanks, I removed the client id and secret, as well as the root folder id. It finds the right root folder id automatically, but again it doesn't actually show the files in Google Drive when I transfer it on my server.

ok, good to know. and narrows down the problem.
on that note, can remove --cache-info-age 100h

tho, for testing, rclone copy of a single file, the resultant debug log is much easier to work with.

1 Like

Any ideas how to fix this? I've tried as much as I can to try and get this to work but no solution yet :confused:

Okay, finally found a solution!

What I needed to do, was to share the root folder id of the folder I created on my account with the service account email. I realised I needed to do that when I could actually see my files through rclone -v --drive-impersonate email@example.com lsf drive

Thanks for the help.

1 Like

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