[Galaxy S II Themes and Apps] tiazek:
Hello Phil, thank you very much for this useful flashable script. I think this may be the only way to recover my phone from the unusable state it is right now... here is my story: http://xdaforums.com/showthread.php?t=2233942

However, when I try to flash it in recovery mode, I get the following error message:

Android system recovery <3e>

Choose a package to install:
/sdcard

../
Busy_Box_Uninstaller_v1.0-signed.zip
LOST.DIR/

# MANUAL MODE #
-- Appling Multi-CSC...
Applied the CSC-code : TPA
Succesfully applied multi-CSC.

-- Install /sdcard ...
Finding update package...
Opening update package...
Veryfing update package...
E:failed to verify whole-file signature
E:signature verification failed

I also wanted to try your "toolbox_fix.txt" script, because that seems to be exactly my case, a corrupted toolbox installation with symlinks pointing to the incorrect place, but my "su" command doesn't seem to be working fine.

Any ideas on how I can fix it? Thank you.

EDIT: I tried to restore the symlinks using the commands you posted in "toolbox_fix.txt", but this is what I'm getting:

$ toolbox ln -s /system/bin/toolbox /system/bin/ls
link failed File exists
$ ls
ls: not found
$ busybox ls
(command works fine)
$ unlink ls
unlink: not found
$ busybox unlink ls
unlink: applet not found
$busybox rm ls
rm: can't remove 'ls': No such file or directory
$ busybox rm /system/bin/ls
rm: can't remove '/system/bin/ls': Read-only file system
$ busybox ln -s /system/bin/toolbox /system/bin/ls
ln: /system/bin/ls: File exists
$ /system/bin/ls
/system/bin/ls: not found

EDIT 2:

I installed a custom recovery (twrp 2.4.3.0) to be able to flash your uninstall script. This was the result (file attached). Would you please tell me what was wrong? also, do I need to run the "cleaning" script of toolbox_fix.sh? The files you specify in the toolbox_fix script (cat, chmod, chown...) were fine it seems (not linked to busybox) but the root of the problems seems to be that some of them were linked to /data/local/toolbox ... and since the "data" folder is wiped after a factory reset, that could cause the problem. I don't know how they were symlinked to a location in /data ... just in case, I won't ever use a market busybox installer/uninstaller like Stericson's :/

busybox was installed by the toolkit (root) program this way:

set_perm(0, 0, 04755, "/system/xbin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");

So it doesn't seem to have done any weird symlinking, unless the busybox --install command itself is responsible, but I don't think so.

I flashed a root+busybox.zip with twrp recovery so now the phone is working fine again, but I would like to know about was was wrong to understand the problem so I don't make the same mistake in the future. Thank you.

EDIT 3:

It seems that after installing root+busybox.zip with twrp recovery, some symlinks are still wrong:

# readlink /system/bin/ls
/data/local/toolbox
# readlink /system/bin/lsmod
toolbox

I don't think /data/local/toolbox should ever be symlinked, am I right? If I do a factory reset it will most likely stop working. Weird thing is that even now I don't have a "toolbox" file in /data/local but the 'ls' command is working. I will use your toolbox_fix script to fix this!

EDIT 4:

The toolbox_fix script returns "link failed File exists" for all the commands... how can I make it work?

EDIT 5:

I figured it out. I had to remove the existing symlink first with 'rm'. I took your script, put the full command list and the 'rm' commands. So I'm sharing this with you and everyone that may find it useful. It's also in the attached file "toolbox_fix.txt" (made with unix EOL). To use it, follow the instructions of this post. My device is a Samsung Galaxy S3 Mini (GT-I8190L), in case that's useful to know. Thank you.

#!/system/bin/sh
toolbox rm /system/bin/cat
toolbox rm /system/bin/chmod
toolbox rm /system/bin/chown
toolbox rm /system/bin/cmp
toolbox rm /system/bin/date
toolbox rm /system/bin/dd
toolbox rm /system/bin/df
toolbox rm /system/bin/dmesg
toolbox rm /system/bin/getevent
toolbox rm /system/bin/getprop
toolbox rm /system/bin/hd
toolbox rm /system/bin/id
toolbox rm /system/bin/ifconfig
toolbox rm /system/bin/iftop
toolbox rm /system/bin/insmod
toolbox rm /system/bin/ioctl
toolbox rm /system/bin/ionice
toolbox rm /system/bin/kill
toolbox rm /system/bin/ln
toolbox rm /system/bin/log
toolbox rm /system/bin/ls
toolbox rm /system/bin/lsmod
toolbox rm /system/bin/lsof
toolbox rm /system/bin/md5
toolbox rm /system/bin/mkdir
toolbox rm /system/bin/mount
toolbox rm /system/bin/mv
toolbox rm /system/bin/nandread
toolbox rm /system/bin/netstat
toolbox rm /system/bin/newfs_msdos
toolbox rm /system/bin/notify
toolbox rm /system/bin/printenv
toolbox rm /system/bin/ps
toolbox rm /system/bin/reboot
toolbox rm /system/bin/renice
toolbox rm /system/bin/rm
toolbox rm /system/bin/rmdir
toolbox rm /system/bin/rmmod
toolbox rm /system/bin/route
toolbox rm /system/bin/schedtop
toolbox rm /system/bin/sendevent
toolbox rm /system/bin/setconsole
toolbox rm /system/bin/setprop
toolbox rm /system/bin/sleep
toolbox rm /system/bin/smd
toolbox rm /system/bin/start
toolbox rm /system/bin/stop
toolbox rm /system/bin/sync
toolbox rm /system/bin/top
toolbox rm /system/bin/touch
toolbox rm /system/bin/umount
toolbox rm /system/bin/uptime
toolbox rm /system/bin/vmstat
toolbox rm /system/bin/watchprops
toolbox rm /system/bin/wipe
toolbox ln -s toolbox /system/bin/cat
toolbox ln -s toolbox /system/bin/chmod
toolbox ln -s toolbox /system/bin/chown
toolbox ln -s toolbox /system/bin/cmp
toolbox ln -s toolbox /system/bin/date
toolbox ln -s toolbox /system/bin/dd
toolbox ln -s toolbox /system/bin/df
toolbox ln -s toolbox /system/bin/dmesg
toolbox ln -s toolbox /system/bin/getevent
toolbox ln -s toolbox /system/bin/getprop
toolbox ln -s toolbox /system/bin/hd
toolbox ln -s toolbox /system/bin/id
toolbox ln -s toolbox /system/bin/ifconfig
toolbox ln -s toolbox /system/bin/iftop
toolbox ln -s toolbox /system/bin/insmod
toolbox ln -s toolbox /system/bin/ioctl
toolbox ln -s toolbox /system/bin/ionice
toolbox ln -s toolbox /system/bin/kill
toolbox ln -s toolbox /system/bin/ln
toolbox ln -s toolbox /system/bin/log
toolbox ln -s toolbox /system/bin/ls
toolbox ln -s toolbox /system/bin/lsmod
toolbox ln -s toolbox /system/bin/lsof
toolbox ln -s toolbox /system/bin/md5
toolbox ln -s toolbox /system/bin/mkdir
toolbox ln -s toolbox /system/bin/mount
toolbox ln -s toolbox /system/bin/mv
toolbox ln -s toolbox /system/bin/nandread
toolbox ln -s toolbox /system/bin/netstat
toolbox ln -s toolbox /system/bin/newfs_msdos
toolbox ln -s toolbox /system/bin/notify
toolbox ln -s toolbox /system/bin/printenv
toolbox ln -s toolbox /system/bin/ps
toolbox ln -s toolbox /system/bin/reboot
toolbox ln -s toolbox /system/bin/renice
toolbox ln -s toolbox /system/bin/rm
toolbox ln -s toolbox /system/bin/rmdir
toolbox ln -s toolbox /system/bin/rmmod
toolbox ln -s toolbox /system/bin/route
toolbox ln -s toolbox /system/bin/schedtop
toolbox ln -s toolbox /system/bin/sendevent
toolbox ln -s toolbox /system/bin/setconsole
toolbox ln -s toolbox /system/bin/setprop
toolbox ln -s toolbox /system/bin/sleep
toolbox ln -s toolbox /system/bin/smd
toolbox ln -s toolbox /system/bin/start
toolbox ln -s toolbox /system/bin/stop
toolbox ln -s toolbox /system/bin/sync
toolbox ln -s toolbox /system/bin/top
toolbox ln -s toolbox /system/bin/touch
toolbox ln -s toolbox /system/bin/umount
toolbox ln -s toolbox /system/bin/uptime
toolbox ln -s toolbox /system/bin/vmstat
toolbox ln -s toolbox /system/bin/watchprops
toolbox ln -s toolbox /system/bin/wipe