Getting rclone into OpenWrt?

rclone is an amazing utility. There is a feed here:

it works very well. You can sync files to cloud storage like OneDrive or Google Drive. I personally use it to mount OneDrive in samba mount to present my scanner with share to which it can upload to OneDrive.

... but why is this not in the OpenWrt main?

because the developer hasn't submitted it to openwrt/packages. That's how it works for non-core packages.

From this issue in 2019 you can see he is aware that the community package repo exists

So I think you should ask him why he did not do this. He seems to have a forum account too so @ElonH should send him a notification about this thread

You can also submit the package yourself if you can become its maintainer (i.e. update the links in OpenWrt to point to a newer release)


@ElonH pretty please with a cherry on top?

Or some other kind soul with the skills?

A plus-one here, rclone is very useful.

1 Like

Right! And having to constantly download SDK and rebuild for each snapshot is a little time consuming.

Rclone feels like a staple utility that ought to be a package that is readily available for the average Joe who lacks SDK skills.

I've cleaned up the Makefiles and created a branch for PR:

However, due to the ld linker issue, I have to disable CGO explicitly, but looks a little ugly.

Does anyone know how to address it? Any suggestion is appreciated.

... [cut here] ...
/home/tianling/openwrt/staging_dir/hostpkg/lib/go-cross/pkg/tool/linux_amd64/link: running arm-openwrt-linux-muslgnueabi-gcc failed: exit status 1
collect2: fatal error: cannot find 'ld'
compilation terminated.

/home/tianling/openwrt/staging_dir/hostpkg/lib/go-cross/pkg/tool/linux_amd64/link: running arm-openwrt-linux-muslgnueabi-gcc failed: exit status 1
collect2: fatal error: cannot find 'ld'
compilation terminated.

make[2]: *** [Makefile:95: /home/tianling/openwrt/build_dir/target-arm_xscale_musl_eabi/rclone-1.56.2/.built] Error 2
1 Like

Thank you so much Sir for your actions.

Who can help @1715173329 here?

Thanks, I'm glad to you interest in my repo.

Rclone-OpenWrt contains several packages (rclone, rclone-ng, rclone-webui-react, luci-app-rclone)
@Lynx Do you talk about rclone only or all of them?

I have moved the repo to maintained by ImmortalWrt Team (Of course, I'm one of them).
This repo is old(1.52) but stable.

The PR committed by @1715173329 is a 1.56 version, it workaround, but ugly, just as @1715173329 said. I hope someone can help us.

1 Like

Because of the complexity and time in using the SDK I have only ever used the main rclone package. I have had no stability issues although the guys in the rclone forum advised upgrading to a later version because of its age for what I wanted to do (mount OneDrive). But nevertheless it has always worked flawlessly for my use case. If it were easy to try I would also try out the LuCi packages.

Here is the script I use:

root@OpenWrt:~# cat /etc/init.d/mount-onedrive
#!/bin/sh /etc/rc.common
# Copyright (C) 2007

export PATH=/usr/sbin:/usr/bin:/sbin:/bin

exec &> /tmp/mount-onedrive.log


start() {
        rclone mkdir /tmp/OneDrive
        rclone mount "OneDrive:/Scanned Documents/" /tmp/OneDrive/ --use-mmap --buffer-size 0 --cache-dir /tmp --vfs-cache-mode writes --vfs-cache-max-age 0s --umask 000 --allow-other --daemon

stop() {
        fusermount -zu /tmp/OneDrive
        rclone rmdir /tmp/OneDrive

This mounts the OneDrive onto a samba share so that my scanner, which can only send to LAN shares, can send PDFs, which then get uploaded to OneDrive. All in the router RAM. Works well for me.

I've opened a PR to openwrt/packages:

1 Like

Excellent - great work! Thank you. I think this is a great addition to OpenWrt. I'm surprised it hasn't been done earlier. Perhaps people don't know what rclone can do.

I would be happy to test for latest snapshot on RT3200 but I'm clueless as to how to build package from the new source. Normally I just add @ElonH's source into custom feeds in the SDK and then compile package from that.

1 Like

You may download the prebuilt binaries from GitHub Actions directly :wink:

1 Like

What about for MediaTek MT7622B?

It's aarch64_cortex-a53.
Please download this one:

1 Like

Will do! Do you use rclone too then? It's great.

1 Like

To be honest, it's been a long time since I last used it, also for @ElonH.
We mainly maintain this package for our friends and users.

1 Like

@1715173329 @ElonH had /etc/rclone/rclone.conf the main location for the config file. Shouldn't we include that here too?

What do you mean about "include"?
In the 1.52, I have hacked the rclone default conf file path as /etc/rclone/rclone.conf. And this path is used in luci

Yes, sorry, that is what I meant. Shouldn't the rclone default conf file in 1.56 also be set to /etc/rclone/rclone.conf?

Also what is the purpose of the rclone service file in /etc/init.d?

!/bin/sh /etc/rc.common
# Copyright (C) 2019 ElonH <>



_info() {
        logger -p -t "$APP" "$*"

_err() {
        logger -p daemon.err -t "$APP" "$*"

init_config() {
        config_load "${CONFIGURATION}"
        # Create rclone dirs
        local config_path
        local config_dir
        local log_path
        local log_dir

        config_get config_path config config_path
        config_get log_path log path

        [ -d "$config_dir" ] || mkdir -p "$config_dir" 2>/dev/null

        [ -f "$config_path" ] || touch "$config_path"

        [ -d "/lib/upgrade/keep.d" ] || mkdir -p /lib/upgrade/keep.d/luci-app-rclone 2>/dev/null
        echo "$config_path" > /lib/upgrade/keep.d/luci-app-rclone

        [ -d "$log_dir" ] || mkdir -p "$log_dir" 2>/dev/null && echo /dev/null > "$log_path"

start_service() {

        local enabled
        local config_path
        local addr_type
        local port
        local username
        local password
        local proxy_enable
        local proxy_addr
        local log_path

        config_get enabled global enabled

        config_get config_path config config_path
        config_get addr_type config addr_type
        config_get port config port
        config_get username config username
        config_get password config password

        config_get proxy_enable proxy enabled
        config_get proxy_addr proxy proxy_addr

        config_get log_path log path

        if [[ "${addr_type}" == "local" ]]; then
                addr="$(uci get network.loopback.ipaddr)"
        elif [[ "${addr_type}" == "lan" ]]; then
                addr="$(uci get network.lan.ipaddr)"
        elif [[ "${addr_type}" == "all" ]]; then
        [ "$enabled" == "1" ] || { _info "Instance \"rclone\" disabled."; return 1; }
        _info "Instance \"rclone\" start."
        procd_set_param command /usr/bin/$APP rcd -vv
        procd_append_param command "--rc-addr=$addr:$port"
        procd_append_param command "--rc-user=$username" "--rc-pass=$password"
        procd_append_param command "--config=$config_path"
        procd_append_param command "--rc-allow-origin=*"
        procd_append_param command "--log-file=${log_path}"
        if [[ "${proxy_enable}" == "1" ]]; then
                procd_set_param    env all_proxy="$proxy_addr" https_proxy="$proxy_addr" http_proxy="$proxy_addr"
                procd_append_param env ALL_PROXY="$proxy_addr" HTTPS_PROXY="$proxy_addr" HTTP_PROXY="$proxy_addr"
        procd_set_param stdout 1
        procd_set_param stderr 1
        procd_set_param file /etc/config/rclone
        # procd_set_param pidfile /var/run/
        procd_set_param user rclone
        procd_set_param group rclone
        procd_set_param respawn retry=60

service_triggers() {
        procd_add_reload_trigger "rclone"

Also what is the purpose of the rclone service file in /etc/init.d?

This is for webui, and you may notice there're 2 packages called rclone-webui-react and rclone-ng.
So you can manage files via them.

Aria2 in OpenWrt does the same thing.

Shouldn't the rclone default conf file in 1.56 also be set to /etc/rclone/rclone.conf?

This hack is pointless anyway.
You won't need change the default config path for cli usage, on the other hand, when you start a service for webui, init script will pass config path to rclone.

1 Like