Rclone with LEDE-OpenWRT Router

First of all, thank the effort in creating this wonderful tool.

I would like to know if someone has managed to install and run rclone on an LEDE-OpenWRT router with the SoC MediaTek MT7621A. I know that with ARM SoCs it is possible, but I have not seen much information about more modest SoC. I suppose I should use a MIPS version. I have tried both versions; (BE and LE) and the executable does not start.

Has anyone got it?

:smile:

Some kind of mips looks correct to me.

When you say it dosn’t start, do you get any error messages? Can you paste them?

Have you got gdb on the router?

Thanks for your support.

Sorry for the short information in the question. I’m a completly noob about this.
Maybe, the first question would be what is the MIPS version I’d have to use; little or big Endian. I don’t know what is the diference? I have the zip in the PC. Files extracted. I copied rclone and rclone.1 to the LEDE router. I give chmod +x rigths to the rclone file and it doesn’t work.

I don’t know if is there anyway to make a cleaner installation.

Sorry for my english

One will work and one won’t - I don’t know which though.

Can you try both?

Does it print anything when you try it?

Thanks again.

LE: Illegal instruction (https://downloads.rclone.org/rclone-current-linux-mipsle.zip)
BE: ./rclone: line 1: syntax error: unexpected “(” (https://downloads.rclone.org/rclone-current-linux-mips.zip)

Ah OK. Looks like the little endian version is the correct one.

I suspect that your processor doesn’t have a floating point unit. This is implied in the product datasheet for the 1004K series. The go runtime requires a floating point by default. However there is a compile time switch to fallback to software floating point GOMIPS.

I’ve uploaded a version of rclone compiled using the emulated floating point here:

https://pub.rclone.org/rclone-v1.41-037-g9698a2ba-mipsle-softfloat.zip

I made this with:

GOMIPS=softfloat GOOS=linux GOARCH=mipsle go build -v

Let me know if it works!

Thank you so much for your support.

With this version I have the same “Illegal instruction” message. Also, I noticed that the size of this version is almost twice than the original LE. Is it normal?

:frowning:

Do you have gdb? If do can you run

gdb rclone help

Then when it crashes it should show you how it crashed?

It contains full debug symbols unlike the production builds.

It’s not installed. Could install it?

The LEDE-OpenWRT firmware version is installed from these binaries

http://archive.openwrt.org/snapshots/trunk/ramips/mt7621/

Finally I installed gdb and run the command. This is the result:

root@LEDE:/tmp# gdb rclone help
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-openwrt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from rclone...done.
/tmp/help: No such file or directory.
warning: Unsupported auto-load script at offset 0 in section .debug_gdb_scripts
of file /tmp/rclone.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb)

That is good.

Now you need to type run.

1 Like

This is the result:

(gdb) run
Starting program: /root/rclone/rclone

Program received signal SIGILL, Illegal instruction.
runtime.check () at /opt/go/go1.10/src/runtime/runtime1.go:146
146 /opt/go/go1.10/src/runtime/runtime1.go: No such file or directory.
(gdb) Quit

OK let’s take a step back.

I’ve compiled a simple hello world program 8 different ways - can you try running each of the binaries? If it works it should print “Hello World”.

https://pub.rclone.org/hello-mips.zip

Archive:  hello-mips.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
  2085653  2018-05-12 09:19   hello-mipsle-hardfloat-go1.10
  2413723  2018-05-12 09:19   hello-mipsle-hardfloat-go-tip
  2085653  2018-05-12 09:19   hello-mipsle-softfloat-go1.10
  2413723  2018-05-12 09:19   hello-mipsle-softfloat-go-tip
  2085651  2018-05-12 09:19   hello-mips-hardfloat-go1.10
  2413912  2018-05-12 09:19   hello-mips-hardfloat-go-tip
  2085460  2018-05-12 09:19   hello-mips-softfloat-go1.10
  2413721  2018-05-12 09:19   hello-mips-softfloat-go-tip
---------                     -------
 17997496                     8 files

These are compiled with and without go-1.10/go-tip softfloat/hardfloat mipsle/mips

2 Likes

Thank you so much for your work.

The result:

./hello-mipsle-softfloat-go-tip —> Hello, World!
./hello-mips-hardfloat-go-tip —> ./hello-mips-hardfloat-go-tip: line 1: syntax error: unexpected “(”
./hello-mips-softfloat-go-tip —> ./hello-mips-softfloat-go-tip: line 1: syntax error: unexpected “(”
./hello-mipsle-hardfloat-go-tip —> Hello, World!
./hello-mips-softfloat-go1.10 —> ./hello-mips-softfloat-go1.10: line 1: syntax error: unexpected “(”
./hello-mipsle-softfloat-go1.10 —> Illegal instruction
./hello-mipsle-hardfloat-go1.10 —> Illegal instruction
./hello-mips-hardfloat-go1.10 —> ./hello-mips-hardfloat-go1.10: line 1: syntax error: unexpected “(”

That is good! So it looks like that there was a bug in go, but it is now fixed!

Here is rclone compiled with hardfloat (the default) mipsle with go tip - hopefully it will work :smile:

$ go version
go version devel +f94b5a8105 Sat May 12 06:21:01 2018 +0000 linux/amd64
$ GOARCH=mipsle go build -ldflags '-s'

https://pub.rclone.org/rclone-v1.41-058-ge62d2fd3-mipsle-tip.zip

The result:

root@LEDE:~/rclone# ./rclone
SIGILL: illegal instruction
PC=0x25eb5c m=0 sigcode=128

goroutine 1 [running, locked to thread]:
math/big.init()
/opt/go/go-tip/src/math/big/sqrt.go:10 +0xbc fp=0x1c78e58 sp=0x1c78e48 pc=0x25eb5c
crypto/rsa.init()
:1 +0x90 fp=0x1c78e90 sp=0x1c78e58 pc=0x265b04
crypto/x509.init()
:1 +0xc8 fp=0x1c78ea4 sp=0x1c78e90 pc=0x29d630
crypto/tls.init()
:1 +0xc0 fp=0x1c78ec0 sp=0x1c78ea4 pc=0x2cd178
net/http.init()
:1 +0x84 fp=0x1c78f8c sp=0x1c78ec0 pc=0x35d524
github.com/ncw/rclone/fs.init()
:1 +0x108 fp=0x1c78fa0 sp=0x1c78f8c pc=0x3750cc
github.com/ncw/rclone/cmd.init()
:1 +0xe8 fp=0x1c78fc8 sp=0x1c78fa0 pc=0x3df1b0
main.init()
:1 +0x88 fp=0x1c78fcc sp=0x1c78fc8 pc=0xa0960c
runtime.main()
/opt/go/go-tip/src/runtime/proc.go:188 +0x1f8 fp=0x1c78fec sp=0x1c78fcc pc=0x45b1c
runtime.goexit()
/opt/go/go-tip/src/runtime/asm_mipsx.s:660 +0x4 fp=0x1c78fec sp=0x1c78fec pc=0x7b700

r0 0x0 r1 0x2
r2 0x1 r3 0x1
r4 0x0 r5 0x10
r6 0x123abbc r7 0x123a3c0
r8 0xfc r9 0x20
r10 0x1 r11 0x0
r12 0x0 r13 0x0
r14 0x1ffffff r15 0x67
r16 0x0 r17 0x0
r18 0x1ffffff r19 0x6fd23211
r20 0x1c0c330 r21 0x1c0c330
r22 0xc892c4 r23 0xd20000
r24 0x2 r25 0x0
r26 0x0 r27 0x0
r28 0x0 r29 0x1c78e48
r30 0x1c000e0 r31 0x25eb58
pc 0x25eb5c link 0x25eb58
lo 0x0 hi 0x0

Ah, well that is working much better - the go runtime has started up and is alive enough to give a sensible backtrace.

It looks like it crashed in some floating point activities, so maybe your board doesn’t support hardfloat after all (I didn’t test floating point in my hello world test - I probably should have).

OK, so here is a version compiled with softfloat…

$ go version
go version devel +f94b5a8105 Sat May 12 06:21:01 2018 +0000 linux/amd64
$ GOARCH=mipsle GOMIPS=softfloat GOOS=linux go build -ldflags '-s'

https://pub.rclone.org/rclone-v1.41-058-ge62d2fd3-mipsle-softfloat-tip.zip

Cross fingers that is the one!

Bad luck!
Same error, I guess.

root@LEDE:~/rclone# ./rclone
SIGILL: illegal instruction
PC=0x25eb5c m=0 sigcode=128

goroutine 1 [running, locked to thread]:
math/big.init()
/opt/go/go-tip/src/math/big/sqrt.go:10 +0xbc fp=0x1c78e58 sp=0x1c78e48 pc=0x25eb5c
crypto/rsa.init()
:1 +0x90 fp=0x1c78e90 sp=0x1c78e58 pc=0x265b04
crypto/x509.init()
:1 +0xc8 fp=0x1c78ea4 sp=0x1c78e90 pc=0x29d630
crypto/tls.init()
:1 +0xc0 fp=0x1c78ec0 sp=0x1c78ea4 pc=0x2cd178
net/http.init()
:1 +0x84 fp=0x1c78f8c sp=0x1c78ec0 pc=0x35d524
github.com/ncw/rclone/fs.init()
:1 +0x108 fp=0x1c78fa0 sp=0x1c78f8c pc=0x3752dc
github.com/ncw/rclone/cmd.init()
:1 +0xe8 fp=0x1c78fc8 sp=0x1c78fa0 pc=0x3df58c
main.init()
:1 +0x88 fp=0x1c78fcc sp=0x1c78fc8 pc=0xa09aac
runtime.main()
/opt/go/go-tip/src/runtime/proc.go:188 +0x1f8 fp=0x1c78fec sp=0x1c78fcc pc=0x45b1c
runtime.goexit()
/opt/go/go-tip/src/runtime/asm_mipsx.s:660 +0x4 fp=0x1c78fec sp=0x1c78fec pc=0x7b700

r0 0x0 r1 0x2
r2 0x1 r3 0x1
r4 0x0 r5 0x10
r6 0x123abbc r7 0x123a3c0
r8 0xfc r9 0x20
r10 0x1 r11 0x0
r12 0x0 r13 0x0
r14 0x1ffffff r15 0x67
r16 0x0 r17 0x0
r18 0x1ffffff r19 0x6f259211
r20 0x1c0c330 r21 0x1c0c330
r22 0xc892e4 r23 0xd20000
r24 0x2 r25 0x0
r26 0x0 r27 0x0
r28 0x0 r29 0x1c78e48
r30 0x1c000e0 r31 0x25eb58
pc 0x25eb5c link 0x25eb58
lo 0x0 hi 0x0

In that error it appears to be making a floating point number, so it still seems like it is something to do with floating point numbers.

Ah, I see from a bit of reading that I need to clean the build environment when swapping between hardfloat and softfloat

So building with

$ go version
go version devel +f94b5a8105 Sat May 12 06:21:01 2018 +0000 linux/amd64
$ GOARCH=mipsle GOMIPS=softfloat GOOS=linux go build -a -v -ldflags '-s'

Gives

https://pub.rclone.org/rclone-v1.41-058-ge62d2fd3-mipsle-softfloat-tip-2.zip

Can you see if that works any differently? The binaries are the same size but the contents are quite different…

Bingo!!!

This version works flawlessly. Congratulations and thank you so much again for your time and support.

BTW, I’ve installed fuse-utils package (opkg update ; opkg install fuse-utils) to install fursemount

Now I will make other settings, but almost with Gdrive works very well.

Thank you.