Google Drive Expires Frequently in Rclone

STOP and READ USE THIS TEMPLATE NO EXCEPTIONS - By not using this, you waste your time, our time and really hate puppies. Please remove these two lines and that will confirm you have read them.

What is the problem you are having with rclone?

Google Drive Directory cloned with RClone expires sooner than I'd like. My Rclone is wrapped in a systemctl service. When that happens, I seem to need to unmount the mount in my directory, stop the systemctl service, run rclone config again, using the same parameters, just to get an unexpired mount that I can use. There may be and probably is a better way for me to handle it but I don't know what that is.

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

$ rclone version
rclone v1.67.0

  • os/version: ubuntu 24.04 (64 bit)
  • os/kernel: 6.8.0-41-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.22.4
  • go/linking: static
  • go/tags: none

Not latest, I know, but pretty recent. I imagine your answer to my question would not change.

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

Google Drive

Paste command here

Just view the directory in Nautilus. Says it's empty.

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

$ rclone config redacted
[wopa]
type = drive
scope = drive
token = XXX
team_drive = 
root_folder_id = XXX
client_id = XXX
client_secret = XXX
### Double check the config for sensitive info before posting publicly

A log from the command that you were trying to run with the -vv flag

2024-10-03T11:55:39.989548-07:00 taormina rclone[502756]: Google drive root '': Failed to get StartPageToken: Get "https://www.googleapis.com/drive/v3/changes/startPageToken?alt=json&prettyPrint=false&supportsAllDrives=true": couldn't fetch token: invalid_grant: maybe token expired? - try refreshing with "rclone config reconnect wopa:"

There's no mystery here. The token expired. I'm trying to find a way to prevent that from happening or at least make it happen less frequently.

Can you share a redacted version of your systemctl service?

and update your rclone version to the latest one.

  1. rclone selfupdate to update to lastest version
  2. create a new client id, create a new remote.
$  systemctl status wopa
● wopa.service - starting RClone mount of my wopa directory with Google Drive
     Loaded: loaded (/etc/systemd/system/wopa.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-10-03 11:58:56 MST; 22h ago
   Main PID: 905611 (rclone)
      Tasks: 10 (limit: 9298)
     Memory: 17.2M (peak: 18.8M)
        CPU: 16.102s
     CGroup: /system.slice/wopa.service
             └─905611 /usr/bin/rclone -v --syslog --config=/home/XXXX/.config/rclone/rclone.conf mount wopa: /home/XXXX/wopa

RE #2: I certainly could create a new client id and new remote, but how, exactly, would this solve the expiry date problem? Wouldn't it continue under the new id and remote?

Old GDrive rclone remotes behaves like you described. Maybe you created it with some even older version. This is very good advice just recreate it using the latest rclone - in most cases it fixes it.

Ok, I'll try that, but this was created using 1.67.0, not something older. Is this a new fix?

fwiw, sometimes, easier to start over then spend valuable time of volunteers to debug a possible one-time issue.

  1. rclone selfupdate in 30 seconds
  2. create a new client id in 2 minutes
  3. create a new remote in 1 minute

if the problem persists, then we can do a deep dive into it.

OK, I did rclone selfupdate and am now at v1.168.1. It all works - for now, anyway. Is there a way to tell when it will expire? Is it supposed to expire?

and you created a new client id and a new rclone remote??

yes, look at the token in the config file
"expiry":"2024-10-04T15:38:34.2850094-04:00

No, just the update. I will do the new stuff now.

Creating the new client id and secret. I see this in your doc:

Be aware that, due to the "enhanced security" recently introduced by Google, you are theoretically expected to "submit your app for verification" and then wait a few weeks(!) for their response; in practice, you can go right ahead and use the client ID and client secret with rclone, the only issue will be a very scary confirmation screen shown when you connect via your browser for rclone to be able to get its token-id (but as this only happens during the remote configuration, it's not such a big deal). Keeping the application in "Testing" will work as well, but the limitation is that any grants will expire after a week, which can be annoying to refresh constantly. If, for whatever reason, a short grant time is not a problem, then keeping the application in testing mode would also be sufficient.

It seems that this might be the cause of my problem. I never submitted the app to Google for verification, so it would keep expiring in a week, which is about what I observed. Since this is NOT what I want, I assume that I should submit it for verification, and then use it, knowing that it will keep expiring until Google approves it. Do I have that right?

no need to submit.

the token will expire and rclone will update as needed. that is expected behavior.
99% of rclone users do not submit. otherwise, the forum would be flooded with posts.
in 5+ years, i never submitted|verified the many gdrive remotes i created.

report back in a week...

Okay, and it appears it wouldn't be verified either. There is no home page, no privacy policy, none of that. I am the only user and I want to share one file among several devices.

So then, this is not the reason why it kept expiring every week or so.

Well, I will try it without verification and see what happens.

Guess I screwed something up in the config, not sure what.

$ rclone lsd wopa:
2024/10/05 16:13:56 ERROR : : error listing: couldn't list directory: googleapi: Error 404: File not found: ., notFound
2024/10/05 16:13:56 NOTICE: Failed to lsd with 2 errors: last error was: couldn't list directory: googleapi: Error 404: File not found: ., notFound

we cannot see into your machine.
always, run all command with debug ouput, ok?

please, post the full output of:

  • rclone lsd wopa: -vv
  • rclone config redacted wopa: -vv
1 Like
$ rclone lsd wopa: -vv
2024/10/05 16:33:38 DEBUG : rclone: Version "v1.68.1" starting with parameters ["rclone" "lsd" "wopa:" "-vv"]
2024/10/05 16:33:38 DEBUG : Creating backend with remote "wopa:"
2024/10/05 16:33:38 DEBUG : Using config file from "/home/xxxxxx/.config/rclone/rclone.conf"
2024/10/05 16:33:38 ERROR : : error listing: couldn't list directory: googleapi: Error 404: File not found: ., notFound
2024/10/05 16:33:38 DEBUG : 6 go routines active
2024/10/05 16:33:38 NOTICE: Failed to lsd with 2 errors: last error was: couldn't list directory: googleapi: Error 404: File not found: ., notFound

$ rclone config redacted wopa: -vv
2024/10/05 16:34:12 DEBUG : rclone: Version "v1.68.1" starting with parameters ["rclone" "config" "redacted" "wopa:" "-vv"]
[wopa]
2024/10/05 16:34:12 DEBUG : Using config file from "/home/xxxxxx/.config/rclone/rclone.conf"
type = drive
client_id = XXX
client_secret = XXX
scope = drive
root_folder_id = XXX
token = XXX
team_drive = 
### Double check the config for sensitive info before posting publicly
2024/10/05 16:34:12 DEBUG : rclone: Version "v1.68.1" finishing with parameters ["rclone" "config" "redacted" "wopa:" "-vv"]

What I don't understand is how the "googleapi" directory has gotten into the picture. It isn't anywhere in my config.

that is not a directory, it is part of the error info.

remove that and try the command again.

Thanks. Well, that got rid of the error but it's not what I want. I want the wopa directory of my google drive mapped to the wopa directory under my home directory. Now, my wopa directory is mapped to the root of my google drive. I had it this way before.