Tokens not updating on 1 of 2 remotes

What is the problem you are having with rclone?

My access tokens aren't updating on one of my remotes. This is across several machines, and always the same remote, though the expiry date varies.

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.8

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)

$ sudo rclone about gcrypt2: -vv

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = [].apps.googleusercontent.com
client_secret = []
scope = drive
token = {"access_token":"[]","expiry":"2022-08-22T21:36:58.980194643-07:00"}
root_folder_id = []

[gcrypt]
type = crypt
remote = gdrive:/crypt
filename_encryption = standard
directory_name_encryption = true
password = []
password2 = []

[gdrive2]
type = drive
client_id = [].apps.googleusercontent.com
client_secret = []
scope = drive
token = {"access_token":"[]","expiry":"2022-08-22T20:36:58.75934746-07:00"}
team_drive = 
root_folder_id = []

[gcrypt2]
type = crypt
remote = gdrive2:/gcrypt2
password = []
password2 = []

This is from /home/myuser/.config/rclone/rclone.conf. This is what my rclone systemd service files reference. Here is the status output:

$ service rclone2 status
● rclone2.service - rclonemount
     Loaded: loaded (/etc/systemd/system/rclone2.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-08-22 21:22:43 PDT; 8min ago
    Process: 826499 ExecStartPre=/bin/mkdir -p /home/myuser/gdrive2/ (code=exited, status=0/SUCCESS)
   Main PID: 826500 (rclone)
      Tasks: 14 (limit: 28656)
     Memory: 35.2M
     CGroup: /system.slice/rclone2.service
             └─826500 /usr/bin/rclone mount gcrypt2: /home/myuser/gdrive2/ --user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.>

Aug 22 21:22:43 htpc-mint systemd[1]: Starting rclonemount...
Aug 22 21:22:43 htpc-mint systemd[1]: Started rclonemount.
Aug 22 21:23:20 htpc-mint rclone[826500]: /: Dir.Stat error: couldn't list directory: Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd>
                                          Response: {
                                            "error": "invalid_grant",
                                            "error_description": "Bad Request"
                                          }
Aug 22 21:23:26 htpc-mint rclone[826500]: /: Dir.Stat error: couldn't list directory: Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd>
                                          Response: {
                                            "error": "invalid_grant",
                                            "error_description": "Bad Request"
                                          }
Aug 22 21:23:32 htpc-mint rclone[826500]: /: Dir.Stat error: couldn't list directory: Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd>
                                          Response: {
                                            "error": "invalid_grant",
                                            "error_description": "Bad Request"
                                          }
Aug 22 21:23:44 htpc-mint rclone[826500]: /: Dir.Stat error: couldn't list directory: Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd>
                                          Response: {
                                            "error": "invalid_grant",
                                            "error_description": "Bad Request"
                                          }
Aug 22 21:26:21 htpc-mint rclone[826500]: /: Dir.Stat error: couldn't list directory: Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd>
                                          Response: {
                                            "error": "invalid_grant",
                                            "error_description": "Bad Request"
                                          }

A log from the command with the -vv flag

sudo rclone about gcrypt2: -vv --config /home/myuser/.config/rclone/rclone.conf
2022/08/22 21:36:39 DEBUG : rclone: Version "v1.50.2" starting with parameters ["rclone" "about" "gcrypt2:" "-vv" "--config" "/home/mike/.config/rclone/rclone.conf"]
2022/08/22 21:36:39 DEBUG : Using config file from "/home/mike/.config/rclone/rclone.conf"
2022/08/22 21:36:39 DEBUG : gdrive2: Loaded invalid token from config file - ignoring
2022/08/22 21:36:39 DEBUG : gdrive2: Token refresh failed try 1/5: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
2022/08/22 21:36:40 DEBUG : gdrive2: Loaded invalid token from config file - ignoring
2022/08/22 21:36:40 DEBUG : gdrive2: Token refresh failed try 2/5: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
2022/08/22 21:36:41 DEBUG : gdrive2: Loaded invalid token from config file - ignoring
2022/08/22 21:36:42 DEBUG : gdrive2: Token refresh failed try 3/5: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
2022/08/22 21:36:43 DEBUG : gdrive2: Loaded invalid token from config file - ignoring
2022/08/22 21:36:43 DEBUG : gdrive2: Token refresh failed try 4/5: oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
}


Edit to add: I updated to rclone 1.59.1, and rebooted my computer, but the problem persists.

Did the client ID/secret get removed?

If not, try to reconnect the remote.

rclone config reconnect gdrive2:

I just censored them for the post. I did as you suggested, and it renewed the token, but I have some confusion that might be relevant. The rclone config in my user folder did not get updated with the new token, but the config in my root folder did. I have tried restarting the rclone service as my user, with sudo, and as root. I tried changing the config path in the service file to point to the root folder config. None of that has gotten me back into my folder.

The rclone.conf is user specific so you'd want to ensure you are connecting / updating the right one.

I wouldn't recommend running as root as there really isn't a need for it.

I use:

felix@gemini:~$ rclone config file
Configuration file is stored at:
/opt/rclone/rclone.conf
felix@gemini:~$ env | grep RCLONE_CONF
RCLONE_CONFIG=/opt/rclone/rclone.conf

and my service file has a pointer to that as well.

[Service]
Type=notify
Environment=RCLONE_CONFIG=/opt/rclone/rclone.conf

If you ran something as root and use a different user, it would have a rclone.conf in each user's home directory or vice versa.

I have modified my service file and my bashrc file as per your suggestion. Neither of those seem to have worked. Note that I have two different remotes, both encrypted. They both have the same configuration, yet I'm only having this problem with one of them. I can't find any reason why rclone would be running as root under normal circumstances: the service files for both remotes point to my user rclone.conf, and there isn't anything in crontab or sudo crontab.

What I have done just now, is copy the root rclone.conf over my user rclone.conf, and now I can browse both remotes! I still don't understand what's going on, and I'm afraid I'll have to manually renew one of my remotes from now on.

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