Raspberry Pi install failed



  • I get this errors while trying to install triggercmdagent in my raspberry pi zero (no wifi version, running with eth cable), I have installed everything you said in last posts, npm, nodejs... Everything. Tried rebooting, reinstalling npm, nodejs, triggedcmdagent... and everything gets to the same point.
    Thanks.

    pi@raspberrypi:~ $ sudo apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Setting up triggercmdagent (1.0.1) ...
    Directory 'node_modules' exists. Running 'npm rebuild'
    dpkg: error processing package triggercmdagent (--configure):
    installed triggercmdagent package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    triggercmdagent
    E: Sub-process /usr/bin/dpkg returned an error code (1)



  • @Antonio36996, can you send me the output of this command?

    dpkg -i triggercmdagent_1.0.1_all.deb
    

    Also, please try an uninstall and re-install like this:

    systemctl stop triggercmdagent
    /usr/share/triggercmdagent/app/src/removedaemon.sh
    apt remove triggercmdagent
    dpkg -i triggercmdagent_1.0.1_all.deb
    triggercmdagent
    (CTRL-C)
    /usr/share/triggercmdagent/app/src/installdaemon.sh
    

    I tried a fresh install using setup.bat with this method and it worked.

    I also tried installing using the original method after a fresh Raspbian install and that worked for me too.

    EDIT: Another idea - please try this and let me know what you see.

    cd /usr/share/triggercmdagent/app
    npm install
    


  • This is the output, thanks

    sudo dpkg -i triggercmdagent_1.0.1_all.deb
    (Reading database ... 51918 files and directories currently installed.)
    Preparing to unpack triggercmdagent_1.0.1_all.deb ...
    Unpacking triggercmdagent (1.0.1) over (1.0.1) ...
    Setting up triggercmdagent (1.0.1) ...
    Directory 'node_modules' exists. Running 'npm rebuild'
    dpkg: error processing package triggercmdagent (--install):
    installed triggercmdagent package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    triggercmdagent
    pi@raspberrypi:~ $ cd /usr/share/triggercmdagent/app
    pi@raspberrypi:/usr/share/triggercmdagent/app $ npm install
    pi@raspberrypi:/usr/share/triggercmdagent/app $ cd ~
    pi@raspberrypi:~ $ sudo dpkg -i triggercmdagent_1.0.1_all.deb
    (Reading database ... 51918 files and directories currently installed.)
    Preparing to unpack triggercmdagent_1.0.1_all.deb ...
    Unpacking triggercmdagent (1.0.1) over (1.0.1) ...
    Setting up triggercmdagent (1.0.1) ...
    Directory 'node_modules' exists. Running 'npm rebuild'
    dpkg: error processing package triggercmdagent (--install):
    installed triggercmdagent package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    triggercmdagent
    pi@raspberrypi:~ $ sudo systemctl stop triggercmdagent
    Failed to stop triggercmdagent.service: Unit triggercmdagent.service not loaded.
    pi@raspberrypi:~ $ sudo /usr/share/triggercmdagent/app/src/removedaemon.sh
    Failed to stop triggercmdagent.service: Unit triggercmdagent.service not loaded.
    pi@raspberrypi:~ $ sudo apt remove triggercmdagent
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be REMOVED:
    triggercmdagent
    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue? [Y/n] y
    (Reading database ... 51918 files and directories currently installed.)
    Removing triggercmdagent (1.0.1) ...
    pi@raspberrypi:~ $ sudo dpkg -i triggercmdagent_1.0.1_all.deb
    Selecting previously unselected package triggercmdagent.
    (Reading database ... 49379 files and directories currently installed.)
    Preparing to unpack triggercmdagent_1.0.1_all.deb ...
    Unpacking triggercmdagent (1.0.1) ...
    Setting up triggercmdagent (1.0.1) ...
    Directory 'node_modules' exists. Running 'npm rebuild'
    dpkg: error processing package triggercmdagent (--install):
    installed triggercmdagent package post-installation script subprocess returned error exit status 1
    Errors were encountered while processing:
    triggercmdagent
    pi@raspberrypi:~ $ triggercmdagent
    pi@raspberrypi:~ $ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
    cp: cannot create regular file '/root/.TRIGGERcmdData/triggercmdagent.service': No such file or directory
    /usr/share/triggercmdagent/app/src/daemonmgr.sh: 10: /usr/share/triggercmdagent/ app/src/daemonmgr.sh: cannot create /root/.TRIGGERcmdData/triggercmdagent.servic e: Directory nonexistent
    /usr/share/triggercmdagent/app/src/daemonmgr.sh: 11: /usr/share/triggercmdagent/ app/src/daemonmgr.sh: cannot create /root/.TRIGGERcmdData/triggercmdagent.servic e: Directory nonexistent
    cp: cannot stat '/root/.TRIGGERcmdData/triggercmdagent.service': No such file or directory
    Failed to start triggercmdagent.service: Unit triggercmdagent.service not found.
    Failed to enable unit: Unit file triggercmdagent.service does not exist.
    Unit triggercmdagent.service could not be found.
    pi@raspberrypi:~ $



  • @Antonio36996, something went wrong with the installation. This could be tricky to fix. I noticed this command didn't even give you any output. Not even an error:

    pi@raspberrypi:/usr/share/triggercmdagent/app $ npm install

    I also noticed you're doing all of this as the pi user. The instructions have you switch to the root user with sudo su -

    I recommend trying those steps again as root, and add this command after the apt remove command:

    rm -rf /usr/share/triggercmdagent
    

    If that doesn't work, I recommend starting over with a fresh Raspbian installation. The new method using setup.bat is the easiest, but it assumes you're using a Windows computer. It also installs the agent for you.



  • @Russ Thanks for answering, I can't reinstall raspbian again because I have other services like pihole, pivpn...
    At the beginning I could execute triggercmdagent and asked me to enter the token, however as the apt upgrade still being saying that wasn't successful I reinstalled it, and since that didn't work.
    This is my output using su

    pi@raspberrypi:~ $ sudo su -
    root@raspberrypi:~# apt remove triggercmdagent

    Reading package lists... Done

    Building dependency tree

    Reading state information... Done

    The following packages will be REMOVED:

    triggercmdagent

    0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.

    1 not fully installed or removed.

    After this operation, 0 B of additional disk space will be used.

    Do you want to continue? [Y/n] y

    (Reading database ... 51918 files and directories currently installed.)

    Removing triggercmdagent (1.0.1) ...

    root@raspberrypi:~# rm -rf /usr/share/triggercmdagent

    root@raspberrypi:~# dpkg -i triggercmdagent_1.0.1_all.deb

    Selecting previously unselected package triggercmdagent.

    (Reading database ... 49379 files and directories currently installed.)

    Preparing to unpack triggercmdagent_1.0.1_all.deb ...

    Unpacking triggercmdagent (1.0.1) ...

    Setting up triggercmdagent (1.0.1) ...

    Directory 'node_modules' exists. Running 'npm rebuild'

    dpkg: error processing package triggercmdagent (--install):

    installed triggercmdagent package post-installation script subprocess returned error exit status 1

    Errors were encountered while processing:

    triggercmdagent

    root@raspberrypi:~# triggercmdagent

    root@raspberrypi:~# /usr/share/triggercmdagent/app/src/installdaemon.sh

    cp: cannot create regular file '/root/.TRIGGERcmdData/triggercmdagent.service': No such file or directory

    /usr/share/triggercmdagent/app/src/daemonmgr.sh: 10: /usr/share/triggercmdagent/ app/src/daemonmgr.sh: cannot create /root/.TRIGGERcmdData/triggercmdagent.servic e: Directory nonexistent

    /usr/share/triggercmdagent/app/src/daemonmgr.sh: 11: /usr/share/triggercmdagent/ app/src/daemonmgr.sh: cannot create /root/.TRIGGERcmdData/triggercmdagent.servic e: Directory nonexistent

    cp: cannot stat '/root/.TRIGGERcmdData/triggercmdagent.service': No such file or directory

    Failed to start triggercmdagent.service: Unit triggercmdagent.service not found.

    Failed to enable unit: Unit file triggercmdagent.service does not exist.

    Unit triggercmdagent.service could not be found.

    root@raspberrypi:~# apt-get -y install npm nodejs

    Reading package lists... Done

    Building dependency tree

    Reading state information... Done

    nodejs is already the newest version (10.19.0~dfsg1-1).

    npm is already the newest version (5.8.0+ds6-4).

    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

    1 not fully installed or removed.

    After this operation, 0 B of additional disk space will be used.

    Setting up triggercmdagent (1.0.1) ...

    Directory 'node_modules' exists. Running 'npm rebuild'

    dpkg: error processing package triggercmdagent (--configure):

    installed triggercmdagent package post-installation script subprocess returned error exit status 1

    Errors were encountered while processing:

    triggercmdagent

    E: Sub-process /usr/bin/dpkg returned an error code (1)

    root@raspberrypi:~#



  • @Antonio36996, I'm sorry about this trouble. Unfortunately the output isn't giving my much info to go on. Here's another idea you could try:

    sudo su -
    apt remove triggercmdagent
    rm -rf /usr/share/triggercmdagent/app
    mkdir /usr/share/triggercmdagent/app
    cd /usr/share/triggercmdagent/app
    git clone https://github.com/rvmey/TRIGGERcmd-Agent.git
    /usr/share/triggercmdagent/app/src/installdaemon.sh
    


  • @Russ Does not work, thank you anyways!



  • Finnaly I solved it!!! As I was getting errors since I started, I decided to install node, which broke my nodejs installation, I found the answer here.
    I removed the package node and everything went perfect! Thank you so much!



  • @Antonio36996, nice job! I'm glad you got it working.



  • @Russ I have a problem and I don't know what I'm doing wrong - I always have your default configuration file. I even tried to remove and install.

    root@raspberrypi:/home/pi# triggercmdagent
    Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
    Daemon install: false
    Logging in with saved token.
    Checking if the 5fb03d4f355bc6001903ba40 computer exists.
    This computer was deleted from your account.  Login to recreate it.
    prompt: token:  mytoken
    Token saved for next time.
    Tokenfile: /root/.TRIGGERcmdData/token.tkn
    ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
    Logging in with saved token to run foreground tasks.
    Computer ID 5fb0406efe27220019319bad saved for next time.
    Write backup completed.
    
    
      |>    Now connected to https://www.triggercmd.com.
    \___/   For help, see: http://bit.ly/2q0QDpf
            (using sails.io.js node SDK @v1.1.13)
             Connected at: Sat Nov 14 2020 20:39:12 GMT+0000 (Greenwich Mean Time)
    
    
    
    Initiated command removals
    Initiated command adds
    { message: 'Subscribed to 5fb0406efe27220019319bad!' }
    { message: 'Subscribed to 5fb0406efe27220019319bad!' }
    Added Gnome Editor
    ^C
    root@raspberrypi:/home/pi# nano /root/.TRIGGERcmdData/commands.json
    root@raspberrypi:/home/pi# nano /root/.TRIGGERcmdData/commands.json
    root@raspberrypi:/home/pi# /usr/share/triggercmdagent/app/src/installdaemon.sh
    Daemon install: true
    Logging in with saved token.
    Checking if the 5fb0406efe27220019319bad computer exists.
    This computer exists in your account.
    ● triggercmdagent.service - TRIGGERcmd Agent
       Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled)
       Active: active (running) since Sat 2020-11-14 20:42:06 GMT; 1s ago
     Main PID: 11693 (node)
        Tasks: 6 (limit: 2063)
       CGroup: /system.slice/triggercmdagent.service
               └─11693 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdData
    
    Nov 14 20:42:06 raspberrypi systemd[1]: Started TRIGGERcmd Agent.```
    
    Maybe you have any idea? Thanks!


  • @Radosław-Szałkowski, from that output it looks like the background service installation worked.

    Can you show me the output of this command?

    systemctl status triggercmdagent

Log in to reply