Automatically mount Google Drive fails

What is the problem you are having with rclone?

I want to automatically mount Google Drive

What is your rclone version (output from rclone version)

v1.54.0

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

Raspberrypi3

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)

Paste command here

The rclone config contents with secrets removed.

[Unit]
Description=rclone

[Service]
User=root
ExecStart=/usr/bin/rclone mount gdrive: /gdrive --allow-other --allow-non-empty --vfs-cache-mode writes
Restart=on-abort

[Install]
WantedBy=multi-user.target

It can be connection with Google Drive,image

but when I reboot , it failed to connect!
It say:Failed to create file system for "google_drvie"image|576x76

any help is appreciated!

A log from the command with the -vv flag

Paste  log here

hello,

if you run the rclone command from the command line, does it work?
/usr/bin/rclone mount gdrive: /gdrive --allow-other --vfs-cache-mode writes

i cannot see those small dark fuzzy images.
instead of images, copy and paste text output from the console windows, so we can see it?

also, i would not use --allow-non-empty unless you are 100% sure you need it

Ok, this is fail information

rclone.service - rclone
Loaded: loaded (/usr/lib/systemd/system/rclone.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-10-19 23:30:56 CST; 7h ago
Process: 354 ExecStart=/usr/bin/rclone mount happy_drive: /home/google_drive --allow-other --allow-non-empty --vfs-cache-mode writes (code=exited, status=1
Main PID: 354 (code=exited, status=1/FAILURE)

10月 19 23:30:53 raspberrypi systemd[1]: Started rclone.
10月 19 23:30:56 raspberrypi rclone[354]: Failed to create file system for "happy_drive:": couldn't find root directory ID: Get "https://www.googleapis.com/d
10月 19 23:30:56 raspberrypi systemd[1]: rclone.service: Main process exited, code=exited, status=1/FAILURE
10月 19 23:30:56 raspberrypi systemd[1]: rclone.service: Failed with result 'exit-code'.

If I use this

/usr/bin/rclone mount gdrive: /gdrive --allow-other --vfs-cache-mode writes

2020/10/20 07:30:15 Failed to create file system for "gdrive:": didn't find sect ion in config file

what is the name of the remote, as you are using two names?
gdrive or happy_drive

rclone cannot find a remote named gdrive in the rclone config file.
so can you post the rclone config file, redact id and passwords?

better to test with rclone ls instead of rclone mount

Sorry,I use name of remote is"happy_drive"

Name Type
==== ====
google_drive drive
happy_drive drive <-- I use this

so it should be

/usr/bin/rclone mount happy_drvie: /home/google_drive --allow-other --vfs-cache-mode writes

when I try , it say :2020/10/20 08:40:57 Failed to save config after 10 tries: Failed to create temp file for new config: open /usr/bin/rclone.conf757157133: permission denied

can you test with rclone ls happy_drive:?

I try , and it say:
pi@raspberrypi:~ $ rclone ls happy_drive:
2020/10/20 08:52:18 Failed to save config after 10 tries: Failed to create temp file for new config: open /usr/bin/rclone.conf700964975: permission denied

that looks like a linux file permission error or rclone cannot find or access the config file.
it seems to be trying to create a new config file as per error new config

can you try
rclone config file
and
rclone listremotes

ok , the result is
image

And I try a new one , but when I reboot , it still failed

It said couldn't find root directory

  • can you post the config file, copy and paste from the terminal, do not post screenshots, redact id and passwords.

  • do not use systemd yet, first test from the command line.

  • test with rclone ls, not rclone mount

Do you mean this ?

pi@raspberrypi:~ $ rclone config
Current remotes:

Name Type
==== ====
google_drive drive
happy_drive drive
joy_drive drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> e
Choose a number from below, or type in an existing value
1 > google_drive
2 > happy_drive
3 > joy_drive
remote> 2

[happy_drive]
type = drive
client_id = 1****
client_secret = ******
scope = drive
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2020-10-24T16:03:15.111911706+08:00"}

Edit remote
** See help for drive backend at: https://rclone.org/drive/ **

Value "client_id" = ""
Edit? (y/n)>
y) Yes
n) No (default)
y/n> n
Value "client_secret" = "
"
Edit? (y/n)>
y) Yes
n) No (default)
y/n> n
Value "scope" = "drive"
Edit? (y/n)>
y) Yes
n) No (default)
y/n> n
Value "root_folder_id" = ""
Edit? (y/n)>
y) Yes
n) No (default)
y/n> n
Value "service_account_file" = ""
Edit? (y/n)>
y) Yes
n) No (default)
y/n> n
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n

[happy_drive]
type = drive
client_id = *******
client_secret = *******
scope = drive
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2020-10-24T16:03:15.111911706+08:00"}

edit that last post and redact the client_id and client_secret
never post that info!!!

better to use rclone config dump, redact the client id and client secret.

run this and copy and paste from the terminal and post the it.
rclone ls joy_drive:

rclone config dump
{
"google_drive": {
"client_id": "",
"client_secret": "
",
"scope": "drive",
"token": "{"access_token":"XXX","token_type":"Bearer","r efresh_token":"XXX","expiry":"2020-10-12T23:51:34.2948 84692+08:00"}",
"type": "drive"
},
"happy_drive": {
"client_id": "****",
"client_secret": "",
"scope": "drive",
"token": "{"access_token":"XXX","token_type":"Bearer"," refresh_token":"XXX","expiry":"2020-10-24T16:03:15.111 911706+08:00"}",
"type": "drive"
},
"joy_drive": {
"client_id": "
",
"client_secret": "
*****",
"scope": "drive",
"token": "{"access_token":"XXX","token_type":"Bearer","r efresh_token":"XXX","expiry":"2020-10-24T16:50:02.5004 33712+08:00"}",
"type": "drive"
}

run this and copy and paste from the terminal and post the it.
rclone ls joy_drive:

pi@raspberrypi:~ $ rclone ls joy_drive:
2020/10/24 21:21:19 Failed to save config after 10 tries: Failed to create temp file for new config: open /usr/bin/rclone.conf615553207: permission denied

as i mentioned, up above in this post,
that looks like a linux flie permission error.

can you do a rclone config file

pi@raspberrypi:~ $ rclone config file
Configuration file is stored at:
/usr/bin/rclone.conf

that is not a good location for the config file.

https://rclone.org/docs/#config-config-file

So I need to create a folder name "rclone", and put rclone.conf into it ?