Problem description
This gives me bad system call:
npm install https://github.com/ourarash/get-cursor-position.git
I did apt update && apt upgrade but still get the error.
Steps to reproduce
npm install https://github.com/ourarash/get-cursor-position.git
Expected behavior
Install the package
Additional information
Post output of command termux-info.
$ termux-info Updatable packages:
All packages up to date
Subscribed repositories:
https://dl.bintray.com/grimler/science-packages-21 science/stable
https://dl.bintray.com/grimler/game-packages-21 games/stable
https://termux.net stable/main
https://termux.net stable/main
System information:
Linux localhost 4.9.112-15119493 #2 SMP PREEMPT Thu May 30 19:02:31 KST 2019 aarch64 Android
Termux-packages arch:
aarch64
Android version:
9
Device manufacturer:
samsung
Device model:
SM-N960
Depending on problem, additional information may be requested:
logcat -d "*:W".strace -fv -s 2048 -o strace.log {program name}.Are you using a custom rom? Are you rooted?
You could try upgrading to the android-7 repo by running termux-upgrade-repo and then trying again
No, I'm using non rooted Samsung Galaxy note 8.
I tried termux-upgrade-repo, but still the same problem.
I was having this problem when I was using a particular custom rom for the galaxy s8+. The bad system call was kill(), which was weird cause it shouldn't be blocked according to the syscall blacklist, but I'm not a seccomp expert so maybe I'm missing something.
The problem disappeared after I flashed another rom so I figured it was a problem with that particular rom.
Could you install gdb and this debug build of nodejs: https://grimler.se/nodejs-dbg_12.4.0-1_aarch64.deb
And post the output of
gdb -ex=run -ex=bt --args npm install https://github.com/ourarash/get-cursor-position.git
to confirm it's the same issue as I've encountered before?
I get this for installing the debug node package:
Building dependency tree
Reading state information... Done
E: Unable to locate package https://grimler.se
E: Couldn't find any package by glob 'https://grimler.se'
E: Couldn't find any package by regex 'https://grimler.se'
$
Does this command work for you?
npm install https://github.com/ourarash/get-cursor-position.git
I get this for installing the debug node package:
Debug package should be installed via:
wget https://grimler.se/nodejs-dbg_12.4.0-1_aarch64.deb
dpkg -i nodejs-dbg_12.4.0-1_aarch64.deb
Does this command work
Fails with:
$ npm install https://github.com/ourarash/get-cursor-position.git
> [email protected] install /data/data/com.termux/files/home/node_modules/get-cursor-position
> node-gyp rebuild
make: Entering directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
CXX(target) Release/obj.target/pos/src/pos.o
../src/pos.cc:256:22: warning: 'NewFromUtf8' is deprecated: Use maybe version
[-Wdeprecated-declarations]
pos->Set(String::NewFromUtf8(isolate, "row"), Number::New(isolate, row));
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:2890:10: note:
'NewFromUtf8' has been explicitly marked deprecated here
static V8_DEPRECATED(
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:307:29: note:
expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/pos.cc:256:10: warning: 'Set' is deprecated: Use maybe version
[-Wdeprecated-declarations]
pos->Set(String::NewFromUtf8(isolate, "row"), Number::New(isolate, row));
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:3358:3: note:
'Set' has been explicitly marked deprecated here
V8_DEPRECATE_SOON("Use maybe version",
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:322:29: note:
expanded from macro 'V8_DEPRECATE_SOON'
declarator __attribute__((deprecated(message)))
^
../src/pos.cc:257:22: warning: 'NewFromUtf8' is deprecated: Use maybe version
[-Wdeprecated-declarations]
pos->Set(String::NewFromUtf8(isolate, "col"), Number::New(isolate, col));
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:2890:10: note:
'NewFromUtf8' has been explicitly marked deprecated here
static V8_DEPRECATED(
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:307:29: note:
expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/pos.cc:257:10: warning: 'Set' is deprecated: Use maybe version
[-Wdeprecated-declarations]
pos->Set(String::NewFromUtf8(isolate, "col"), Number::New(isolate, col));
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:3358:3: note:
'Set' has been explicitly marked deprecated here
V8_DEPRECATE_SOON("Use maybe version",
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:322:29: note:
expanded from macro 'V8_DEPRECATE_SOON'
declarator __attribute__((deprecated(message)))
^
../src/pos.cc:263:24: warning: 'NewFromUtf8' is deprecated: Use maybe version
[-Wdeprecated-declarations]
exports->Set(String::NewFromUtf8(isolate, "sync"),
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:2890:10: note:
'NewFromUtf8' has been explicitly marked deprecated here
static V8_DEPRECATED(
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:307:29: note:
expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/pos.cc:264:59: error: too few arguments to function call, single argument
'context' was not specified
FunctionTemplate::New(isolate, Method)->GetFunction());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8.h:5947:3: note:
'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
/data/data/com.termux/files/home/.node-gyp/12.4.0/include/node/v8config.h:347:31: note:
expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
5 warnings and 1 error generated.
make: *** [pos.target.mk:101: Release/obj.target/pos/src/pos.o] Error 1
make: Leaving directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 3.18.140-by_xeffyr-g5065c12c
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/data/com.termux/files/home/node_modules/get-cursor-position
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/data/data/com.termux/files/home/package.json'
npm WARN home No description
npm WARN home No repository field.
npm WARN home No README data
npm WARN home No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! /data/data/com.termux/files/home/.npm/_logs/2019-07-19T17_50_19_986Z-debug.log
$
Not sure why this package is not compatible with Termux. Even this doesn't work for me:
npm install get-cursor-position
Does it require specific nodejs version ?
Does it require specific nodejs version ?
I can install it on my mac lapotp using:
node -v
v8.11.4
I think there is an issue in the C++ compile during the package install that is not related to node.
that is not related to node.
Related to node headers.
@Grimler91 It getting killed due to __NR_setgid32.
nodejs-lts works better (only linking error):
$ npm install https://github.com/ourarash/get-cursor-position.git
> [email protected] install /data/data/com.termux/files/home/node_modules/get-cursor-position
> node-gyp rebuild
make: Entering directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
CXX(target) Release/obj.target/pos/src/pos.o
SOLINK_MODULE(target) Release/obj.target/pos.node
clang-8: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: Release/obj.target/pos/src/pos.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_Z6MethodRKN2v820FunctionCallbackInfoINS_5ValueEEE' which may bind externally can not be used when making a shared object; recompile with -fPIC
Release/obj.target/pos/src/pos.o: in function `Init(v8::Local<v8::Object>)':
pos.cc:(.text+0x608): dangerous relocation: unsupported relocation
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pos.target.mk:126: Release/obj.target/pos.node] Error 1
make: Leaving directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.18.140-by_xeffyr-g5065c12c
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/data/com.termux/files/home/node_modules/get-cursor-position
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/data/data/com.termux/files/home/package.json'
npm WARN home No description
npm WARN home No repository field.
npm WARN home No README data
npm WARN home No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! /data/data/com.termux/files/home/.npm/_logs/2019-07-19T18_26_32_549Z-debug.log
Happens because objects are not compiled with -fPIC.
Got it successfully installed:
$ export CXXFLAGS="-fPIC"
$ export CFLAGS="-fPIC"
$ npm install https://github.com/ourarash/get-cursor-position.git
> [email protected] install /data/data/com.termux/files/home/node_modules/get-cursor-position
> node-gyp rebuild
make: Entering directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
CXX(target) Release/obj.target/pos/src/pos.o
SOLINK_MODULE(target) Release/obj.target/pos.node
clang-8: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
COPY Release/pos.node
make: Leaving directory '/data/data/com.termux/files/home/node_modules/get-cursor-position/build'
npm WARN saveError ENOENT: no such file or directory, open '/data/data/com.termux/files/home/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/data/data/com.termux/files/home/package.json'
npm WARN home No description
npm WARN home No repository field.
npm WARN home No README data
npm WARN home No license field.
+ [email protected]
added 1 package from 1 contributor in 17.503s
Requires packages python2 and nodejs-lts and setting environment variable CXXFLAGS to -fPIC.
@xeffyr
It getting killed due to __NR_setgid32.
You got that on arm? Seems like __NR_setgid32 should be only blocked on arm and x86 according to https://github.com/aosp-mirror/platform_bionic/blob/pie-dev/libc/SECCOMP_BLACKLIST_APP.TXT
On x86 of course.
My aarch64 device running Android 9 but has SELinux set to permissive permanently, so I don't have any "bad system call" errors.
Looked strace output on my aarch64 device, it seems setgid() is really used.
17829 close(22) = 0
17829 close(24) = 0
17829 close(26) = 0
17829 chdir("/data/data/com.termux/files/home/.npm/_cacache/tmp/git-clone-12251ed6") = 0
17829 setgroups(0, NULL) = -1 EPERM (Operation not permitted)
17829 setgid(10088) = 0
17829 setuid(10088) = 0
17829 rt_sigaction(SIGHUP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTART}, {sa_handler=0x7b5cb3c744, sa_mask=~[KILL STOP RTMIN RT_1 RT_2 RT_3], sa_flags=SA_RESTART}, 8) = 0
Got it successfully installed:
```
$ export CXXFLAGS="-fPIC"
$ export CFLAGS="-fPIC"
$ npm install https://github.com/ourarash/get-cursor-position.git
Requires packages
python2andnodejs-ltsand setting environment variableCXXFLAGSto-fPIC.
It still gives me bad Bad system call with this. I ran it on Galaxy Note 8, non-rooted.
It still gives me bad Bad system call with this
It won't fix bad system calls.
Just will allow to install get-cursor-position without errors on devices running lower Android versions or have SELinux in permissive mode (permissive mode also disables seccomp).
Is there any workaround for this? Any plans to be fixed? Thanks!
Is there any workaround for this?
Try to run it under proot.
Any plans to be fixed
Yes.
Most helpful comment
Try to run it under
proot.Yes.