Unable to get drive_id and type with OneDrive on Windows

What is the problem you are having with rclone?

Issues mounting rclone remotes from the command line.
Summary follows, detail description listed below.
I can successfully create a OneDrive remote, using a ClientID and Secret using rclone config and then mount the remote using rclone mount... happy days :slight_smile: But I am trying to complete the same via a command prompt but get the error "Failed to create file system for "RCloneOneDrive:Media/": unable to get drive_id and drive_type - if you are upgrading from older versions of rclone, please run rclone config and re-configure this backend".
I think it is related to the rclone config create command I am using, but it seems to be successful :frowning:

What is your rclone version (output from rclone version)

Rclone v1.55.1 for Windows, 64 bit

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

Windows 2019 Datacenter, 64bit

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

OneDrive (Business, on the global infrastructure)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone config (and then using the wizard)

rclone mount MyRemoteName:FolderA/ E: --vfs-cache-mode full

This works fine :slight_smile: I then stop the mount and delete the remote and try the following:

rclone config create RCloneOneDrive onedrive --onedrive-client-id {clientID} --onedrive-client-secret {secret} --onedrive-drive-type business --onedrive-drive-id {driveID} --onedrive-region global

The creation of the remote returns:

Remote config
Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
Auto confirm is set: answering Yes, override by setting config parameter config_is_local=false
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=_Kz47ijBdAgjptNMaF_WVQ
Log in and authorize rclone for access
Waiting for code...
Got code
--------------------
[MyRemoteName]
type = onedrive
token = {"access_token":"{token}","token_type":"Bearer","refresh_token":"{token}","expiry":"{datetime}"}
--------------------

rclone mount MyRemoteName:FolderA/ E: --vfs-cache-mode full

Returns
Failed to create file system for "RCloneOneDrive:Media/": unable to get drive_id and drive_type - if you are upgrading from older versions of rclone, please run `rclone config` and re-configure this backend

The rclone config contents with secrets removed.

C:\Program Files\rclone-v1.55.1-windows-amd64>rclone config show
[MyRemoteName]
type = onedrive
token = {"access_token":"{token}","token_type":"Bearer","refresh_token":"{token}","expiry":"{datetime}"}

A log from the command with the -vv flag

2021/05/09 14:34:00 DEBUG : Using config file from "C:\\Users\\...\\rclone.conf"
2021/05/09 14:34:00 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "config" "create" "MyRemoteName" "onedrive" "-vv" "--onedrive-client-id" "Clientid" "--onedrive-client-secret" "Secret" "--onedrive-drive-type" "business" "--onedrive-drive-id" "driveid" "--onedrive-region" "global"]
Remote config
Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
Auto confirm is set: answering Yes, override by setting config parameter config_is_local=false
2021/05/09 14:34:00 DEBUG : Starting auth server on 127.0.0.1:53682
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=KzE4FlgTJdZc39M5ydzvbw
Log in and authorize rclone for access
Waiting for code...
2021/05/09 14:34:00 DEBUG : Redirecting browser to: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?access_type=offline&client_id=client&redirect_uri=http%3A%2F%2Flocalhost%3A53682%2F&response_type=code&scope=Files.Read+Files.ReadWrite+Files.Read.All+Files.ReadWrite.All+offline_access+Sites.Read.All&state=KzE4FlgTJdZc39M5ydzvbw
2021/05/09 14:34:01 DEBUG : Received GET request on auth server to "/"
Got code
2021/05/09 14:34:02 DEBUG : Saving config "token" = "{\"access_token\":\"{token}",\"token_type\":\"Bearer\",\"refresh_token\":\"{token}\",\"expiry\":\"{dateimte}\"}" in section "MyRemoteName" of the config file
2021/05/09 14:34:02 DEBUG : Keeping previous permissions for config file: -rw-rw-rw-
2021/05/09 14:34:02 DEBUG : MyRemoteName: Saved new token in config file
2021/05/09 14:34:02 DEBUG : Closing auth server
2021/05/09 14:34:02 DEBUG : Closed auth server with error: accept tcp 127.0.0.1:53682: use of closed network connection
2021/05/09 14:34:02 DEBUG : Keeping previous permissions for config file: -rw-rw-rw-
--------------------
[MyRemoteName]
type = onedrive
token = {"access_token":"{token details}"}
--------------------
2021/05/09 14:34:02 DEBUG : rclone: Version "v1.55.1" finishing with parameters ["rclone" "config" "create" "MyRemoteName" "onedrive" "-vv" "--onedrive-client-id" "Clientid" "--onedrive-client-secret" "Secret" "--onedrive-drive-type" "business" "--onedrive-drive-id" "driveid" "--onedrive-region" "global"]
2021/05/09 14:38:37 DEBUG : Using config file from "C:\\Users---\\rclone.conf"
2021/05/09 14:38:37 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone.exe" "mount" "-vv" "MyRemoteName:Media/" "E:" "--vfs-cache-mode" "full"]
2021/05/09 14:38:37 DEBUG : Creating backend with remote "MyRemoteName:Media/"
2021/05/09 14:38:37 Failed to create file system for "MyRemoteName:Media/": unable to get drive_id and drive_type - if you are upgrading from older versions of rclone, please run `rclone config` and re-configure this backend

Creating a onedrive remote programatically is problematic at the moment.

The problem being that the post oauth questions need to be answered

I am in the process of fixing this for 1.56 though.

Nick, you're a hero! I'm very impressed by how well RClone works and how many providers it supports :slight_smile:

So, in summary, at the present version (1.55), it is not possible to automate authenticating and mounting automatically at system start up due to the interactive nature of oAuth, but it potentially will be possible in 1.56 onwards?

Appreciate your response and very much looking forward to the next version (not that the current version is unappreciated).

Also, assuming anyone else is trying to achieve the same, I didnt phrase the above very well.

It is possible to manually configure RClone using the config wizard the first time using an App ID and Secret. RClone stores this in the file described using

rclone.exe config file

And run...

rclone mount MyRemoteName:FolderA/ E: --vfs-cache-mode full

on boot. My understanding of the limitation is changing the remote configuration automatically via scripting. This will mount OneDrive as a drive automatically :slight_smile:

It works for most of the backends with oauth, but not with onedrive specifically because of the questions needed to work out what kind of onedrive it is.

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