al-caughey/YAMon-v4

4.0.7 will not run on OpenWRT

Opened this issue · 5 comments

I am unable to get YAMon 4.0.7 running on a ZBT-WE826/MoFi4500 running either GoldenOrb/ROOter based on either OpenWRT 18.0.7 or 19.07.2, I have tried various install destinations, firstly a 4GB SD Card with symbolic links then finally directly on the router to /opt.

Have tried the same install procedure/steps with 3.4.7 and everything works fine.

Error:
"This text will go away once all of the data has loaded.
Ah nuts! An unexpected JavaScript error has prevented the reports from opening properly.
Please go to the Help page to find out how you can help resolve this issue."
Uncaught SyntaxError: Unexpected identifier
   4. var _firmwareName = "DISTRIB_DESCRIPTION="GoldenOrb_2020-03-01 ( OpenWrt 18.06.7 )"  "

jquery.min.js:2 jQuery.Deferred exception: _wwwData is not defined ReferenceError: _wwwData is not defined
    at loadDevices (https://usage-monitoring.com/current/js/yamon4.0.js?_=1585007077874:163:2)
    at https://usage-monitoring.com/current/js/yamon4.0.js?_=1585007077874:108:23
    at u (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:27457)
    at Object.add [as done] (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:27735)
    at HTMLDocument.<anonymous> (https://usage-monitoring.com/current/js/yamon4.0.js?_=1585007077874:80:17)
    at l (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29375)
    at c (https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js:2:29677) undefined

Also tried updating config.file "_wwwData=" with various combinations of "data/", "data4/"

Noticed the following while running install.sh

**********************************************************
*** Saved configuration settings to `/opt/YAMon4/config.file`
*** & copied previous file to `/opt/YAMon4/config.old`
**********************************************************
chmod: /tmp/www/: No such file or directory

root@ROOter:/opt# ls -l /www
lrwxrwxrwx    1 root     root            10 Mar 24 05:41 yamon -> /tmp/yamon

Have to run the following after running install.sh

rm /www/yamon
ln -s /tmp/www /www/yamon
service yamon4 enable
reboot

I am not familiar with GoldenOrb/ROOter... Often firmware variants have idiosyncrasies which require tweaks.

First and foremost... are the cron jobs running and generating data files? (if yes, the installation location is not the problem)

From the first part of your message, it looks like the value of _firmwareName has extra quotes
var _firmwareName = "DISTRIB_DESCRIPTION="GoldenOrb_2020-03-01 ( OpenWrt 18.06.7 )" "

That'll definitely mess-up the JS reports.

(I didn't anticipate that those would appear in that string)
As a manual work-around, _firmwareName is stored in /opt/YAMon4/config.file (and then gets copied into /tmp/www/js/config4.0.js). You definitely want to remove the extra quotes (likely the DISTRIB_DESCRIPTION=") in config.file. If you then restart the script, it will re-write config4.0.js). Alternatively you can edit both files and then do not have to restart.

Can you run validate.sh and then send the log to questions@usage-monitor.com?

Thx.

Al

Both validation.log and YAMon.log are attached to this issue report, but I can email them if needed

FYI GoldenOrb/ROOter.is just a fork of OpenWrt with cellular modem support built in

Also you were correct the below line was causing the errors
var _firmwareName = "DISTRIB_DESCRIPTION="GoldenOrb_2020-03-01 ( OpenWrt 18.06.7 )" "
I changed config.file to
_firmwareName='ROOter_2020-03-06 ( OpenWrt 19.07.2 )'
and everything started up correctly.

To resolve the issue for me in the future I created an update script to make changes to setup4.0.7sh with the following changes:

setup4.0.7.sh Changes:

CHANGED:
distro=$(cat /etc/openwrt_release | grep -i 'DISTRIB_ID' | cut -d"'" -f2)
	DISTRIB_ID="OpenWrt"
TO
distro=$(cat /etc/openwrt_release | grep -i 'DISTRIB_ID' | cut -d"\"" -f2)
	OpenWrt

CHANGED:
installedfirmware=$(cat /etc/openwrt_release | grep -i 'DISTRIB_DESCRIPTION' | cut -d"'" -f2)
	DISTRIB_DESCRIPTION="ROOter_2020-03-06 ( OpenWrt 19.07.2 )"
TO:
installedfirmware=$(cat /etc/openwrt_release | grep -i 'DISTRIB_DESCRIPTION' | cut -d"\"" -f2)
	ROOter_2020-03-06 ( OpenWrt 19.07.2 )

I also added a secition to detect OpenWrt during setup

if [ -f "/etc/openwrt_release" ] ; then
        distro=$(cat /etc/openwrt_release | grep -i 'DISTRIB_ID' | cut -d"\"" -f2)
        installedfirmware=$(cat /etc/openwrt_release | grep -i 'DISTRIB_DESCRIPTION' | cut -d"\"" -f2)
        installedversion=''
        installedtype=''
        if [ "$distro" == "$op_str" ] ; then
                op_str='OpenWrt (*)'
                _firmware=1
        elif [ "$distro" == "$le_str" ] ; then
                le_str='LEDE (*)'
                _firmware=4
        else
                tu_str='Turris (*)'
                _firmware=6
        fi

Had similar issues, re recognising firmware. Mine defaulted to Turris but I knew of course I had OpenWRT (19.07) on a Linksys WRT1900ACSV2.
I also got a non functioning web server after install with the wrong symlink.
Fix as per above made it work:

rm /www/yamon
ln -s /tmp/www /www/yamon
service yamon4 enable
reboot

Linksys WRT1900ACS linksys,shelby |  
OpenWrt 19.07.1 r10911-c155900f66