eteran / edb-debugger

edb is a cross-platform AArch32/x86/x86-64 debugger.
GNU General Public License v2.0
2.68k stars 322 forks source link

execv() failed: No such file or directory #805

Closed Ana06 closed 1 year ago

Ana06 commented 3 years ago

I have installed edb in a VM with openSUSE Leap 15.2 and I am not able to open an executable ELF 64-bit LSB shared object, x86-64. Both the File-> Open and the --run option raise the following error: Failed to open and attach to process: execv() failed: No such file or directory.

Screenshot 2021-06-25 at 12 44 50

The executable works when running it without edb and attaching to it also works fine.

This doesn't seem related to https://github.com/eteran/edb-debugger/issues/741 as I am running a 64-bit executable in a 64-bit system.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/99622490-execv-failed-no-such-file-or-directory?utm_campaign=plugin&utm_content=tracker%2F14326212&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F14326212&utm_medium=issues&utm_source=github).
10110111 commented 3 years ago

Could you run EDB as follows and post the console output?

strace -feexecve ./edb --run /path/to/your-program
10110111 commented 3 years ago

Oh, wait... do you actually have /usr/bin/xterm? If not, try disabling Open a terminal ... option in PreferencesDebugging.

Ana06 commented 3 years ago

Thanks for the fast answer @10110111!

I do have /usr/bin/xterm.

The output of strace -feexecve ./edb --run /path/to/your-program

/find_the_best_fishing_spot 
execve("./edb", ["./edb", "--run", "/home/flare/Desktop/find_the_bes"...], 0x7ffc2c218278 /* 96 vars */) = 0
strace: Process 40501 attached
strace: Process 40502 attached
strace: Process 40503 attached
child: PTRACE_TRACEME failed: Operation not permitted
[pid 40503] --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=40503, si_uid=1000} ---
[pid 40503] +++ killed by SIGABRT (core dumped) +++
[pid 40500] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_DUMPED, si_pid=40503, si_uid=1000, si_status=SIGABRT, si_utime=0, si_stime=0} ---
unexpected status returned by waitpid: 0x86
failed to kill child: No such process
Detect that read /proc/<pid>/mem works  =  false
Detect that write /proc/<pid>/mem works =  false
Starting edb version: 1.3.0
Please Report Bugs & Requests At: https://github.com/eteran/edb-debugger/issues
strace: Process 40505 attached
Running Terminal:  "/usr/bin/xterm"
Terminal Args:  ("-title", "edb output", "-hold", "-e", "sh", "-c", "tty > /tmp/edb_temp_file_1477747114_40500;trap \"\" INT QUIT TSTP;exec<&-; exec>&-;while :; do sleep 3600; done")
strace: Process 40506 attached
[pid 40506] execve("/usr/bin/xterm", ["/usr/bin/xterm", "-title", "edb output", "-hold", "-e", "sh", "-c", "tty > /tmp/edb_temp_file_1477747"...], 0x7ffe5c673328 /* 96 vars */) = 0
strace: Process 40507 attached
[pid 40507] execve("/home/flare/bin/sh", ["sh", "-c", "tty > /tmp/edb_temp_file_1477747"...], 0x55d369480a20 /* 99 vars */) = -1 ENOENT (No such file or directory)
[pid 40507] execve("/usr/local/bin/sh", ["sh", "-c", "tty > /tmp/edb_temp_file_1477747"...], 0x55d369480a20 /* 99 vars */) = -1 ENOENT (No such file or directory)
[pid 40507] execve("/usr/bin/sh", ["sh", "-c", "tty > /tmp/edb_temp_file_1477747"...], 0x55d369480a20 /* 99 vars */) = 0
strace: Process 40508 attached
[pid 40508] execve("/usr/bin/tty", ["tty"], 0x55ddb4cba6f0 /* 99 vars */) = 0
Terminal process has TTY:  "/dev/pts/2"
[pid 40508] +++ exited with 0 +++
[pid 40507] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40508, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 40509 attached
strace: Process 40510 attached
[pid 40510] execve("/usr/bin/sleep", ["sleep", "3600"], 0x55ddb4cd0e10 /* 99 vars */) = 0
[pid 40509] execve("/home/flare/Desktop/find_the_best_fishing_spot/find_the_best_fishing_spot", ["/home/flare/Desktop/find_the_bes"...], 0x7ffe5c673328 /* 96 vars */) = -1 ENOENT (No such file or directory)
[pid 40509] --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=40509, si_uid=1000} ---
[pid 40509] +++ killed by SIGABRT (core dumped) +++
[pid 40500] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_DUMPED, si_pid=40509, si_uid=1000, si_status=SIGABRT, si_utime=0, si_stime=0} ---
strace: Process 40513 attached
strace: Process 40512 attached
strace: Process 40514 attached
[pid 40514] execve("/bin/sh", ["sh", "-c", "(kreadconfig5 --key nonexistant)"...], 0x7ffe5c673328 /* 96 vars */) = 0
strace: Process 40515 attached
[pid 40515] execve("/usr/bin/kreadconfig5", ["kreadconfig5", "--key", "nonexistant"], 0x55a2e99653b0 /* 96 vars */) = 0
[pid 40515] +++ exited with 0 +++
[pid 40514] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40515, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 40514] +++ exited with 0 +++
[pid 40513] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40514, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 40516 attached
[pid 40516] execve("/bin/sh", ["sh", "-c", "(qtpaths --paths GenericConfigLo"...], 0x7ffe5c673328 /* 96 vars */) = 0
strace: Process 40517 attached
[pid 40517] execve("/usr/bin/qtpaths", ["qtpaths", "--paths", "GenericConfigLocation"], 0x5639d5dfc3c0 /* 96 vars */) = 0
[pid 40517] +++ exited with 0 +++
[pid 40516] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40517, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 40516] +++ exited with 0 +++
[pid 40513] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40516, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 40518 attached
[pid 40518] execve("/bin/sh", ["sh", "-c", "(kreadconfig5 --file kioslaverc "...], 0x7ffe5c673328 /* 96 vars */) = 0
strace: Process 40519 attached
[pid 40519] execve("/usr/bin/kreadconfig5", ["kreadconfig5", "--file", "kioslaverc", "--group", "Proxy Settings", "--key", "ProxyType", "--default", "-1"], 0x556c96fec3f0 /* 96 vars */) = 0
[pid 40519] +++ exited with 0 +++
[pid 40518] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40519, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 40518] +++ exited with 0 +++
[pid 40513] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=40518, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 40520 attached
comparing versions: [4864] [4864]
10110111 commented 3 years ago
[pid 40509] execve("/home/flare/Desktop/find_the_best_fishing_spot/find_the_best_fishing_spot", ["/home/flare/Desktop/find_the_bes"...], 0x7ffe5c673328 /* 96 vars */) = -1 ENOENT (No such file or directory)

So, the kernel says it can't find a file. This may be a shared library required by the executable. What does the following command say?

ldd /home/flare/Desktop/find_the_best_fishing_spot/find_the_best_fishing_spot
Ana06 commented 3 years ago

@10110111 Yes, the required shared library is in a .lib directory in the same directory as the executable. This way it is used when running the program from the console.

10110111 commented 3 years ago

How exactly do you run the executable—right from opening a terminal? Do you set LD_LIBRARY_PATH for it to search the .lib directory?

eteran commented 1 year ago

Closing due to lack of feedback. Please re-open if the problem persists.