nowsecure / r2frida

Radare2 and Frida better together.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

install fail

yazigegeda opened this issue · comments

When I executed $r2pm - ci r2frida, it downloaded frida and the installation failed

Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null) Bail out! Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null) make[1]: *** [Makefile:236: src/_agent.js] Aborted make[1]: Leaving directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida' make: *** [Makefile:160: all] Error 2 Build failed mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/plugins" mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/prefix/bin" rm -f "//data/data/com.termux/files/home/.local/share/radare2/plugins/io_frida.so" cp -f io_frida.so* /"/data/data/com.termux/files/home/.local/share/radare2/plugins" cp: cannot stat 'io_frida.so*': No such file or directory make: *** [Makefile:314: user-install] Error 1 Install fail

Can you provide full logs and device specs (cpu,version of r2, compiler,..)?

你能提供完整的日志和设备规格(cpu,r2版本,编译器,..)吗?

Screenshot_2023-06-08-09-09-28-33_84d3000e3f4017145260f7618db1d683

I am using termux on my phone

Can you provide full logs and device specs (cpu,version of r2, compiler,..)?

I provided the release page with Copy _agent.js to the src directory of r2frida and run r2pm - i r2frida to install it. I don't quite understand why

The build logs are truncated i dont see the error in there

构建日志被截断,我看不到错误

out.log

This is my error log.

Looks like frida fails to create a temporary file here. Do you have enough free space or writable tmpdir?

try clang

Looks like frida fails to create a temporary file here. Do you have enough free space or writable tmpdir?

I confirm that I have enough storage space on my phone, but I don't know why I can't install it. How can I compile and build an installation package like r2frida_5.8.6_termux_aarch64.deb? Can you build and release a 5.8.8 version?

try clang

I tried to build using clang 16, but I still got errors.

Not being able to write in tmpdir could be because the temporary directory is not writable or its different. This is a bug in frida and have nothing to do with gcc or clang. Can you run the frida-server?

try clang

I tried to build using clang 16, but I still got errors.

try with clean termux

Screenshot_20230727-192947_Termux

try clang

I tried to build using clang 16, but I still got errors.

try with clean termux

Screenshot_20230727-192947_Termux

I cleaned Termux and reinstalled it, but installing r2frida again still gives an error. Here is the full output log, I really don't know what the issue is:

error.log

Not being able to write in tmpdir could be because the temporary directory is not writable or its different. This is a bug in frida and have nothing to do with gcc or clang. Can you run the frida-server?

I have no issues using Frida directly.

Screenshot_2023-07-28-10-17-26-50_607bdd22fe69f77fcb7d6df7648bb058

Record_2023-07-28-10-17-47.mp4

@yazigegeda
pkg install git radare2 clang binutils-is-llvm make pkg-config
r2pm -U
r2pm -i r2frida

@yazigegeda pkg install git radare2 clang binutils-is-llvm make pkg-config r2pm -U r2pm -i r2frida

I uninstalled Termux, reinstalled it, and ran the commands you gave me again but it still doesn't work... Still getting the same error...

Okay, it seems I have now resolved the issue and successfully installed r2frida (although I don't know why):

  1. After the r2pm -ci r2frida command failed to install, I downloaded the _agent.js file from the releases page and put it in the src directory.

Screenshot_2023-07-28-17-30-24-63_df198e732186825c8df26e3c5a10d7cd
Screenshot_2023-07-28-17-28-00-44_9e8df3d0c7c1f50248b6ee043a653d26

  1. I edited the Makefile, commenting out line 163.
    Screenshot_2023-07-28-17-27-19-73_9e8df3d0c7c1f50248b6ee043a653d26

  2. I ran r2pm -i r2frida again and it succeeded in installing r2frida.
    success.log

weired thing, now I can't install normally =) (r2pm -i r2frida)

without compiling _agent_js


./configure --with-precompiled-agent
make

_agent_js can be compiled with

npm i

can you try to make a clean build of r2frida from r2pm again? latest frida fixed some of these bugs afaik

can you try to make a clean build of r2frida from r2pm again? latest frida fixed some of these bugs afaik

~ $ r2pm -ci  r2frida
INFO: Cleaning r2frida
INFO: Using r2-5.8.8 and r2pm-5.8.8
INFO: Cleaning r2frida
INFO: git clone --depth=10 --recursive https://github.com/nowsecure/r2frida /data/data/com.termux/files/home/.local/share/radare2/r2pm/git//r2frida
Cloning into '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git//r2frida'...
remote: Enumerating objects: 187, done.
remote: Counting objects: 100% (187/187), done.
remote: Compressing objects: 100% (141/141), done.
remote: Total 187 (delta 41), reused 125 (delta 39), pack-reused 0
Receiving objects: 100% (187/187), 204.03 KiB | 482.00 KiB/s, done.
Resolving deltas: 100% (41/41), done.
INFO: Starting install for r2frida
INFO: SCRIPT=<<EOF
INFO:   unset CFLAGS
        unset LDFLAGS
        ./configure || R2PM_FAIL "Install fail"
        if [ -n "${FRIDA_VERSION}" ]; then
                ${MAKE} frida_version=${FRIDA_VERSION} || R2PM_FAIL "Build failed"
        else
                ${MAKE} || R2PM_FAIL "Build failed"
        fi
        ${MAKE} user-install R2_PLUGDIR="${R2PM_PLUGDIR}" || R2PM_FAIL "Install fail"
INFO: EOF
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for working directories... current
using prefix '/data/data/com.termux/files/usr'
checking for pkg-config... /data/data/com.termux/files/usr/bin/pkg-config
checking for c compiler... gcc
checking exec r2 -v... ok
Using PKGCONFIG: /data/data/com.termux/files/usr/bin/pkg-config
checking pkg-config flags for r_core... yes
checking for curl... /data/data/com.termux/files/usr/bin/curl
checking for wget... /data/data/com.termux/files/usr/bin/wget
checking for git... /data/data/com.termux/files/usr/bin/git
checking for xz... /data/data/com.termux/files/usr/bin/xz
creating ./config.mk
creating ./config.h
cleaning temporally files... done

Final report:
 - R2_VERSION = radare2 5.8.8 0 @ linux-arm-64
birth: git.5.8.8 2023-06-09__21:50:06
commit: 5.8.8
options: gpl release -O1 cs:5 cl:2 make
rm -f ext/frida
mkdir -p ext/frida-android-16.1.7/_
rm -f frida-sdk.tar.xz
wget -c -O frida-sdk.tar.xz -c https://github.com/frida/frida/releases/download/16.1.7/frida-core-devkit-16.1.7-android-arm64.tar.xz
--2023-11-28 10:09:26--  https://github.com/frida/frida/releases/download/16.1.7/frida-core-devkit-16.1.7-android-arm64.tar.xz
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/0c48521a-8319-4bd9-86a6-a2bc3352731d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231128T070927Z&X-Amz-Expires=300&X-Amz-Signature=7b15677ee414e7574c6eb5ee8b64c9c93d919093ada3e9f4441c8e6441b15832&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.1.7-android-arm64.tar.xz&response-content-type=application%2Foctet-stream [following]
--2023-11-28 10:09:27--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/0c48521a-8319-4bd9-86a6-a2bc3352731d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231128T070927Z&X-Amz-Expires=300&X-Amz-Signature=7b15677ee414e7574c6eb5ee8b64c9c93d919093ada3e9f4441c8e6441b15832&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.1.7-android-arm64.tar.xz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40624456 (39M) [application/octet-stream]
Saving to: ‘frida-sdk.tar.xz’

frida-sdk.tar.x 100%[=====>]  38.74M  9.84MB/s    in 4.3s

2023-11-28 10:09:32 (9.12 MB/s) - ‘frida-sdk.tar.xz’ saved [40624456/40624456]

tar xJvf frida-sdk.tar.xz -C ext/frida-android-16.1.7/_
./
./libfrida-core.a
./frida-core-example.c
./frida-core.gir
./frida-core.h
mv ext/frida-android-16.1.7/_/* ext/frida-android-16.1.7
rmdir ext/frida-android-16.1.7/_
#mv ext/frida ext/frida-android-16.1.7
cd ext && ln -fs frida-android-16.1.7 frida
[ "`readlink ext/frida`" = frida-android-16.1.7 ] || \
        (cd ext && rm -f frida ; ln -fs frida-android-16.1.7 frida)
rm -f src/_agent*
make src/r2frida-compile
make[1]: Entering directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
cc -g src/r2frida-compile.c -Iext/frida \
        -I/data/data/com.termux/files/usr/include/libr -L/data/data/com.termux/files/usr/lib -lr_util -ldl ext/frida/libfrida-core.a \
        -DFRIDA_VERSION_STRING=\"16.1.7\" -DFRIDA_VERSION_MAJOR=16 -DR2FRIDA_VERSION_STRING=\"5.8.8\" -fPIC -Wall -Werror -g -I/data/data/com.termux/files/usr/include/libr -DWANT_SESSION_DEBUGGER=1 -fPIC -g -L/data/data/com.termux/files/usr/lib -lr_core -lr_config -ldl -lr_debug -ldl -lr_bin -ldl -lr_lang -ldl -lr_anal -ldl -lr_bp -ldl -lr_egg -ldl -lr_asm -ldl -lr_flag -ldl -lr_search -ldl -lr_syscall -ldl -lr_fs -ldl -lr_magic -ldl -lr_arch -ldl -lr_esil -ldl -lr_reg -ldl -lr_io -ldl -lr_socket -ldl -lr_cons -ldl -lr_crypto -ldl -lr_util -ldl -landroid -llog -lm -pthread -Iext/frida -o src/r2frida-compile
make[1]: Leaving directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
make io_frida.so
make[1]: Entering directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
src/r2frida-compile -H src/_agent.h -o src/_agent.js -Sc src/agent/index.ts
**
Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null)
Bail out! Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null)
make[1]: *** [Makefile:242: src/_agent.js] Aborted
make[1]: Leaving directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
make: *** [Makefile:165: all] Error 2
Build failed
mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/plugins"
mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/prefix/bin"
rm -f "//data/data/com.termux/files/home/.local/share/radare2/plugins/io_frida.so"
cp -f io_frida.so* /"/data/data/com.termux/files/home/.local/share/radare2/plugins"
cp: cannot stat 'io_frida.so*': No such file or directory
make: *** [Makefile:320: user-install] Error 1
Install fail
~ $ r2pm -ci  r2frida
INFO: Cleaning r2frida
INFO: Using r2-5.8.8 and r2pm-5.8.8
INFO: Cleaning r2frida
INFO: git clone --depth=10 --recursive https://github.com/nowsecure/r2frida /data/data/com.termux/files/home/.local/share/radare2/r2pm/git//r2frida
Cloning into '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git//r2frida'...
remote: Enumerating objects: 187, done.
remote: Counting objects: 100% (187/187), done.
remote: Compressing objects: 100% (141/141), done.
remote: Total 187 (delta 41), reused 125 (delta 39), pack-reused 0
Receiving objects: 100% (187/187), 204.03 KiB | 610.00 KiB/s, done.
Resolving deltas: 100% (41/41), done.
INFO: Starting install for r2frida
INFO: SCRIPT=<<EOF
INFO:   unset CFLAGS
        unset LDFLAGS
        ./configure || R2PM_FAIL "Install fail"
        if [ -n "${FRIDA_VERSION}" ]; then
                ${MAKE} frida_version=${FRIDA_VERSION} || R2PM_FAIL "Build failed"
        else
                ${MAKE} || R2PM_FAIL "Build failed"
        fi
        ${MAKE} user-install R2_PLUGDIR="${R2PM_PLUGDIR}" || R2PM_FAIL "Install fail"
INFO: EOF
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for working directories... current
using prefix '/data/data/com.termux/files/usr'
checking for pkg-config... /data/data/com.termux/files/usr/bin/pkg-config
checking for c compiler... gcc
checking exec r2 -v... ok
Using PKGCONFIG: /data/data/com.termux/files/usr/bin/pkg-config
checking pkg-config flags for r_core... yes
checking for curl... /data/data/com.termux/files/usr/bin/curl
checking for wget... /data/data/com.termux/files/usr/bin/wget
checking for git... /data/data/com.termux/files/usr/bin/git
checking for xz... /data/data/com.termux/files/usr/bin/xz
creating ./config.mk
creating ./config.h
cleaning temporally files... done

Final report:
 - R2_VERSION = radare2 5.8.8 0 @ linux-arm-64
birth: git.5.8.8 2023-06-09__21:50:06
commit: 5.8.8
options: gpl release -O1 cs:5 cl:2 make
rm -f ext/frida
mkdir -p ext/frida-android-16.1.7/_
rm -f frida-sdk.tar.xz
wget -c -O frida-sdk.tar.xz -c https://github.com/frida/frida/releases/download/16.1.7/frida-core-devkit-16.1.7-android-arm64.tar.xz
--2023-11-28 10:10:09--  https://github.com/frida/frida/releases/download/16.1.7/frida-core-devkit-16.1.7-android-arm64.tar.xz
Resolving github.com (github.com)... 140.82.113.4
Connecting to github.com (github.com)|140.82.113.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/0c48521a-8319-4bd9-86a6-a2bc3352731d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231128T071010Z&X-Amz-Expires=300&X-Amz-Signature=9670654a66332aac384496042b89f61c66570c41e1d6f4be18a355c204db7dd7&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.1.7-android-arm64.tar.xz&response-content-type=application%2Foctet-stream [following]
--2023-11-28 10:10:10--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/9405122/0c48521a-8319-4bd9-86a6-a2bc3352731d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231128%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231128T071010Z&X-Amz-Expires=300&X-Amz-Signature=9670654a66332aac384496042b89f61c66570c41e1d6f4be18a355c204db7dd7&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=9405122&response-content-disposition=attachment%3B%20filename%3Dfrida-core-devkit-16.1.7-android-arm64.tar.xz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40624456 (39M) [application/octet-stream]
Saving to: ‘frida-sdk.tar.xz’

frida-sdk.tar.x 100%[=====>]  38.74M  3.59MB/s    in 12s

2023-11-28 10:10:23 (3.28 MB/s) - ‘frida-sdk.tar.xz’ saved [40624456/40624456]

tar xJvf frida-sdk.tar.xz -C ext/frida-android-16.1.7/_
./
./libfrida-core.a
./frida-core-example.c
./frida-core.gir
./frida-core.h
mv ext/frida-android-16.1.7/_/* ext/frida-android-16.1.7
rmdir ext/frida-android-16.1.7/_
#mv ext/frida ext/frida-android-16.1.7
cd ext && ln -fs frida-android-16.1.7 frida
[ "`readlink ext/frida`" = frida-android-16.1.7 ] || \
        (cd ext && rm -f frida ; ln -fs frida-android-16.1.7 frida)
rm -f src/_agent*
make src/r2frida-compile
make[1]: Entering directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
cc -g src/r2frida-compile.c -Iext/frida \
        -I/data/data/com.termux/files/usr/include/libr -L/data/data/com.termux/files/usr/lib -lr_util -ldl ext/frida/libfrida-core.a \
        -DFRIDA_VERSION_STRING=\"16.1.7\" -DFRIDA_VERSION_MAJOR=16 -DR2FRIDA_VERSION_STRING=\"5.8.8\" -fPIC -Wall -Werror -g -I/data/data/com.termux/files/usr/include/libr -DWANT_SESSION_DEBUGGER=1 -fPIC -g -L/data/data/com.termux/files/usr/lib -lr_core -lr_config -ldl -lr_debug -ldl -lr_bin -ldl -lr_lang -ldl -lr_anal -ldl -lr_bp -ldl -lr_egg -ldl -lr_asm -ldl -lr_flag -ldl -lr_search -ldl -lr_syscall -ldl -lr_fs -ldl -lr_magic -ldl -lr_arch -ldl -lr_esil -ldl -lr_reg -ldl -lr_io -ldl -lr_socket -ldl -lr_cons -ldl -lr_crypto -ldl -lr_util -ldl -landroid -llog -lm -pthread -Iext/frida -o src/r2frida-compile
make[1]: Leaving directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
make io_frida.so
make[1]: Entering directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
src/r2frida-compile -H src/_agent.h -o src/_agent.js -Sc src/agent/index.ts
**
Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null)
Bail out! Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co: assertion failed: (container.module != null)
make[1]: *** [Makefile:242: src/_agent.js] Aborted
make[1]: Leaving directory '/data/data/com.termux/files/home/.local/share/radare2/r2pm/git/r2frida'
make: *** [Makefile:165: all] Error 2
Build failed
mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/plugins"
mkdir -p /"/data/data/com.termux/files/home/.local/share/radare2/prefix/bin"
rm -f "//data/data/com.termux/files/home/.local/share/radare2/plugins/io_frida.so"
cp -f io_frida.so* /"/data/data/com.termux/files/home/.local/share/radare2/plugins"
cp: cannot stat 'io_frida.so*': No such file or directory
make: *** [Makefile:320: user-install] Error 1
Install fail

frida:ERROR%3A../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co:%20assertion%20failed:%20(container.module%20!=%20null)%0ABail%20out!%20Frida:ERROR:../../../frida-core/src/agent-container.vala:25:frida_agent_container_create_co:%20assertion%20failed:%20(container.module%20!=%20null)%0Amake%5B1%5D:%20***%20%5BMakefile:242:%20src/_agent.js%5D%20Aborted

^ thats a bug in frida. I think its because you dont have enough free disk or the tmpdir cant execute binaries. Maybe @oleavr have a better idea

meanwhile you can use the precompiled agent (see the -/configure —help) for this