Root Access

From iDroid Project

Jump to: navigation, search

When su is typed into the terminal emulator or adb (over tcpip) you will get "Permission Denied". In order to gain root access to the device in either terminal emulator or adb, follow these instructions:

Contents

Prerequisites

  • iDroid MoJo is already rooted. If you are using MoJo, you do not need to read this guide. If you are not using MoJo, then upgrade to MoJo as in the Installation Guide or read on.
  • This guide uses ADB, it must be installed first.
  • Make sure that the USB debugging mode is ON.

In iDroid, go to Settings > Applications > Development > USB debugging. Enable it.

  • Download the modified su file from here, and extract it to an easy to remember location.

Connecting in ADB

On Windows open a command prompt and type:

adb connect xxx.xxx.xxx.xxx:5555

On Linux open a terminal and type:

./adb connect xxx.xxx.xxx.xxx:5555

where xxx.xxx.xxx.xxx is the IP address of your iPhone running iDroid.

Replacing the Files

1. On either command prompt or terminal, type:

./adb push *path to MODIFIED VERSION of su file* /data/local

This will send the su file to the filesystem. If you get an error, make sure you are in the tools directory.

Example

./adb push /home/JohnDoe/Desktop/su /data/local
where /home/JohnDoe/Desktop/su was the directory of the modified su file if it was downloaded to the user JohnDoe's Desktop directory.
  • Modified version of su*(76232 bytes)*

2. Type:

./adb shell

This will dump you to a shell prompt where the rest of the commands will be entered.

3. In the shell prompt, type:

mount -o remount,rw /dev/root /system

This will give you write access to the filesystem.

4. Type:

cd /system/xbin
mv su osu
cat /data/local/su > su
chmod 6755 su

This will create a backup of your existing su, replace it with the modified one and set the permissions accordingly.

  • mv su osu*: This step renames the old su to osu, to make a back up of the original file. If you get a error skip this step!

5. Type:

ls -l *su

The output should look something like this (disregard the modification dates):

ls -l *su
-rwsr-sr-x root     root        76232 2022-04-17 19:29 osu
-rwsr-sr-x root     root        76232 2022-04-27 15:33 su

If you don't get that, you have done something wrong. Reread the guide and do it again.

If su file is not 76232 than most likely it is not the modified version. The original version is around 30000.

6. If the previous step worked, type:

sync

This will sync the changes. It may take a while. After sync-ing, su MIGHT work by typing:

su

into the shell prompt.

7. Reboot the phone.

One way is to do hard reset (home + power buttons for 10+ seconds) the phone and boot back into Android. If su worked in your shell prompt, you can also type
reboot
to reboot.

Gaining root access

To gain root access, type:

su

into either Terminal Emulator (in dev tools on the phone) or ADB.

If successful, this should pop up in the output:

su: access granted, courtesy of www.magicandroidapps.com

Troubleshooting

Error messages may appear upon entering commands in ADB Shell. These errors often happen with a rooted device and is caused by the modified su.

  • Error 1:
# command
[1] + Stopped (signal)        command
  • Error 2:
# command
[1]   Segmentation fault      command

The workaround for these errors is to simply reenter the command. A new kernel can help minimize these errors.

Credits

  • http://android-dls.com/wiki/index.php?title=Magic_Root_Access
  • #iphonelinux channel
  • guide written by alex