Google Drive failing to `copyto` from one device

What is the problem you are having with rclone?

I'm trying to make use of copyto in order to push daily backups to Google Drive, but I've yet to successfully create a file from my server (Ubuntu 18.04, testing with both the packaged rclone 1.36 and the latest binary 1.56.0). Testing on a separate device (Termux on Android, also 1.56.0) with the same credentials, it seems to work fine.

What is your rclone version (output from rclone version)

server$ rclone version
rclone v1.36
server$ /opt/rclone/rclone version
rclone v1.56.0
- os/version: ubuntu 18.04 (64 bit)
- os/kernel: 4.15.0-147-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.16.5
- go/linking: static
- go/tags: none
phone$ rclone version
rclone 1.56.0-termux
- os/version: unknown
- os/kernel: 4.4.250-lineage+-ab0af4f83d47 (aarch64)
- os/type: android
- os/arch: arm64
- go/version: go1.16.6
- go/linking: dynamic
- go/tags: noselfupdate

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

Server: Ubuntu 18.04, 64-bit
Phone: Termux, Android 10, 64-bit

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 copyto ./test.txt gdrive:Test/$(date +%Y%m%d).txt

(having successfully created the Test directory using rclone mkdir)

The rclone config contents with secrets removed

[gdrive]
type = drive
scope = drive.file
token = {"access_token":"<snip>","token_type":"Bearer","refresh_token":"<snip>","expiry":"2021-08-22T10:27:11.500771481Z"}
team_drive =

(I've also tried using the full-access drive scope, and setting/unsetting root_folder_id as hinted at in the debugging messages, but to no effect)

A log from the command with the -vv flag

Where it doesn't work:

server$ rclone copyto ./test.txt gdrive:Test/$(date +%Y%m%d).txt -vvv
2021/08/22 09:38:34 DEBUG : rclone: Version "v1.36" starting with parameters ["rclone" "copyto" "./test.txt" "gdrive:Test/20210822.txt" "-vvv"]
2021/08/22 09:38:36 INFO  : Google drive root 'Test/20210822.txt': Modify window is 1ms
2021/08/22 09:38:36 DEBUG : Google drive root 'Test/20210822.txt': Reading ""
2021/08/22 09:38:37 DEBUG : Google drive root 'Test/20210822.txt': Finished reading ""
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:37 ERROR : Attempt 1/3 failed with 0 errors and: error reading source directory "": directory not found
2021/08/22 09:38:37 DEBUG : Google drive root 'Test/20210822.txt': Reading ""
2021/08/22 09:38:37 DEBUG : Google drive root 'Test/20210822.txt': Finished reading ""
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:37 ERROR : Attempt 2/3 failed with 0 errors and: error reading source directory "": directory not found
2021/08/22 09:38:37 DEBUG : Google drive root 'Test/20210822.txt': Reading ""
2021/08/22 09:38:37 DEBUG : Google drive root 'Test/20210822.txt': Finished reading ""
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:37 INFO  : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:37 ERROR : Attempt 3/3 failed with 0 errors and: error reading source directory "": directory not found
2021/08/22 09:38:37 Failed to copyto: error reading source directory "": directory not found
server$ /opt/rclone/rclone copyto ./test.txt gdrive:Test/$(date +%Y%m%d).txt -vvv
2021/08/22 09:38:44 DEBUG : rclone: Version "v1.56.0" starting with parameters ["/opt/rclone/rclone" "copyto" "./test.txt" "gdrive:Test/20210822.txt" "-vvv"]
2021/08/22 09:38:44 DEBUG : Creating backend with remote "./test.txt"
2021/08/22 09:38:44 DEBUG : Using config file from "/var/lib/service/.config/rclone/rclone.conf"
2021/08/22 09:38:44 DEBUG : fs cache: renaming cache item "./test.txt" to be canonical "./test.txt"
2021/08/22 09:38:44 DEBUG : Creating backend with remote "gdrive:Test/20210822.txt"
2021/08/22 09:38:44 DEBUG : Google drive root 'Test/20210822.txt': 'root_folder_id = root' - save this in the config to speed up startup
2021/08/22 09:38:45 ERROR : Local file system at ./test.txt: error reading source root directory: directory not found
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:45 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2021/08/22 09:38:45 ERROR : Local file system at ./test.txt: error reading source root directory: directory not found
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:45 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2021/08/22 09:38:45 ERROR : Local file system at ./test.txt: error reading source root directory: directory not found
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for checks to finish
2021/08/22 09:38:45 DEBUG : Google drive root 'Test/20210822.txt': Waiting for transfers to finish
2021/08/22 09:38:45 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2021/08/22 09:38:45 INFO  :
Transferred:              0 / 0 Byte, -, 0 Byte/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         1.8s

2021/08/22 09:38:45 DEBUG : 4 go routines active
2021/08/22 09:38:45 Failed to copyto: directory not found

And where it does:

phone$ rclone copyto ./test.txt gdrive:Test/$(date +%Y%m%d).txt -vvv
2021/08/22 09:28:18 DEBUG : rclone: Version "1.56.0-termux" starting with parameters ["rclone" "copyto" "./test.txt" "gdrive:Test/20210822.txt" "-vvv"]
2021/08/22 09:28:18 DEBUG : Creating backend with remote "./test.txt"
2021/08/22 09:28:18 DEBUG : Using config file from "/data/data/com.termux/files/home/.config/rclone/rclone.conf"
2021/08/22 09:28:18 DEBUG : fs cache: adding new entry for parent of "./test.txt", "/data/data/com.termux/files/home"
2021/08/22 09:28:18 DEBUG : Creating backend with remote "gdrive:Test/"
2021/08/22 09:28:18 DEBUG : Google drive root 'Test': 'root_folder_id = root' - save this in the config to speed up startup
2021/08/22 09:28:19 DEBUG : fs cache: renaming cache item "gdrive:Test/" to be canonical "gdrive:Test"
2021/08/22 09:28:19 DEBUG : test.txt: Need to transfer - File not found at Destination
2021/08/22 09:28:20 DEBUG : test.txt: md5 = 09f7e02f1290be211da707a266f153b3 OK
2021/08/22 09:28:20 INFO  : test.txt: Copied (new) to: 20210822.txt
2021/08/22 09:28:20 INFO  :
Transferred:              6 / 6 Byte, 100%, 5 Byte/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         2.8s

2021/08/22 09:28:20 DEBUG : 5 go routines active

hello and welcome to the forum,

seems the issue is with the local file system, not gdrive
Local file system at ./test.txt: error reading source root directory: directory not found

does /opt/test.txt exist? if the file exists then as a test, from /opt try rclone ls test.txt, make sure rclone can see that file

not a linux expert but /opt is a folder to store programs. so this might be permissions issue.
that rclone cannot see the file test.txt, looks for a folder named test.txt and cannot find that source folder

try to change the current working directory to something inside the home folder and run rclone from there.

Bah, it is indeed local permissions. :roll_eyes:

does /opt/test.txt exist?

/opt/rclone is just where I put the latest version of rclone; in reality we're working from a service account's home directory. The problem was naturally another step in the chain: running through sudo without setting the group, accessing a directory accessible only to the service account's group.

seems the issue is with the local file system, not gdrive
Local file system at ./test.txt: error reading source root directory: directory not found

Thanks for the pointer, I had overlooked that applying to the local side as it was mixed into the GDrive logging (I was focusing too much on Attempt 1/3 failed with 1 errors and: directory not found which suggested it'd be on the remote site).

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