TriggerCMD on openMPTCP a fork of openwrt project
-
Good evening all,
I'm tring to install triggercmd agent on my openmptcp router that has openwrt as base system.
I followed these steps:with opk commands I installed
- node-npm
- git-http
then I have created a folder "agent" under a "script" folder
cd /script/agent/in this folder I cloned the repo:
git clone https://github.com/rvmey/TRIGGERcmd-Agent.gitand try to install with the statement:
npm installbut I otained these errors:
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for node-windows@0.1.14: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"arm64"})
npm ERR! notsup Valid OS: win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: arm64so into the folder:
/script/agent/TRIGGERcmd-AgentI renamed the ubuntupackage.json to package.json and I run again:
npm install
and obtain this error:
npm ERR! code ENOSPC
npm ERR! syscall write
npm ERR! errno -28
npm ERR! nospc ENOSPC: no space left on device, write
npm ERR! nospc There appears to be insufficient space on your system to finish.
npm ERR! nospc Clear up some disk space and try again.Can someone help to solve the problem so I can install the agent please?
many thanks
Egidio -
@eromano said in TriggerCMD on openMPTCP a fork of openwrt project:
npm ERR! code ENOSPC
this is the result of the mount command :
/dev/root on /rom type ext4 (rw,noatime)
devtmpfs on /rom/dev type devtmpfs (rw,relatime,size=918428k,nr_inodes=229607,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mmcblk0p2 on / type ext4 (rw,relatime)
/dev/mmcblk0p1 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
mountd(pid5152) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=21474836510,minproto=5,maxproto=5,indirect) -
@eromano, it looks like you're running out of disk space on your device.
I suggest you delete everything except the src folder for starters.
Then instead of running npm install which would process the package.json and download more modules than you need, please try running the agent.js file like this:
node ./src/agent.js --console
It will probably give an error that a package is missing, but you can install just the packages it complains are missing.
You don't need much because you're not running the GUI portion of the agent.
-
Ok retring to install from zero, after cloning the report in a tmp folder a renaming the file ubuntu pakage to package.json, installation went on but now I'm here with this new error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@27.0.4 postinstall:node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@27.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-03-02T00_19_09_885Z-debug.logAny suggests to me?
thanks
Egidio -
@Russ said in TriggerCMD on openMPTCP a fork of openwrt project:
node ./src/agent.js --console
ok now if I execute
node ./src/agent.js --console
it ask me for the token
-
@Russ thank for your help.
Restarted from zero again and installed only the npm
So now I'm in this situation:running the code:
node ./src/agent.js --console
I obtain:
internal/modules/cjs/loader.js:905
throw err;
^Error: Cannot find module '/tmp/gitrepo/TRIGGERcmd-Agent/agent.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}What I have to do?
Many thanks for your support
Egidio -
@Russ if I try to run:
node ./src/agent.js --console
without npm installed first I obtain:
root@OpenMPTCProuter:/tmp/gitrepo/TRIGGERcmd-Agent# node ./src/agent.js --console
internal/modules/cjs/loader.js:905
throw err;
^Error: Cannot find module 'socket.io-client'
Require stack:- /tmp/gitrepo/TRIGGERcmd-Agent/src/agent.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/tmp/gitrepo/TRIGGERcmd-Agent/src/agent.js:42:22)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/tmp/gitrepo/TRIGGERcmd-Agent/src/agent.js' ]
}
but if execute
npm install
I arrive here:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@27.0.4 postinstall:node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@27.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-03-02T01_18_56_589Z-debug.logbut now if I execute
node ./src/agent.js --console
It ask for the token.
Any Idea to fix the errors? Can I skip them?thanks a lot for your support
Egidio - /tmp/gitrepo/TRIGGERcmd-Agent/src/agent.js
-
@eromano when you got this error:
Error: Cannot find module 'socket.io-client'
Instead of running npm install you should have run npm install socket.io because you don't want all of the modules in package.json. You just want the ones you need to make agent.js work, like socket.io.
I should probably create a minimal package.json for cases like this, but I think you can get through it after a few tries.
-
@Russ said in TriggerCMD on openMPTCP a fork of openwrt project:
npm install socket.io
thank you very much.
Now I have installed the agent finally.
I have created a service file put into init.d folder with code:
#!/bin/sh /etc/rc.common START=95 start_service() { node /tmp/gitrepo/TRIGGERcmd-Agent/src/daemon.js --run /root/.TRIGGERcmdData }
Do you tink is it right or Mmay I cahnge the command?
Then Into the web paanel I can see my router but the trigger standard already present aren't loaded
How you can see if I click on "View Triggers" nothing is loaded
if I execute the command:
nano /root/.TRIGGERcmdData/commands.jsonI can see that default triggers are present:
How can I fix it?
PS. before to create the service I tried to execute the command:
node ./src/agent.js --console
and the result was
Why it fail to add the trigger?
Do you think that can be this the problem?thanks for help Russ
Egidio -
@eromano resolved by a new install from zero.
Maybe the problem was that at the first execute was already present another machine