[google drive] cannot save files directly from browser to gdrive mounted path

Hi folks,

I'm using rclone mount with Google Drive, and when I save a file using Chrome into the mounted dir, it fails every time. Chrome just says "Failed - Download error". This works fine if I save to a path on the local drive. Any ideas?

I'm not using any flags on rclone mount:

rclone mount "Google Drive - personal" $HOME/GoogleDrive/

Using rclone v1.52.2 on Ubuntu 20.04.

Rclone config:

[Google Drive - personal]
type = drive
client_id = <redacted>
client_secret = <redacted>
scope = drive
token = {"access_token":"<redacted>","token_type":"Bearer","refresh_token":"<redacted>","expiry":"2020-07-20T23:36:44.956945476+10:00"}
root_folder_id = <redacted>

Relevant bits from the logs:

2020/07/20 22:56:49 DEBUG : /: Lookup: name="Individual Development Plan_2018_Template.docx"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Attr:
2020/07/20 22:56:49 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Individual Development Plan_2018_Template.docx"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Individual Development Plan_2018_Template.docx"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Unconfirmed 907283.crdownload"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Unconfirmed 907283.crdownload"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Unconfirmed 907283.crdownload"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory
2020/07/20 22:56:49 DEBUG : /: Create: name="Unconfirmed 907283.crdownload"
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Open: flags=O_WRONLY|O_CREATE|O_TRUNC
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: >Open: fd=Unconfirmed 907283.crdownload (w), err=<nil>
2020/07/20 22:56:49 DEBUG : /: >Create: node=Unconfirmed 907283.crdownload, handle=&{Unconfirmed 907283.crdownload (w)}, err=<nil>
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Attr:
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: >Attr: a=valid=1s ino=0 size=0 mode=-rw-rw-r--, err=<nil>
2020/07/20 22:56:49 DEBUG : &{Unconfirmed 907283.crdownload (w)}: Flush:
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions
2020/07/20 22:56:49 DEBUG : &{Unconfirmed 907283.crdownload (w)}: >Flush: err=<nil>
2020/07/20 22:56:49 DEBUG : &{Unconfirmed 907283.crdownload (w)}: Release:
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: WriteFileHandle.Release closing
2020/07/20 22:56:49 DEBUG : Google drive root '': File to upload is small (0 bytes), uploading instead of streaming
2020/07/20 22:56:49 DEBUG : /: Attr:
2020/07/20 22:56:49 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Open: flags=OpenWriteOnly+OpenNonblock
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Open: flags=O_WRONLY|0x800
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: >Open: fd=Unconfirmed 907283.crdownload (w), err=<nil>
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: >Open: fh=&{Unconfirmed 907283.crdownload (w)}, err=<nil>
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Setattr: a=Setattr [ID=0x2a8 Node=0x71 Uid=1000 Gid=1000 Pid=1035852] size=0 handle=INVALID-0x0 lockowner
2020/07/20 22:56:49 DEBUG : Unconfirmed 907283.crdownload: Truncating 2 file handles
2020/07/20 22:56:49 DEBUG : /: Lookup: name="Individual Development Plan_2018_Template.docx"
2020/07/20 22:56:49 DEBUG : /: >Lookup: node=<nil>, err=no such file or directory

hello and welcome to the forum,

rclone uses : to mark a remote name
without the colon, rclone thinks you are try to mount a local folder.

so try this:
rclone mount "Google Drive - personal:" $HOME/GoogleDrive/

Thanks @asdffdsa! Sorry, I missed the : in my command but it is there. The mounting is not the problem as I can see files in there and even read/write files. It just seems to be a problem doing that from a browser. I'm not sure if this is related to the root cause, but when saving from the browser there's some renaming involved from Unconfirmed XXXX.crdownload to the final filename.

Ah, I just found this issue: https://github.com/rclone/rclone/issues/4293

Looks like it's a confirmed bug and planned to be fixed in v1.53 although I'm not sure if the fix is specific to OneDrive or not (I'm using Google Drive). @ncw are you able to confirm?

try to add this flag
https://rclone.org/commands/rclone_mount/#vfs-cache-mode-writes

It seemed to throw some errors, but it did save the file OK !?

2020/07/21 16:37:39 ERROR : <file>: corrupted on transfer: MD5 hash differ "a7b6691cd0787bbf5abcd9112d2e71a4" vs "d41d8cd98f00b204e9800998ecf8427e"
2020/07/21 16:37:39 ERROR : <file>(0xc0000a24c0): failed to transfer file from cache to remote: corrupted on transfer: MD5 hash differ "a7b6691cd0787bbf5abcd9112d2e71a4" vs "d41d8cd98f00b204e9800998ecf8427e"
2020/07/21 16:37:39 ERROR : <file>: cache: double close
2020/07/21 16:37:39 ERROR : <file>(0xc0000a24c0): RWFileHandle.Release error: failed to transfer file from cache to remote: corrupted on transfer: MD5 hash differ "a7b6691cd0787bbf5abcd9112d2e71a4" vs "d41d8cd98f00b204e9800998ecf8427e"
2020/07/21 16:38:03 ERROR : <file>: cache: double close

This is one to try with the latest beta - the new code is merged there and it needs more testing :slight_smile:

Thanks @ncw. I tried with v1.52.2-230-gd2efb4b2-beta (without --vfs-cache-mode writes) and I'm still getting a Failed - Download error in Chrome. Snippets of the log:

2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Open: flags=O_WRONLY|O_CREATE|O_TRUNC
2020/07/22 09:50:29 DEBUG : : Added virtual directory entry vAdd: "Unconfirmed 221675.crdownload"
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: >Open: fd=Unconfirmed 221675.crdownload (w), err=<nil>
2020/07/22 09:50:29 DEBUG : /: >Create: node=Unconfirmed 221675.crdownload, handle=&{Unconfirmed 221675.crdownload (w)}, err=<nil>
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Attr:
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: >Attr: a=valid=1s ino=0 size=0 mode=-rw-rw-r--, err=<nil>
2020/07/22 09:50:29 DEBUG : &{Unconfirmed 221675.crdownload (w)}: Flush:
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions
2020/07/22 09:50:29 DEBUG : : Added virtual directory entry vAdd: "Unconfirmed 221675.crdownload"
2020/07/22 09:50:29 DEBUG : &{Unconfirmed 221675.crdownload (w)}: >Flush: err=<nil>
2020/07/22 09:50:29 DEBUG : &{Unconfirmed 221675.crdownload (w)}: Release:
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: WriteFileHandle.Release closing
2020/07/22 09:50:29 DEBUG : Google drive root '': File to upload is small (0 bytes), uploading instead of streaming
2020/07/22 09:50:29 DEBUG : /: Attr:
2020/07/22 09:50:29 DEBUG : /: >Attr: attr=valid=1s ino=0 size=0 mode=drwxrwxr-x, err=<nil>
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Open: flags=OpenWriteOnly+OpenNonblock
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Open: flags=O_WRONLY|0x800
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: >Open: fd=Unconfirmed 221675.crdownload (w), err=<nil>
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: >Open: fh=&{Unconfirmed 221675.crdownload (w)}, err=<nil>
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Setattr: a=Setattr [ID=0x2b2 Node=0x76 Uid=1000 Gid=1000 Pid=2486431] size=0 handle=INVALID-0x0 lockowner
2020/07/22 09:50:29 DEBUG : Unconfirmed 221675.crdownload: Truncating 2 file handles

Interestingly, even with --vfs-cache-mode writes, it now fails. I went back to v1.52.2 and it works again with --vfs-cache-mode writes.

I can replicate that.

When I try it with --vfs-cache-mode writes it works perfectly for me - can you post a log of that failing for you?

I had a go at fixing the problem without --vfs-cache-mode - can you have a go with this?

v1.52.2-233-g10dea1ca-fix-vfs-write-beta on branch fix-vfs-write (uploaded in 15-30 mins)

Please move further discussion of this to https://github.com/rclone/rclone/issues/4293 - thanks!

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