Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

HTC Magic, rooted with CyanogenMod 5. Tried to install busybox using "Busybox Installer" from the Market, ended up with a strangely borked system. Android does not boot, freezes on the splash screen. ADB shell, however, works. On the other hand, almost none of the commands work.

The busybox file is in /system/xbin, it seems. However, whenever I call it, I get "Permission denied". Even after sudo.

Running common commands like ls, cp, ln gives the same error message: "permission denied". Seems like those are symlinks to busybox, which is borked, see above.

/system/bin/toolbox is there, but it refuses to do most useful commands with a uniform message "No such tool". Ls, cp, mount, chmod, chown - "No such tool". Experimentally I found that set, ps, kill, reboot work. Is there a list of toolbox commands out there?

The only message of relevance in logcat is "02-02 01:36:38.280: E/logwrapper(61): executing /system/xbin/busybox failed: Permission denied". I kinda knew that.

I can write to the SD card. Is there a way to reflash the busybox while making it executable?

Is there an executable file anywhere on /data, so that I could push a copy of busybox there?

I can reboot into recovery mode, which is Android's own recovery mode.

Any ideas how to bring the system back to usable state? The phone is a scratch phone, so data loss is not an issue - there's no good data there.

It seems like making busybox executable somehow would bring everything back. I'm utterly lost, however, how to do that. And I'm rather surprised toolbox won't support chmod.

EDIT: funny data point. When I boot into recovery, I still can do ADB shell. And I get a completely different environment - there's command line with ls, busybox (!) and stuff. /system is almost empty. From that environment, can I somehow go back to the regular /system? The mount command is available.

share|improve this question
    
If you can flash a custom recovery, it may have a "fix permissions" option. CWM does. –  Matthew Read Feb 2 '12 at 2:45
    
Off the top of my head, you could try pushing a busybox binary to /data/local and then using it to chmod the one that's in /system/xbin. –  eldarerathis Feb 2 '12 at 2:45
    
@eldarerathis: when I push busybox to /data/local, it won't become executable. And I have no chmod at my disposal. –  Seva Alekseyev Feb 2 '12 at 2:50
    
Oh right, it won't have executable permissions after being pushed. Custom recovery might be a good bet then, as @MatthewRead mentioned. –  eldarerathis Feb 2 '12 at 2:52
    
@eldarerathis It does, but RM requires a booted device ;). Seva, can you su while adb-ing in recovery? That might make everything visible. On my Vibrant the "environment" is exactly the same as normal when in recovery, so I would hope it's not actually different for you either. –  Matthew Read Feb 2 '12 at 2:56
show 2 more comments

1 Answer

up vote 1 down vote accepted

Yay, the phone boots again.

Here's the magic recipe.

Boot into recovery.
adb shell
mkdir /data/s
mount -o rw -t yaffs2 /dev/block/mtdblock3 /data/s
chmod 755 /data/s/xbin/busybox
Reboot the phone.

My shell is back. There's a weird quirk now - ls (from the busybox, one assumes) thinks ADB is an ANSI terminal and tries to emit ANSI escape sequences. Still, yay.

share|improve this answer
    
That was my guess - that the permissions were not set to allow busybox to actually execute by the normal user. –  Broam Feb 2 '12 at 13:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.