FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

12688 questions

15067 answers

24145 comments

47111 members

0 votes
1,343 views 4 comments
by

According to the latest release notes, TRB14x now supports installation of packages (using opkg).

Given that running a python scrip / application is probably the most common use case (see here), could you please provide the basic steps to install python as well as the dependency paho-mqtt?

1 Answer

0 votes
by

Hello,

To install python using OpenWRT, use these commands when you are logged in to your router via SSH client or CLI: 

opkg update

opkg install python-light

More about Python package and installation: https://openwrt.org/docs/guide-user/services/python

If paho-mqtt dependency is OpenWRT supported, it should be installed the same way as python. Please refer to OpenWRT forums to find correct packages for your use cases.

Regards.

by
A follow-up question: what's the best way to run a long-running python script on the router? I currently start the script with `python script.py&` to run it in the background.

- the script should start on system start and restart if it fails.

- how does the logging work? where can I find the logs for the script?
by

I believe I found a good solution:

edit crontab (on the CLI, run `crontab -e`):

* * * * * flock -n /root/send.lockfile python /root/send.py

Basically, this should start and restart the script whenever it does not run.

by
I just noticed that after a firmware upgrade, all my files as well as the python installation are gone.Is there a way to make the python installation as well as the files I placed on the router permanent?
by

I tried this step but when I run:

opkg update

I get the following errors:

 * opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02.0/targets/mdm9x07/generic/packages/Packages.gz, wget returned 8.
 * opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02.0/packages/arm_cortex-a7_neon-vfpv4/vuci/Packages.gz, wget returned 8.

Any idea what this is about? I have the newest firmware (TRB1_R_00.07.01.4) and internet connection is working in general.