1

I think I've bricked my device (Huawei G330, U8225-1). I was adb pushing while I received a "push failed: no space left on device". The phone boots in recovery, I've root but the bootloader is locked.

If I try to push an update to SDCARD/dload it says "no such file or directory", if I try to adb shell it says "exec '/system/bin/sh' failed: Permission denied (13) -"

What can I do?

2 Answers 2

2

That's a soft brick, for the reasons below:

  • Handset is still powering on
  • adb is responding
  • handset recognizes usb cable plugged in (how else were you able to adb?)
  • handset recognizes the sdcard

Look at this question to see Izzy's answer on what is classified as a "brick".

Something went awry there and it clobbered the recovery environment... mind giving a bit more details...?

Edit

From the comments below, it transpires that the OP pushed over the shell binary file sh from the root of the phone, (either overwriting it and or/had incorrect permissions) and ended up with a "locked-out" of executing shell commands and fail.

By the way, there is no way to set the permission as the sh interpreter does not have the appropriate permission for executable bit! So executing any commands on that will fail.

The only remedy is to re-flash the recovery image directly onto the recovery partition, by going into fastboot mode on the handset, usually Power+Volume up, armed with a fastboot binary that must be entered on either the Linux's terminal or Windows's cmd, i.e. two operating system environments, choose one of your own preference:

Linux

sudo fastboot flash recovery recovery.img

Windows

fastboot-win flash recovery recovery.img

That will restore the recovery environment and then the shell interpreter should work from within adb shell session next time recovery gets booted into.

6
  • It seems like system/bin/sh hasn't the permissions to run. Due to this I can't "adb shell" anything. Any thoughts? Commented Jan 21, 2013 at 19:27
  • What were you adb pushing? BTW try free up space on SDCard and try again?
    – t0mm13b
    Commented Jan 21, 2013 at 19:28
  • I think I did a mistake and pushed the system/bin/sh file. Why sdcard? Commented Jan 21, 2013 at 19:28
  • Oh! Now that explains why you got the error message: exec '/system/bin/sh' failed: Permission denied (13) - Were you pushing that onto the actual recovery partition or onto SDCard? Where abouts were you exactly when you tried to execute the sh, SDCard has the executable permission blocked at filesystem level...
    – t0mm13b
    Commented Jan 21, 2013 at 19:30
  • I was at the root of the phone, and I was pushing on the recovery partition. Commented Jan 21, 2013 at 19:38
0

I powered off my system by holding the power button for few seconds (ignored the power dialog on screen) and after booting into Android (4.2.1), I started receiving the error:

- exec '/system/bin/sh' failed: Permission denied (13) nRet(-1) 

when trying to run adb shell. I also couldn't connect to Android over the network using SSH shell since the connection terminated just after entering the credentials.

What's more? Apps couldn't get root access (not granted), so it felt like device has been unrooted.

By the very nature of the error, I suspected a stripped permission issue and since I luckily had a custom Recovery installed I booted into it.

  1. TWRP recovery has an option to fix permissions. I don't know whether it may rectify the issue, but since I have CWM installed I proceeded for the next step.
  2. I mounted System and entered adb shell.
  3. Running ls -l /system/bin/sh resulted in:

    lrwxrwxrwx    1 root     root             4 Jun 26 12:47 sh -> mksh
    

    It seems that sh has executable permission for everyone but it is a symlink so I proceeded for actual binary (mksh).

  4. Running ls -l /system/bin/mksh resulted in:

    -rw-rw-rw-    1 root     shell       157456 Apr 24  2013 mksh
    

    One can see that few x are missing i.e. the file has no executable permission for anyone.

  5. I ran chmod +x /system/bin/mksh and the final result of ls -l /system/bin/mksh was:

    -rwxrwxrwx root     shell      157456 2013-04-24 13:48 mksh
    

    I assumed mksh to be the only cause of "Permission denied" error, so I proceeded for "root access not granted" issue.

  6. Rather than trying to find and fiddle with the issue I flashed su binaries again using CWM's inbuilt option.
  7. I booted into Android and everything felt normal again. :)
1
  • 1
    In my case adb reboot <PARAM> was working fine.
    – Firelord
    Commented Jun 26, 2015 at 14:05

You must log in to answer this question.

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