12

I am using a rooted Samsung S8+. But, Termux cannot gain root access. I tried su, sudo unsuccessfully.

When I tried installing termux-sudo, I had the error cat: sudo: no such a file or directory.

IMG: IMG:

(Tap to enlarge)

6
  • 1
    Are you Magisk or SuperSU? Commented Dec 14, 2018 at 17:16
  • 3
    There is no sudo on Android, only /sbin/su binary exists on rooted phones. How did you root your phone? What does 'ls /sbin' command show? Did you grant root access to Termux app through Magisk or SuperSU app? Do you have SELinux enforcing or permissive? You may edit your question to add further details. Termux-sudo package isn't necessarily needed to run as root, that just a bash wrapper around su binary. Commented Dec 14, 2018 at 18:58
  • Can you please show the output of which su? Commented Jan 8, 2019 at 14:02
  • Instead of sudo ..Try running tsu
    – Tamale
    Commented May 19, 2019 at 0:15
  • I don't think tsu comes inbuilt with Termux. Requires installation. You should mention that.
    – Firelord
    Commented May 19, 2019 at 3:12

4 Answers 4

6

First, install the needed packages.

pkg install proot proot-distro tsu fakeroot parted

Then, go to a new screen in the terminal and type

proot -0 login
1

Are you sure that's the correct order of those commands? I have a strong feeling that it should have been sudo cat instead of cat sudo.

1

First, you probably need to use su rather than sudo. Where did you copy the sudo from? It looks like some incompatible executable, maybe copied from an x64 distro (guessing).

Second, Termux overrides $PATH. You will need to provide full path or to make su available on $PATH. You might want a symlink (ln -s) of su (which might be located in /sbin/, /system/xbin or so).

1
  • This is exactly right, although in my case the symlink was located in xsu. Also, after obtaining su, you need to re overwrite PATH so termux can access all of it's packages again. Commented Dec 5, 2021 at 4:24
1

You have installed incompatible software. In your output, the line "Exec: exec format error" is the program loader complaining about an incompatible binary format.

Your experiment failed because of wrong software type.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .