google / grr

GRR Rapid Response: remote live forensics for incident response

Home Page:https://grr-doc.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node: Permission denied

f1r3walled opened this issue · comments

Hello, everyone!
I'm trying to install the latest version of GRR in an Ubuntu 18.04 server, but I have the error above after run travis/install.sh. Point is that I already tried some things, such as purge and reinstall node with apt-get and pip. I'm running whole process using a root user, because using a user with sudo I'm getting stucked at the same point.
I did choose to install from the source because the other methods presented failure as well.
Ideas?! Thank you!

Installing collected packages: grr-response-server
Running setup.py develop for grr-response-server
ERROR: Command errored out with exit status 1:
command: /root/INSTALL/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/user/grr/grr/server/setup.py'"'"'; file='"'"'/home/user/grr/grr/server/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps
cwd: /home/user/grr/grr/server/
Complete output (78 lines):
running develop
npm WARN prepare removing existing node_modules/ before installation

> core-js@3.2.1 postinstall /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> grpc@1.23.3 install /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for grpc@1.23.3 and node@8.10.0 (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/.node-gyp'
gyp ERR! System Linux 4.15.0-88-generic
gyp ERR! command "/usr/bin/node" "/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc" "--napi_version=1" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.15.0-88-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc
node-pre-gyp ERR! node -v v8.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /home/user/grr/grr/server/grr_response_server/gui/static/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.23.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.23.3 install 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/2020-02-19T13_05_06_745Z-debug.log
/root/INSTALL/lib/python3.6/site-packages/setuptools/dist.py:476: UserWarning: Normalizing '3.4.0post4' to '3.4.0.post4'
  normalized_version,
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/grr/grr/server/setup.py", line 225, in <module>
    setup(**setup_args)
  File "/root/INSTALL/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/user/grr/grr/server/setup.py", line 103, in run
    make_ui_files()
  File "/home/user/grr/grr/server/setup.py", line 53, in make_ui_files
    "npm ci", shell=True, cwd="grr_response_server/gui/static")
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'npm ci' returned non-zero exit status 1.
----------------------------------------

ERROR: Command errored out with exit status 1: /root/INSTALL/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/user/grr/grr/server/setup.py'"'"'; file='"'"'/home/user/grr/grr/server/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

Why did the recommended installation instructions fail?

The script travis/install.sh is mostly aimed for out continuous integration. In the environment where it is run, the running user has enough permissions to access all required folders. The problem is specific to your setup, that's hard to debug from the distance:

node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/src/node'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/user/grr/grr/server/grr_response_server/gui/static/node_modules/grpc/.node-gyp"

For future issues, please copy-and-paste logs as code block in triple backticks, that makes reading a lot easier.

It worked!

I choose to install from the source because dpkg -i was presenting a lot of error that was impossible to fix, even with apt install -f, but now I got the point.
I was using a new installation of Ubuntu 18 and a lot of dependencies was missing, so, once I manually installed a lot of dependencies it worked.
I just used the dependencies below:
sudo apt install -y fakeroot debhelper libffi-dev libssl-dev python3-dev \ python3-pip python3-venv wget openjdk-8-jdk zip git devscripts dh-systemd \ dh-virtualenv libc6-i386 lib32z1 asciidoc libmysqlclient-dev