filebot / filebot-node

Run and monitor filebot commands remotely
https://www.filebot.net/
GNU General Public License v3.0
61 stars 13 forks source link

Error: spawn EACCES #4

Closed smileyn64 closed 8 years ago

smileyn64 commented 8 years ago

I have an error on package opening: 01

My firewall is open using the filenode firewall profile.

Log file is:

ENVIRONMENT { CONTENT_TYPE: 'application/x-www-form-urlencoded; charset=UTF-8',
  GATEWAY_INTERFACE: 'CGI/1.1',
  USER: 'admin',
  FILEBOT_CMD_UID: '1024',
  HTTP_X_REQUESTED_WITH: 'XMLHttpRequest',
  FILEBOT_NODE_HTTPS_CRT: '/usr/syno/etc/ssl/ssl.crt/server.crt',
  FILEBOT_NODE_HTTPS_KEY: '/usr/syno/etc/ssl/ssl.key/server.key',
  REMOTE_ADDR: '192.168.1.6',
  OLDPWD: '/usr/syno/synoman/webman/modules/PkgManApp',
  QUERY_STRING: '',
  HTTP_USER_AGENT: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4',
  DOCUMENT_ROOT: '/usr/syno/synoman',
  REMOTE_PORT: '59985',
  SYNOPKG_DSM_VERSION_MAJOR: '5',
  FILEBOT_NODE_AUTH: 'SYNO',
  SYNOPKG_PKG_PROGRESS_PATH: '/tmp/install_progress_filebot-node',
  HTTP_ACCEPT: '*/*',
  SERVER_SIGNATURE: '',
  CONTENT_LENGTH: '306',
  SYNOPKG_TEMP_LOGFILE: '/volume1/@tmp/56BF544385422E6C',
  SCRIPT_FILENAME: '/usr/syno/synoman/webman/modules/PkgManApp/PkgSynoMan.cgi',
  SYNOPKG_PKGDEST: '/volume1/@appstore/filebot-node',
  SYNOPKG_USERNAME: 'admin',
  HTTP_HOST: '192.168.1.104:5000',
  SYNOPKG_DSM_ARCH: '88f6282',
  FILEBOT_NODE_HTTP_PORT: '5452',
  SYNOPKG_PKG_STATUS: 'INSTALL',
  REQUEST_URI: '/webman/modules/PkgManApp/PkgSynoMan.cgi',
  SERVER_SOFTWARE: 'Apache',
  HTTP_CONNECTION: 'keep-alive',
  USERNAME: 'admin',
  FILEBOT_NODE_HTTPS_PORT: '5453',
  MOD_X_SENDFILE_ENABLED: 'yes',
  HTTP_COOKIE: 'PHPSESSID=b92hh374efkmrnnnes3qbu9sq4; id=aMfw2hQMO1dGoACH9N00040; plushContainerWidth=100%25; plushMultiOps=1; plushNoTopMenu=0; sds_login_time_format=24h; stay_login=0',
  SYNOPKG_DSM_VERSION_MINOR: '2',
  FILEBOT_NODE_HOST: '0.0.0.0',
  PATH: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin',
  HTTP_ACCEPT_LANGUAGE: 'fr-fr',
  FILEBOT_NODE_HTTP: 'YES',
  HTTP_REFERER: 'http://192.168.1.104:5000/webman/index.cgi',
  SYNOPKG_PKGVER: '0.1.7',
  HTTP_X_SYNO_TOKEN: 'aMG5sLaKYKHaA',
  SERVER_PROTOCOL: 'HTTP/1.1',
  HTTP_ACCEPT_ENCODING: 'gzip, deflate',
  SCRIPT_URI: 'http://192.168.1.104:5000/webman/modules/PkgManApp/PkgSynoMan.cgi',
  FILEBOT_CMD_GID: '101',
  FILEBOT_NODE_HTTPS: 'YES',
  SCRIPT_URL: '/webman/modules/PkgManApp/PkgSynoMan.cgi',
  REQUEST_METHOD: 'POST',
  SERVER_ADDR: '192.168.1.104',
  SERVER_ADMIN: 'admin',
  FILEBOT_NODE_CLIENT: '',
  FILEBOT_CMD: 'filebot',
  PWD: '/volume1/@appstore/filebot-node',
  HTTP_ORIGIN: 'http://192.168.1.104:5000',
  SYNOPKG_DSM_LANGUAGE: 'fre',
  SERVER_PORT: '5000',
  SCRIPT_NAME: '/webman/modules/PkgManApp/PkgSynoMan.cgi',
  SYNOPKG_PKGDEST_VOL: '/volume1',
  SYNOPKG_PKGNAME: 'filebot-node',
  FILEBOT_CMD_CWD: '/volume1',
  SERVER_NAME: '192.168.1.104',
  SYNOPKG_DSM_VERSION_BUILD: '5644' }
USER { UID: 1024, GID: 101 }
filebot-node listening at http://0.0.0.0:5452
filebot-node listening at https://0.0.0.0:5453
AUTH_CACHE: {"id=aMfw2hQMO1dGoACH9N00040":"admin"}

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn EACCES
    at errnoException (child_process.js:1011:11)
    at Process.ChildProcess._handle.onexit (child_process.js:802:34)
smileyn64 commented 8 years ago

By the way, manual installation & start up works fine. Filebot-Node is accessible via port 5452 and works great even with a little error in the startup:

sh ./start.sh
Error: unrecognized flag --optimize_for_size
Try --help for options
ENVIRONMENT { USER: 'root',
  MAIL: '/var/mail/root',
  SSH_CLIENT: '192.168.1.8 64165 22',
  FILEBOT_CMD_UID: '0',
  FILEBOT_NODE_HTTPS_CRT: '/path/to/server.crt',
  FILEBOT_NODE_HTTPS_KEY: '/path/to/server.key',
  HOME: '/root',
  TERMINFO: '/usr/share/terminfo',
  OLDPWD: '/',
  SSH_TTY: '/dev/pts/2',
  FILEBOT_NODE_AUTH: 'BASIC',
  PAGER: 'more',
  FILEBOT_NODE_HTTP_PORT: '5452',
  LOGNAME: 'root',
  TERM: 'xterm-256color',
  FILEBOT_NODE_HTTPS_PORT: '5453',
  FILEBOT_NODE_HOST: '0.0.0.0',
  PATH: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/volume1/@appstore/java8/ejdk1.8.0_73/linux_arm_sflt/jre/bin',
  FILEBOT_NODE_HTTP: 'YES',
  LANG: 'en_US.utf8',
  FILEBOT_NODE_AUTH_PASS: 'admin',
  SHELL: '/bin/ash',
  FILEBOT_CMD_GID: '0',
  FILEBOT_NODE_HTTPS: 'NO',
  CLASSPATH: '.:/volume1/@appstore/java8/ejdk1.8.0_73/linux_arm_sflt/jre/lib',
  FILEBOT_NODE_CLIENT: 'client',
  FILEBOT_CMD: 'filebot',
  FILEBOT_NODE_AUTH_USER: 'admin',
  PWD: '/root',
  LC_ALL: 'en_US.utf8',
  JAVA_HOME: '/volume1/@appstore/java8/ejdk1.8.0_73/linux_arm_sflt/jre',
  SSH_CONNECTION: '192.168.1.8 64165 192.168.1.104 22',
  TZ: 'Asia/Jakarta',
  PGDATA: '/var/services/pgsql',
  FILEBOT_CMD_CWD: '/root' }
USER { UID: 0, GID: 0 }
filebot-node listening at http://0.0.0.0:5452/filebot/

seems to be a Node-js version error.

rednoah commented 8 years ago

If the node service is running, but the webapp can't connect, then it can only be some sort of network/firewall/ports issue.

Try this: https://www.filebot.net/forums/viewtopic.php?f=13&t=3368

EDIT:

Sorry, missed the error message in the previous log... Error: spawn EACCES is caused by node somehow not being able to call external processes (like the synology login script, or filebot) but I'm not sure how to fix this. Maybe possibly AppArmor related? I have no idea.

rednoah commented 8 years ago

FileBot Node should be running as root because that's how DSM works. But when FileBot Node makes filebot calls then it'll try to make those calls as admin. I suspect that somehow USER { UID: 1024, GID: 101 } can't execute programs due to some AppArmor profile.

Try uninstalling everything, and then reinstalling. Maybe by running things as root first, the permissions got initialized with root and then the admin user somehow gets screwed. Somehow the admin user can't run external programs.

smileyn64 commented 8 years ago

On my manual tries, I have done everything by command line with root login, worked as a charm. But when I'm connecting to DSM, I'm connecting with admin profile. So can be linked to profile yes ...

I don't know if I can log as root in the DSM, will check that and revert.

rednoah commented 8 years ago

DSM apps are always called as root. But FileBot Node running as root will try to run filebot as admin for better-save-than-sorry reasons.

When logging in via ssh, try doing it as admin and see if the filebot works at all for the admin user. There's a good chance that filebot.sh just isn't working for some reason, like java: command not found or filebot not being in the path, that kind of issue.

All of that configuration should be in server/start.sh so you can check and modify how FileBot Node will try to make filebot calls.

smileyn64 commented 8 years ago

So, I tried running filebot via ssh logged as admin and it does not work (only working if I call sh /var/packages/filebot/filebot.sh)

I tried changing the user admin by root in the start.sh, it seems now able to launch instructions to filebot but it's failing for other reasons.

rednoah commented 8 years ago

So what happens if you just call filebot then? Is it in the $PATH? What's not working? filebot.sh starts with the #!/bin/sh shebang so it should be the same as calling it with sh yourself.