radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Installing and using plugins under Windows does not work

Open stevenengland opened this issue 9 months ago • 15 comments

Environment

Windows 11 vm

Description

When installing plugins, some installations are running without an error, others throw errors. After a successful installation the plugin cannot be used unfortunately.

This is true for a precompiled set of binaries as well as for a fresh built installation:

Example for a working installation but where the invocation fails:

(venv) C:\Users\vboxuser\Desktop\radare2_compiled\prefix\bin>r2pm -ci r2ai
INFO: Cleaning r2ai
INFO: Using r2-5.9.9 and r2pm-5.9.9
INFO: Cleaning r2ai
INFO: git clone --depth=1 --recursive https://github.com/radareorg/r2ai C:\Users\vboxuser\.local\share\radare2\r2pm/git\r2ai
Cloning into 'C:\Users\vboxuser\.local\share\radare2\r2pm/git\r2ai'...
remote: Enumerating objects: 163, done.
remote: Counting objects: 100% (163/163), done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 163 (delta 8), reused 97 (delta 3), pack-reused 0 (from 0)
Receiving objects: 100% (163/163), 2.15 MiB | 5.51 MiB/s, done.
Resolving deltas: 100% (8/8), done.
INFO: Starting install for r2ai


(venv) C:\Users\vboxuser\Desktop\radare2_compiled\prefix\bin>r2pm -r r2ai
The command "r2ai" is either misspelled or could not be found

Example where even the plugin installation fails:

(venv) C:\Users\vboxuser\Desktop\radare2_compiled\prefix\bin>r2pm -ci decai
INFO: Cleaning decai
INFO: Using r2-5.9.9 and r2pm-5.9.9
INFO: Cleaning decai
INFO: git clone --depth=1 --recursive https://github.com/radareorg/r2ai C:\Users\vboxuser\.local\share\radare2\r2pm/git\decai
Cloning into 'C:\Users\vboxuser\.local\share\radare2\r2pm/git\decai'...
remote: Enumerating objects: 163, done.
remote: Counting objects: 100% (163/163), done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 163 (delta 8), reused 97 (delta 3), pack-reused 0 (from 0)
Receiving objects: 100% (163/163), 2.15 MiB | 5.48 MiB/s, done.
Resolving deltas: 100% (8/8), done.
INFO: Starting install for decai
ERROR: This package does not have R2PM_INSTALL_WINDOWS instructions

stevenengland avatar Mar 17 '25 17:03 stevenengland

you can copy the script into the plugin directory by hand. but the script should add the rule for install_windows to work in windows. can you give it a try by modifying the file and sending a PR?

trufae avatar Mar 17 '25 18:03 trufae

Let me rephrase it. This is a problem related to the packages itself and not to r2pm. It will be good that the most used packages are supported on windows by having the target script.

Would you like to edit those packages and write those batch scripts?

Heres an example: https://github.com/radareorg/radare2-pm/blob/master/db/r2frida

trufae avatar Mar 18 '25 06:03 trufae

I agree that r2pm may stop earlier and not clone a repo if the pkg doesnt contain the windows scripts. This is something I can fix in here

trufae avatar Mar 18 '25 06:03 trufae

Okay, thanks for further explanation. I cannot promise anything but I will have a look. This is all related to the decai example from above, correct?

I will also have a look for the other case where the installation succeeds but then the plugin cannot be called. Like it is illustrated above for the r2ai plugin.

stevenengland avatar Mar 18 '25 11:03 stevenengland

i just did the windows scripts for decai, but i have no windows/time to test it, give it a try and let me know if it works now

trufae avatar Mar 19 '25 15:03 trufae

also this https://github.com/radareorg/radare2/commit/4787cbf46a91481dc6e6bdbabbbb00948d28a3a3

trufae avatar Mar 19 '25 15:03 trufae

i just did the windows scripts for decai, but i have no windows/time to test it, give it a try and let me know if it works now

Hi, sorry to say that this seems to be not yet fixed (or maybe I do not understand it). The update recognized a change for the decai plugin but the installation failed.

PS C:\Users\vboxuser\Desktop\radare2_compiled> r2pm -U
INFO: Running git pull on C:\Users\vboxuser\.local\share\radare2\r2pm/git/radare2-pm
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 4 (delta 2), pack-reused 0 (from 0)
Unpacking objects: 100% (4/4), 526 bytes | 35.00 KiB/s, done.
From https://github.com/radareorg/radare2-pm
   6215b70..40899cd  master     -> origin/master
Updating 6215b70..40899cd
Fast-forward
 db/decai | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
PS C:\Users\vboxuser\Desktop\radare2_compiled> r2pm -ci decai
INFO: Cleaning decai
INFO: Using r2-5.9.9 and r2pm-5.9.9
INFO: Cleaning decai
fatal: not a git repository (or any of the parent directories): .git
INFO: Starting install for decai
INFO: R2PM_NEEDS: Found curl in PATH
ERROR: This package does not have R2PM_INSTALL_WINDOWS instructions

stevenengland avatar Mar 19 '25 19:03 stevenengland

Do you have curl installed? If so i guess we need to fix the function that walks the PATH env var for windows environments

trufae avatar Mar 19 '25 20:03 trufae

Should be baked into Windows by default but I'll check

stevenengland avatar Mar 19 '25 21:03 stevenengland

Curl is available.

stevenengland avatar Mar 20 '25 15:03 stevenengland

works for me it finds curl, installs the plugin, and decai command appears in the r2 shell. try again after building latest r2 from git just in case.. also update the r2pm database with r2pm -U

trufae avatar Mar 20 '25 18:03 trufae

in r2 you have the "where" and "whereis" commands to tell you where a binary is located in PATH. this works fine for r2 and r2pm in my box. the code used in this command is the same used by r2pm

trufae avatar Mar 20 '25 19:03 trufae

ping?

trufae avatar Mar 26 '25 07:03 trufae

Hi, sorry.

experienced a few obstacles and did not try again until now. So for completeness but not related to this issue:

I compiled it again and ran:

(venv) PS C:\Users\vboxuser\Desktop\radare_compiled_260325\prefix> r2pm.exe -U
INFO: Running git pull on C:\Users\vboxuser\.local\share\radare2\r2pm/git/radare2-pm
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3), pack-reused 0 (from 0)
Unpacking objects: 100% (4/4), 348 bytes | 9.00 KiB/s, done.
From https://github.com/radareorg/radare2-pm
   40899cd..a918f2d  master     -> origin/master
Updating 40899cd..a918f2d
Fast-forward
 db/decai | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(venv) PS C:\Users\vboxuser\Desktop\radare_compiled_260325\prefix> r2pm -ci decai
INFO: Cleaning decai
INFO: Using r2-5.9.9 and r2pm-5.9.9
INFO: Cleaning decai
fatal: not a git repository (or any of the parent directories): .git
INFO: Starting install for decai
INFO: R2PM_NEEDS: Found curl in PATH
ERROR: This package does not have R2PM_INSTALL_WINDOWS instructions

Then I ran:

(venv) PS C:\Users\vboxuser\Desktop\radare_compiled_260325\prefix> r2 binary.exe
WARN: Relocs has not been applied. Please use `-e bin.relocs.apply=true` or `-e bin.cache=true` next time
[0x00401594]> where decai
[0x00401594]> whereis decai
[0x00401594]> decai -h
ERROR: r2pm -ci decai
[0x00401594]>

So, that is basically all I can share right now.

stevenengland avatar Mar 26 '25 19:03 stevenengland

all that stuff seems like problems to the decai package itself not tied to r2 or r2pm imho. This ticket should be filled int he radare2-pm repo. Would you like to give it a try to fix the packages? it's just pretty short batch scripts

trufae avatar Nov 18 '25 11:11 trufae