OneDrive - rclone mount - Windows vs Linux

What is the problem you are having with rclone?

I am running rclone mount on Windows and it does not need to create target directory, but at Linux, it requires that the target folder exist. Help me for creating a command that works on both Windows and Linux powershell console.

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

on Linux:

rclone v1.62.2
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.19.0-43-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: none

On Windows:

rclone v1.62.2
- os/version: Microsoft Windows 10 Home 22H2 (64 bit)
- os/kernel: 10.0.19045.2965 Build 19045.2965.2965 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.20.2
- go/linking: static
- go/tags: cmount

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

OneDrive

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

rclone mount njt145-OneDrive:/myScripts $HOME/myScripts2 --vfs-cache-mode writes --poll-interval 0m1s --cache-db-purge

The rclone config contents with secrets removed.

[njt145-OneDrive]
type = onedrive
token = {"access_token":XXXXXXXXX,"token_type":"Bearer","refresh_token":XXXXXXXXX,"expiry":XXXXXXXXX}
drive_id = XXXXXXXXXXXX
drive_type = personal

A log from the command with the -vv flag

On Linux:

2023/06/11 15:28:01 DEBUG : rclone: Version "v1.62.2" starting with parameters ["/usr/bin/rclone" "mount" "njt145-OneDrive:/myScripts" "/home/njt145/myScripts2" "--vfs-cache-mode" "writes" "--poll-interval" "0m1s" "--cache-db-purge" "-vv"]
2023/06/11 15:28:01 DEBUG : Creating backend with remote "njt145-OneDrive:/myScripts"
2023/06/11 15:28:01 DEBUG : Using config file from "/home/njt145/.config/rclone/rclone.conf"
2023/06/11 15:28:01 DEBUG : fs cache: renaming cache item "njt145-OneDrive:/myScripts" to be canonical "njt145-OneDrive:myScripts"
2023/06/11 15:28:02 DEBUG : OneDrive root 'myScripts': Next delta token is: XXXXXXXXXXXXX
2023/06/11 15:28:02 DEBUG : vfs cache: root is "/home/njt145/.cache/rclone"
2023/06/11 15:28:02 DEBUG : vfs cache: data root is "/home/njt145/.cache/rclone/vfs/njt145-OneDrive/myScripts"
2023/06/11 15:28:02 DEBUG : vfs cache: metadata root is "/home/njt145/.cache/rclone/vfsMeta/njt145-OneDrive/myScripts"
2023/06/11 15:28:02 DEBUG : Creating backend with remote "/home/njt145/.cache/rclone/vfs/njt145-OneDrive/myScripts"
2023/06/11 15:28:02 DEBUG : Creating backend with remote "/home/njt145/.cache/rclone/vfsMeta/njt145-OneDrive/myScripts"
2023/06/11 15:28:02 INFO  : vfs cache: cleaned: objects 0 (was 0) in use 0, to upload 0, uploading 0, total size 0 (was 0)
2023/06/11 15:28:02 Fatal error: failed to mount FUSE fs: cannot open: /home/njt145/myScripts2: open /home/njt145/myScripts2: no such file or directory

The problem is that, at Windows, it requires that the target folder myScripts2 does not exist. Are there any way to config both win and linux fuse settings similar in order to solve this issue?

but why it is problem? I am not sure I understand. Different system - different requirements. Or am I missing something here

I want to make a powershell script that works on both Windows and Linux. If there is a way to config fuse, tell me so that I will do it for that.
I am looking for a cross platform solution, and that's why I am trying rclone.

OK - do not know anything about powershell.... but can't you detect from it where it is run? if windows do A, if linux do B?

That won't be a solution, but a workaround. I am looking for a solution. Anyway to config Fuse for doing the same thing on Windows and Linux?

@asdffdsa could you please help here? I think you use WLS...

Actually, I will use it in WSL too, so any help is appreciated. Thanks for quick reply...

I checked Frequently Asked Questions · WinFsp and it says that it is because of a Windows issue. So, I will try your workaround. However, I don't know what to do on WSL... Any problem that I might face with? Any ideas?

i agree. write a powershell script to check the os. nice and simple.

if ($IsLinux) {
    Write-Host "Linux"
}
elseif ($IsMacOS) {
    Write-Host "macOS"
}
elseif ($IsWindows) {
    Write-Host "Windows"
}

check out my post at

2 Likes

One point to add:
If user is using the old Windows Powershell, here is the way how to add these parameters to it:

# OS type check parameters setup for Windows PowerShell
# https://stackoverflow.com/a/68105970/11289937
# https://stackoverflow.com/a/70835909/11289937
if ($PSVersionTable.PSVersion.Major -lt 6.0) {
    switch ($([System.Environment]::OSVersion.Platform)) {
        'Win32NT' { 
            New-Variable -Option Constant -Name IsWindows -Value $True -ErrorAction SilentlyContinue
            New-Variable -Option Constant -Name IsLinux -Value $false -ErrorAction SilentlyContinue
            New-Variable -Option Constant -Name IsMacOs -Value $false -ErrorAction SilentlyContinue
        }
    }
}

I also put my references for that code at the comments, so anyone that is interested in this topic can check it.
Thanks for the help :grinning:

fwiw, you can run a command inside wsl from windows.
i find this very handy as i am a long time windows user, learning more about wsl over time.

i often run those commands/scripts from notepad++ on windows
and get the console output display inside notepad++
so basically one simple IDE for windows and wsl, very convient

  • wsl -u user01 ./$(FILE_NAME)
  • bash ./$(FILE_NAME)

image

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