Error #0: exception 'OMV\ExecException' with message 'Failed to execute command

    • OMV 3.x
    • Update

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Error #0: exception 'OMV\ExecException' with message 'Failed to execute command

      Hi!

      Updated (minor upgrade) to Erasmus 3.0.62 and the Linux kernel 4.9.0-0.bpo.1-amd63.

      After reboot, I get the following error:
      Error #0:
      exception 'OMV\ExecException' with message 'Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; monit summary 2>&1' with exit code '1': Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect' in /usr/share/php/openmediavault/system/process.inc:175
      Stack trace:
      #0 /usr/share/php/openmediavault/system/monit.inc(142): OMV\System\Process->execute(Array)
      #1 /usr/share/php/openmediavault/system/monit.inc(161): OMV\System\Monit->status()
      #2 /usr/share/openmediavault/engined/module/nut.inc(105): OMV\System\Monit->isRunning()
      #3 /usr/share/openmediavault/engined/rpc/services.inc(56): OMVModuleNetworkUPSTools->getStatus()
      #4 [internal function]: OMVRpcServiceServices->getStatus(Array, Array)
      #5 /usr/share/php/openmediavault/rpc/serviceabstract.inc(124): call_user_func_array(Array, Array)
      #6 /usr/share/php/openmediavault/rpc/rpc.inc(84): OMV\Rpc\ServiceAbstract->callMethod('getStatus', Array, Array)
      #7 /usr/sbin/omv-engined(516): OMV\Rpc\Rpc::call('Services', 'getStatus', Array, Array, 1)
      #8 {main}

      Any idea on what to do?
      Seems I need to edit "/usr/share/php/openmediavault/system/process.inc" on row 175, but with what?

      This is what the file looks like now:
      Display Spoiler
      root@openmediavault:/usr/share/php/openmediavault/system# cat process.inc
      <?php
      /**
      * This file is part of OpenMediaVault.
      *
      * @license gnu.org/licenses/gpl.html GPL Version 3
      * @author Volker Theile <volker.theile@openmediavault.org>
      * @copyright Copyright (c) 2009-2017 Volker Theile
      *
      * OpenMediaVault is free software: you can redistribute it and/or modify
      * it under the terms of the GNU General Public License as published by
      * the Free Software Foundation, either version 3 of the License, or
      * any later version.
      *
      * OpenMediaVault is distributed in the hope that it will be useful,
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      * GNU General Public License for more details.
      *
      * You should have received a copy of the GNU General Public License
      * along with OpenMediaVault. If not, see <gnu.org/licenses/>.
      */
      namespace OMV\System;

      /**
      * @ingroup api
      */
      class Process {
      use \OMV\Debugable;

      private $cmdArgs = [];
      private $redirect1toFile = FALSE;
      private $redirect2toFile = FALSE;
      private $inputFromFile = FALSE;
      private $quiet = FALSE;
      private $background = FALSE;
      private $env = array(
      "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin",
      "LANG=C"
      );

      /**
      * Constructor
      * Example:
      * $cmd = new \OMV\System\Process("ls -alh");
      * $cmd = new \OMV\System\Process("ls", "-al", "-h");
      * $cmd = new \OMV\System\Process(array("ls", "-alh"));
      * $cmd = new \OMV\System\Process("ls", array("-a", "-l", "-h"));
      */
      public function __construct() {
      $args = func_get_args();
      if (1 == func_num_args() && is_string($args[0])) {
      $this->cmdArgs[] = $args[0];
      } else if (1 == func_num_args() && is_array($args[0])) {
      $this->cmdArgs = $args[0];
      } else if (2 == func_num_args() && is_string($args[0])) {
      $this->cmdArgs[] = $args[0];
      if (is_array($args[1]))
      $this->cmdArgs = array_merge($this->cmdArgs, $args[1]);
      else
      $this->cmdArgs[] = $args[1];
      } else {
      $this->cmdArgs = $args;
      }
      }

      /**
      * Redirect STDOUT to the given file. Set to FALSE to do not redirect
      * STDOUT to a file.
      * @param file The file path, e.g. '/tmp/xyz'.
      * @return None.
      */
      public function setRedirect1toFile($file) {
      $this->redirect1toFile = $file;
      }

      /**
      * Redirect STDERR to STDOUT.
      * @return None.
      */
      public function setRedirect2to1() {
      $this->setRedirect2toFile("&1");
      }

      /**
      * Redirect STDERR to the given file. Set to FALSE to do not redirect
      * STDERR to a file.
      * @param file The file path, e.g. '/dev/null' or '&1'.
      * @return None.
      */
      public function setRedirect2toFile($file) {
      $this->redirect2toFile = $file;
      }

      /**
      * Accept input from a file. Set to FALSE to do not accept input from
      * a file.
      * @param file The file path.
      * @return None.
      */
      public function setInputFromFile($file) {
      $this->inputFromFile = $file;
      }

      /**
      * Do not throw an error exception if the command execution fails.
      * @param quiet Set to TRUE to do not throw an exception.
      * Defaults to TRUE.
      * @return None.
      */
      public function setQuiet($quiet = TRUE) {
      $this->quiet = $quiet;
      }

      /**
      * Execute the command in background. The method \em execute immediatelly
      * returns in this case.
      * @param background Set to TRUE to do execute the command in background.
      * Defaults to TRUE.
      * @return None.
      */
      public function setBackground($background = TRUE) {
      $this->background = $background;
      }

      /**
      * Set an environment variable.
      * @param name The name of the environment variable.
      * @param value The value of the environment variable.
      * @return None.
      */
      public function setEnv($name, $value) {
      if (1 == func_num_args())
      $this->env[] = $name; // Keep backward compatibility.
      else
      $this->env[] = sprintf("%s=%s", $name, $value);
      }

      /**
      * Get the command line to be executed.
      * @return The command line.
      */
      public function getCommandLine() {
      $cmdArgs = [];
      foreach ($this->env as $env)
      $cmdArgs[] = sprintf("export %s;", $env);
      $cmdArgs = array_merge($cmdArgs, $this->cmdArgs);
      if (FALSE === empty($this->redirect1toFile))
      $cmdArgs[] = sprintf("1>%s", $this->redirect1toFile);
      if (FALSE === empty($this->redirect2toFile))
      $cmdArgs[] = sprintf("2>%s", $this->redirect2toFile);
      if (FALSE === empty($this->inputFromFile))
      $cmdArgs[] = sprintf("<%s", $this->inputFromFile);
      if (TRUE === $this->background)
      $cmdArgs[] = "&";
      return implode(" ", $cmdArgs);
      }

      /**
      * Execute the command.
      * @param output If the output argument is present, then the specified
      * array will be filled with every line of output from the command.
      * @param exitStatus If the argument is present along with the output
      * argument, then the return status of the executed command will be
      * written to this variable.
      * @return The last line from the result of the command.
      * @throw \OMV\ExecException
      */
      public function execute(array &$output = NULL, &$exitStatus = NULL) {
      // Build the command line.
      $cmdLine = $this->getCommandLine();
      // Execute the command.
      $this->debug("Executing command '%s'", $cmdLine);
      $result = exec($cmdLine, $output, $exitStatus);
      if ((FALSE === $this->quiet) && (0 !== $exitStatus))
      throw new \OMV\ExecException($cmdLine, $output, $exitStatus);
      return $result;
      }
      }
      root@openmediavault:/usr/share/php/openmediavault/system#
    • The problem is that monit has a delay of 60s to allow communication. You can not do anything here. The problem is solved after this delay.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • It should only appear directly after a reboot until the monit daemon is initialized and the first 60sec delay has not been finished. If it repeats everytime i really do not have an idea at the moment.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • saw this today when I took updates:
      Restarting engine daemon ...
      Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect

      Looks like something is mis-configured somewhere!

      Any ideas?
    • Please investigate if possible, i can not reproduce the issue.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • Still getting this error, and have not figured it out yet. Google seems to be of no help also!

      Get this message every time i log in to the GUI:

      Source Code

      1. Error #0:
      2. exception 'OMV\ExecException' with message 'Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; monit summary 2>&1' with exit code '1': Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect' in /usr/share/php/openmediavault/system/process.inc:175
      3. Stack trace:
      4. #0 /usr/share/php/openmediavault/system/monit.inc(142): OMV\System\Process->execute(Array)
      5. #1 /usr/share/php/openmediavault/system/monit.inc(171): OMV\System\Monit->status()
      6. #2 /usr/share/openmediavault/engined/module/nut.inc(105): OMV\System\Monit->isRunning()
      7. #3 /usr/share/openmediavault/engined/rpc/services.inc(56): OMVModuleNetworkUPSTools->getStatus()
      8. #4 [internal function]: OMVRpcServiceServices->getStatus(Array, Array)
      9. #5 /usr/share/php/openmediavault/rpc/serviceabstract.inc(124): call_user_func_array(Array, Array)
      10. #6 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('getStatus', Array, Array)
      11. #7 /usr/sbin/omv-engined(536): OMV\Rpc\Rpc::call('Services', 'getStatus', Array, Array, 1)
      12. #8 {main}
      Display All
    • I'm also running into this, and I'm about to have to wipe OMV and start over due to it...

      Source Code

      1. Error #0:
      2. exception 'OMV\ExecException' with message 'Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; monit summary 2>&1' with exit code '1': Monit: the monit HTTP interface is not enabled, please add the 'set httpd' statement and use the 'allow' option to allow monit to connect' in /usr/share/php/openmediavault/system/process.inc:175
      3. Stack trace:
      4. #0 /usr/share/php/openmediavault/system/monit.inc(142): OMV\System\Process->execute(Array)
      5. #1 /usr/share/php/openmediavault/system/monit.inc(171): OMV\System\Monit->status()
      6. #2 /usr/share/openmediavault/engined/module/nut.inc(105): OMV\System\Monit->isRunning()
      7. #3 /usr/share/openmediavault/engined/rpc/services.inc(56): OMVModuleNetworkUPSTools->getStatus()
      8. #4 [internal function]: OMVRpcServiceServices->getStatus(Array, Array)
      9. #5 /usr/share/php/openmediavault/rpc/serviceabstract.inc(124): call_user_func_array(Array, Array)
      10. #6 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('getStatus', Array, Array)
      11. #7 /usr/sbin/omv-engined(536): OMV\Rpc\Rpc::call('Services', 'getStatus', Array, Array, 1)
      12. #8 {main}
      Display All
      U-NAS NSC-800, Supermicro X10SDV-F-O, Xeon D 1540 (45W), 64GB EEC DDR4, LSI 9211-8i, Samsung XP941 M.2 SSD, ESXi 6.5
    • Please ensure that the monit daemon is running.

      Shell-Script

      1. # systemctrl status monit


      If not, try to rebuild and restart it.

      Shell-Script

      1. # omv-mkconf monit
      2. # systemctrl restart monit
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit