[Kindle Fire General] chryptic:
How I fixed /system permissions

Like so many others, I jumped right into rooting my Fire and attempting to get the market installed. And promptly bricked it.

First lesson; Don't root when tired.

I was tired and the vending.apk was just not wanting to copy to /system/app. I tried a bunch of things and the end result was a friendly boot loop.

Looking everywhere I found this XDA thread.

It was a start but ultimately failed for me. There are a lot of suggestions but little in the way of explination.

Through a lot of trial and error I finally worked out what was going on and why the solutions were working for others and not for me.

So what did I do to cause brickification? I set the permissions on /system to 004. Really. I was tired and it was done and crashing before I knew it. I panicked and forgot what I had even done until after I fixed it. But now it all makes sense why the other fixes failed for me and judging by a lot of other posts, I am not the only one to pooch the /system directory permissions.

So why can’t I run adb shell?

When the Fire is going through its loop it first tries to boot normally. During this phase if you run adb devices you will see:

List of devices attached
0E56xxxxxxxxxxxxxx device

If you then run adb shell you will get the error:

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

So the permission have been changed for either /system, /system/bin, or even sh itself.

When the Fire is not able to boot normally then it will boot into recovery. You will get the recovery message on the screen:

Your Kindle has detected a problem and must clear app storage. The recovery process will erase some applications and data from your device. Apps from the appstore are stored in the cloud and can be reinstalled later.
This will reset your kindle to its original factory settings. you will need to re-register your kindle prior to downloading items from your Amazon account.
Please press power button to proceed.

Running adb devices will give you this:

List of devices attached
0E56xxxxxxxxxxxxxx recovery

Running adb shell now give the error message:

- exec '/system/bin/sh' failed: No such file or directory (2)

The Fire’s recovery image has almost nothing in it, and that includes not having a shell program like sh.

Steps I took to fix mine.

Things you will need:

1. Factory cable.

There are plenty of places where you can order one. I made a factory cable adapter using a USB mini B to micro adapter. All you have to do is solder a wire from pin 1 (+5v) to pin 4.

2. A recovery image that has the sh program.

I used the clockwork recovery image file (updaterecovery.img) found at http://xdaforums.com/showthread.php?t=1368012.

3. A Fire recovery image file (recovery.img).

If you are running 6.2 you can get the update file from Amazon http://www.amazon.com/gp/help/customer/display.html?nodeId=200790620. Just rename the file from .bin to .zip and extract the recovery.img file.

Or download the “The KF's stock recovery” from http://xdaforums.com/showthread.php?t=1368012.

Now we fix this thing:

1. Connect the Fire with the factory cable/adapter.

2. Flash the clockwork image to the Fire.

fastboot -i 0x1949 flash recovery updaterecovery.img

3. Switch to a normal USB cable.

4. Reboot the Fire by holding the power button in for ~20 seconds.

5. Wait for the Fire to finish booting into recovery mode.

You will now see the clockworks menu.

6. Now adb shell will work.

adb shell

*Note: If the prompt is a dollar sign “$” then you are not running as root.

Run this command:

$ su

The prompt should change to a pound sign “#”.

7. Now fix the permissions on /system.

# chmod 755 /system
# exit

*Note: You may have to exit a second time to get out of the shell

8. Switch back to the factory cable.

9. Reboot the Fire by holding the power button in for ~20 seconds.

10. Restore the recovery partition.

fastboot -i 0x1949 flash recovery recovery.img

11. Remove the USB cable.

12. Reboot the Fire by holding the power button in for ~20 seconds.

If all goes right then you will be up and running again.

I did a lot of things before finally fixing my Fire so the steps above are distilled from everything I did. I hope they are correct.