Run Binary, Commands and scripts from CLI and Boot scripts

Hello,

I upgraded my router from an older compatible version. I have a compiled binary that I previously ran successfully from the Startup and Firewall Scripts. Also, I previously installed softflowd and ran 3 instances from the startup and firewall boot scripts.

I could also run these commands, binaries and shell scripts from the CLI.

Are there any suggestions, dependent packages, etc. I may need to install, or anything else that may be required to run binaries from the boot scripts and command line?

Thanks

This is the error I receive:

root@LEDE:/etc/config# ./examplecommand
-ash: ./examplecommand: not found

ls -la /etc/config/examplecommand

Stangri,

The command you posted shows the file information, so I assume you want to verify that I have set the file as executable.

-rwxr-xr-x 1 root root 23895 Aug 14 2015 /etc/config/examplecommand

As I noted, this worked in a previous version by running:

./etc.config/examplecommand

In addition, I noted I'm experiencing issues with scrips, as well as an installed package named softflowd.

Thanks

From which old to which new LEDE firmware did you upgrade?
Where does that binary come from? When was is compiled?

The error message sounds like your binary has been compiled with a different musl version than the firmware image itself.

Do make dirclean, then compile the firmware image and your binary at the same time.

I upgraded from 14, to 15; and then from 15 to LEDE 17

The binary is ampr-ripd, it is a modified RIPv2 daemon that runs on a network to allow mesh nodes over the Internet for Amateur Radio Licensees.

It is written in C and I cross compiled it in version 14.0 days.

The developer of ampr-ripd (callsign: YO2LOJ), just informed me its only dependency is libc (which is installed).

Which libc version?
LEDE uses musl libc 1.1.16

Might be ash doesn't allow binaries to be run in the same dir. Try

/bin/ash /path/to/your/binary

root@LEDE:/etc/config# /bin/ash /etc/config/ampr-ripd
/etc/config/ampr-ripd: line 1: syntax error: unexpected "("

root@LEDE:/etc/config# ./ampr-ripd
ash: ./ampr-ripd: not found

Binaries compiled with older Openwrt or LEDE versions will cause that kind of error due to changed clib versions. Openwrt 14.07 and 15.05 still used uclibc while Openwrt DD trunk and LEDE use musl clib.

You need to cross compile the app again with the current toolchain.

I'll try that when I have an opportunity and inform the thread.

Thanks.

I want to update you all (and ask if I should perhaps make a new thread for this).

After some time, and working with the developer, we had to add the following line to the in.c file:

#define IPPORT_ROUTESERVER <number-is-here>

Even after doing so, we receive this error:

user@user:~/ampr-ripd-1.16.2$ mips-openwrt-linux-musl-gcc ampr-ripd.c
ampr-ripd.c: In function 'main':
ampr-ripd.c:1865:13: error: 'struct udphdr' has no member named 'dest'
(udh->dest == htons(IPPORT_ROUTESERVER)) &&
^
ampr-ripd.c:1866:13: error: 'struct udphdr' has no member named 'source'
(udh->source == htons(IPPORT_ROUTESERVER)))
^

Any idea?

Thanks

An update. I had success in compiling using the following command:

mips-openwrt-linux-g++ ampr-ripd.c -v -Wwrite-strings -fpermissive

I now receive the following error:

root@LEDE:/etc/config# ./ampr-ripd-1.16.2-MIPS
Error loading shared library libstdc++.so.6: No such file or directory (needed by ./ampr-ripd-1.16.2-MIPS)

I solved that by adding the package libstdcpp

But...my original problem still exists...I'm unable to run the file from the firewall/startup scripts. This is also the same behavior for a package I installed via opkg named softflowd (it also no longer runs form the scripts).

Any ideas?

Thanks

Solved:

for the binary: I did /example instead of ./example (i also have to do that for any commands that may be specified within arguments in any executed command.

for the installed package: I now have to leave the process "Enabled" on the Process list. It does not appear to run any instances from the provided softflowd config script. In any case, I am now able to execute those instances.

Thanks All !