Tiny Core Linux

Tiny Core Base => Micro Core => Topic started by: Santos on March 09, 2022, 12:59:54 PM

Title: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 09, 2022, 12:59:54 PM
Hello

https://developer.android.com/studio/releases/platform-tools#downloads

I just recently downloaded the latest version of  adb  from the AOSP project page. In CorePlus with lots of extensions loaded, the binary does runs and I'm able to execute it without any issues.

However, in  microcore  with no extension loaded, I'm getting the   -sh: ./adb: not found   error. I don't know which one is the missing piece in MC.

Typing in: ldd ./adb

Code: [Select]
        linux-vdso.so.1 (0x00007ffc56bf3000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f15ed6e5000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f15ed6c8000)
libm.so.6 => /lib/libm.so.6 (0x00007f15ed5a4000)
librt.so.1 => /lib/librt.so.1 (0x00007f15ed59b000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f15ed581000)
libc.so.6 => /lib/libc.so.6 (0x00007f15ed3fd000)
/lib64/ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x00007f15eddcb000)

Any advise?

Thank you.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 01:55:36 PM
Hi Santos
It's saying that  adb  can not be found in the current directory. Do you see it if you run this command:
Code: [Select]
ls -l a*
If it shows up, see if running this fixes it:
Code: [Select]
chmod 775 adb
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 09, 2022, 02:44:00 PM
Hello Rich

Yes,  adb  it is present and permissions are properly set up.

Code: [Select]
tc@box:~/Descargas/adb64/platform-tools$ ls -l a*
-rwxr-xr-x    1 tc       staff      8168736 Mar  9 16:20 adb

What confuses me is that if the file is non-existing the error message is almost the same, but the 'dash' at the beginning is missing.

Code: [Select]
sh: ./adc: not found
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 06:07:21 PM
Hi Santos
Do either of these commands produce a different response:
Code: [Select]
./adb --help
./adb help

Does running this first help:
Code: [Select]
hash -r
Maybe you need to start loading your extensions to see if one of them allows it to work. Openssl, tls, and python
come to mind.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 07:16:05 PM
Hi Santos
I think this type of error sometimes occurs when bash is needed but not found.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 09, 2022, 07:44:04 PM
Hello Rich

...
Code: [Select]
./adb --help
./adb help

...
Code: [Select]
hash -r
...

I tried:
Code: [Select]
./adb help
./adb --help

On my CorePlus installation I do have output. But same error message (not found) popping up on my bare  microcore  install.

For the  hash  command, result was the same (not found message).

...
Maybe you need to start loading your extensions to see if one of them allows it to work. Openssl, tls, and python
come to mind.


I was trying to avoid going that path. Is there any "tracer" (besides  ldd) so I can check on libraries interacting with the binary?

Hi Santos
I think this type of error sometimes occurs when bash is needed but not found.


bash  is not present on my CorePlus install, seems like  adb  is not linked to it.

Thank you for your help.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 07:59:38 PM
Hi Santos
... I was trying to avoid going that path. Is there any "tracer" (besides  ldd) so I can check on libraries interacting with the binary? ...
It's possible using  strace  might identify what was  "not found" , but strace can generate a lot of output.

It's possible what's missing is not a library, but some support file provided by an extension, or an environmental
variable that gets set, or a link to a file that gets created.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 09, 2022, 08:13:52 PM
Hello Rich

Thank you!

I'll try.

But first I'll need to read on how to use  strace. I'm very positive that the  man  page will suffice.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 08:39:28 PM
Hi Santos
Something like this might be a start:
Code: [Select]
strace -e trace=open ./adb
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Juanito on March 09, 2022, 08:53:49 PM
Is a symlink /lib64 -> /lib present?
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Rich on March 09, 2022, 08:57:50 PM
Hi Juanito
According to the  ldd  command in the original post, I think it is.
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 12, 2022, 12:46:19 PM
Hello

...

Code: [Select]
strace -e trace=open ./adb

Did it. Almost exact output. I really thought I'll be getting lots of sys calls, and such.

Code: [Select]
tc@box:~$ strace ./adb-bin/platform-tools/adb
execve("./adb-bin/platform-tools/adb", ["./adb-bin/platform-tools/adb"], 0x7fffd6bcc430 /* 19 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++


Is a symlink /lib64 -> /lib present?

It is.



***

I ended up loading extension by extension (  while  loop) to check which one triggered  adb  to be executed. Firefox did it.

Currently, I'm loading each  dep  at at time to see whats the extension with the library/files, etc. that is allowing  adb  to run.

This is what I'm getting from  strace  after loading firefox and being able to run  adb  .

(See attachment with messy output due to  script  ).
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 12, 2022, 11:00:36 PM
Hello

After loading all firefox dependencies  adb  wasn't being executed.

The line I used to test the packages was this (ignore leading +, was getting forum error):

Code: [Select]
++while read -r line ; ++do tce-load -il $line ; ++sleep 3 ; /home/tc/bin/adb ; ++done < firefox.tcz.dep



I checked  tce-load  script to try to add a  sleep  command and a line to execute  adb  right after a package is loaded. But I don't know on which section of the code should I put it.

What changes can I introduce on  tce-load  to have a  sleep  and  adb  being tested after each package is loaded?
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: curaga on March 12, 2022, 11:04:18 PM
It's probably something in FF's install script then. Look in /usr/local/tce.installed/firefox after loading it (or use unsquashfs or mounting to see it without loading).
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Juanito on March 12, 2022, 11:37:30 PM
Code: [Select]
file /home/tc/Downloads/platform-tools/adb
/home/tc/Downloads/platform-tools/adb: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, not stripped
/home/tc/Downloads/platform-tools/adb
sh: /home/tc/Downloads/platform-tools/adb: not found
sudo ln -s /lib /lib64
/home/tc/Downloads/platform-tools/adb
Android Debug Bridge version 1.0.41
Version 33.0.0-8141338
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: gadget42 on March 13, 2022, 03:14:56 AM
@Santos: very interested to learn your discoveries here!

sharing is caring
Title: Re: MC 12 x64 -sh: ./adb: not found
Post by: Santos on March 13, 2022, 01:06:44 PM
Hello

Amazing!

Thank you everybody. Juanito, it worked.

Solved. :)