Unable to run su in adb shell on an Ubuntu machine Device: Unbranded Android tablet
Android: 2.2

I was trying to root my tablet using my Ubuntu 11.10 machine.

I followed the following instructions from a site:

1. adb Install Superuser.apk
2. adb push busybox /sdcard/
3. adb push su /sdcard/


In the same terminal, now we open adb:

adb shell


Enter the command for superuser

su


Now, you will copy and paste these commands:

1. mount -o remount,rw /system
2. mv /system/xbin/su /system/xbin/oldsu
3. cp /sdcard/busybox /system/bin/busybox
4. cp /sdcard/su /system/bin/su
5. chmod 06755 /system/bin/su
6. chmod 0755 /system/bin/busybox
7. ln -s /system/bin/su /system/xbin/su
8. exit su (may say something about a bad number
9. exit
10. adb reboot


I could not run the first mount command, but still continued with rest of the 9 commands. Then, I ran a root checker app after reboot to check whether my device was rooted. It indicated no root access.

I then again ran adb shell, and then on running su, it gave an error:

su: 1: Syntax error: "(" unexpected


Now, I am not even able to delete this file. I am stuck and since it's my first time trying to root an Android device. I have no idea what should be done now to resolve this problem and successfully root my device.
Obviously the su binary you installed does not work well with your system. As you luckily created a backup of the original su executable, recommendation is to revert the incompatible changes first:

adb shell
$ oldsu
# mount -o remount,rw /system
# rm /system/xbin/su /system/bin/su
# cp /system/xbin/oldsu /system/xbin/su
# exit
$ exit
adb reboot


Explanation: Start adb shell and become root (using the working oldsu executable). Delete /system/xbin/su (which is only a symlink now) and the incompatible /system/bin/su, then copy the working su back to where it belongs. Then exit the root shell and finally adb shell. The reboot is optional, and should not be needed. Also optionally you could remove busybox (or keep it if it works). Before exiting adb shell you might wish to test whether su works again, just to be sure (which is why I wrote cp for this: if anything goes wrong, you still have your oldsu available).

With those steps, you should at least have everything in working order again, and this issue is solved. Updating to a newer Android version is a separate issue: Please check the update tag, as corresponding questions already exist. Same for the ROM you might need (check the rom tag for that, and in also check the tag-wikis for update and rom).