I did something incredibly stupid today. I renamed /system/bin/sh to /system/bin/sh.old.bak on my rooted Huawei y536a1 running 4.4.3 KK. I was going to install a app I thought might overwrite it and wanted a backup. I intended to copy it to another location in the path or link it, then rename in bin. In my haste, I simply renamed it and couldn't install app w/o shell, lost root, thus eliminating any easy method I know of to fix. I rooted with kingroot (not kingo) because I currently do not have a computer. I have no system backup, foolish, I know. I do have the original factory .img file, a pre-rooted .img file, (the only way to properly root and install a recovery) twrp recovery and a code to unlock the bootloader. Since I didn't have a computer I used kingroot. The phone is still functional. Unfortunately I don't know what to do now. I have limited linux knowledge (obviously). I am afraid to reboot, not knowing what will happen. I can get access to a computer. The file needs to be renamed, but I lost write access to the system. Is there anyway to use adb to rename or push another file on there, or fix by rebooting into recovery? I would prefer a solution the wouldn't wipe my phone, but I realize my options are quite limited. I don't even know if a factory reset or flashing either of the images will work. Any help/advice is greatly appreciated.

  • Boot into TWRP, mount system partition: use either its console to rename the file or use file browser of TWRP to go /system/bin, choose the file and rename it. You can also use Aroma File Manager there.
    – Firelord
    Commented Mar 16, 2016 at 16:49
  • 1
    Sorry, I should have been more clear. I have the TWRP file, but not installed, because as far as i know, you had to root via ADB to install TWRP.
    – user156418
    Commented Mar 16, 2016 at 17:09
  • 1
    No, that is unnecessary complication you're thinking of. I see that your device supports flashing from fastboot. You can use fastboot to flash or directly boot into TWRP using your PC. No need for root. Once in TWRP, follow my first comment. // A caveat: if the bootloader is not already unlocked, you'll have to unlock it and that would cause a full data wipe (akin to full factory reset).
    – Firelord
    Commented Mar 16, 2016 at 17:14
  • Since @Firelord said that your phone supports flashing from fastboot, I'll tell you how to write a small, flashable package to rename the sh.old.bak.
    – Grimoire
    Commented Mar 16, 2016 at 18:10
  • @Firelord, Thank you for the info. I was afraid I would have to unlock the bootloader and wipe in the process.
    – user156418
    Commented Mar 16, 2016 at 19:45

1 Answer 1


I'll now guide you through the procedure of writing a custom flashable ZIP, for the purpose of renaming your sh.old.bak. To begin, create the following tree of folders:


Once you created them, move to the android folder, and create the following new files. Make sure that they don't have any extension at their end:

  • updater-script
  • update-binary

Leave the first one blank, and proceed by editing the update-binary as follows:

mount /system
mount -o remount,rw /system
mv /system/bin/sh.old.bak /system/bin/sh
umount /system

Save this content (in the update-binary), open your favourite zipping tool, and create a compressed archive out of the META-INF folder. Its content should be automatically included. Make sure that the archive type is set to ZIP, and select the lowest possible compression level.

Finally, flash this script to your device with:

fastboot update name_of_your_zip.zip

As guessable, the third parameter should be the name (and path) of the ZIP you created. In short, the ZIP should mount the /system partition in read-write mode, rename your sh.old.bak to sh, and unmount the /system partition.

  • Of course, my answer is to be followed in the case your bootloader is unlocked, as @Firelord pointed out.
    – Grimoire
    Commented Mar 16, 2016 at 18:36
  • Sorry I couldn't reply sooner and save you some time, but I didn't unlock the bootloader and I'm pretty sure it's still locked. I will certainly use your excellent looking script if it is. Unfortunately I think I'll have to unlock it and wipe my phone. On the plus side now I can root properly and take full backups. Thank you for your script and help. I will work on this tonight. Firelord - Death Mask Salesman, thank you both for your help, I greatly appreciate it. - JC
    – user156418
    Commented Mar 16, 2016 at 19:59
  • @user156418 If you don't feel like unlocking the bootloader right now, and you can root, your best choice is to find a root explorer (try the Root Browser app). Once provided with superuser privileges, it will allow you to navigate to /system/bin and rename your file.
    – Grimoire
    Commented Mar 16, 2016 at 20:05
  • I still have the original app that rooted my phone installed as it is also the superuser application (kingroot). I also have root browser and es explorer with root file manager. I am concerned that such an essential prg as "sh" is that I run the risk of bricking my phone if I try to re-root. After I renamed "sh" I immediately lost root for the first time ever. I don't know enough about Android/linux to know if that would work or not. Any thoughts?
    – user156418
    Commented Mar 16, 2016 at 20:46
  • @user156418 Can you browse the /system partition, at the moment? If yes, then search for the su binary in the /system/xbin directory. If the file is present, then download Busybox from the Play Store, install it (and its binaries from the app). It'll work as a surrogate of the main sh, allowing you to restore the real one.
    – Grimoire
    Commented Mar 16, 2016 at 20:54

You must log in to answer this question.

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