Encryption - LUKS / EDS / Cryptonite - Verizon Samsung Galaxy S 4

I recently upgraded from my S2, to the S4. I'm enjoying the snappiness, and as are we all, a bit disappointed by the locked down nature of it. One of the things I liked about my old phone was the ability to have an encrypted container for sensitive files. In particular, I was using LUKS Manager to mount encrypted folders and it worked perfectly. However the stock kernel on the S4 appears to lack the dm-crypt module, and I am therefore unable to use it on the new phone.
I've tried a few other things as well, including Cryptonite and EDS Lite (as well as the paid version), but ran into similar problems. With EDS paid version there is source available for the required kernel module, but it hasn't been built for the S4 yet, it seems.
I'm willing to get into some of the nitty gritty details, but I was wondering if anyone else had any success building dm-crypt or the eds module for the s4 yet. Or if anyone would have some resources that might be a good starting point so I could build them on my own.
Thanks!
(MJ7, rooted)
Edit:
After a bit more digging I found the LUKS Guardian project, which looks promising. (I can't post links yet, but google "android cryptsetup luksopen" and it should be the first result). Their binary is throwing a segfault when i try it, but I'll pull it down and play with it tonight at home to see if I can get anywhere.
I think our kernel may in fact have DM-CRYPT available, but for some reason it's simply not working. In LUKS when I attempt to mount a file, it thinks it successfully mounts (and creates a folder) but it when I unmount, anything I copied over is still there. I find it telling though that it will only "mount" a file with the correct password. So the encryption may be working, while the mounting is not. I'm very comfortable in linux so I'll poke around and see if there's anything I can glean from the terminal.

One step closer, but not quite there yet. I SSH'd in and started playing with the LUKS Manager app and have come to the conclusion that it's really the mounting that is causing problems.
LUKS Manager creates a shell script over in /system/bin/luks. I pulled this off and looked over it a bit, and managed to run the pieces one by one until I came to failure. Essentially what is happening is it's using busybox to do the following:
mknod
losetup
/system/bin/lm.cryptsetup luksOpen #Yay, I don't need to compile LUKS Guardian!
mkdir ${mount_path}
chmod 777 ${mount_path} # THIS FAILS
mount the mapper to the mount path
chmod 777 ${mount_path} # THIS FAILS
chmod 777 -R ${mount_path} # THIS FAILS
So what you're left with is an encrypted volume which mounts just fine, but is only readable by root. Permissions on ${mount_path} are 700 and neither busybox chmod nor standard chmod will change them. I've also tried mounting the mapper with the busybox mount as well as the builtin. Same result. Further, it looks like I'm unable to (as root) chmod pretty much anything.;
Frustrating, because I can clearly see that the data is there when I'm in a root terminal, but none of the apps can access it.
Anyone have any ideas on why I can't chmod? Or how to get mount to grant 777 in the first place?

spdqbr said:
One step closer, but not quite there yet. I SSH'd in and started playing with the LUKS Manager app and have come to the conclusion that it's really the mounting that is causing problems.
LUKS Manager creates a shell script over in /system/bin/luks. I pulled this off and looked over it a bit, and managed to run the pieces one by one until I came to failure. Essentially what is happening is it's using busybox to do the following:
mknod
losetup
/system/bin/lm.cryptsetup luksOpen #Yay, I don't need to compile LUKS Guardian!
mkdir ${mount_path}
chmod 777 ${mount_path} # THIS FAILS
mount the mapper to the mount path
chmod 777 ${mount_path} # THIS FAILS
chmod 777 -R ${mount_path} # THIS FAILS
So what you're left with is an encrypted volume which mounts just fine, but is only readable by root. Permissions on ${mount_path} are 700 and neither busybox chmod nor standard chmod will change them. I've also tried mounting the mapper with the busybox mount as well as the builtin. Same result. Further, it looks like I'm unable to (as root) chmod pretty much anything.;
Frustrating, because I can clearly see that the data is there when I'm in a root terminal, but none of the apps can access it.
Anyone have any ideas on why I can't chmod? Or how to get mount to grant 777 in the first place?
Click to expand...
Click to collapse
Since you're on MJ7, it's probably SELinux doing that to you.
You might try using chmod 555 (read + execute) to see if that's allowed.
What is the mount point that you're trying to use? Perhaps that's also being blocked by SELinux.

Thanks for the suggestions. I've poked around a bit at selinux, but with no hope of disabling it I'm not sure if I'll make it through the last hurdle. I've tried a few different mount points and a few different chmod permissions to no avail. I *did* however have one breakthrough, but now I'm just flat out puzzled.
I mounted it via the luks script I mentioned earlier, and then do a busybox umount on it (leaving the mapper in place). I then checked the mount options for my external sd card, since both it and the LUKS volume are vfat. I remounted the mapper using
busybox mount /dev/mapper/test /storage/extSdCard/test -o rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1023,fmask=0002,dmask=0002,allow_utime=0020,iocharset=iso8859-1,shortname=mixed,utf8
This mounts the drive with user, group, and permissions all set exactly like other file in the external SD card. However es file explorer and all other apps show the mount point as simply empty. If I'm not on command line, I can't see anything in it, which is utterly baffling to me.
From the terminal I can copy files out to another location (this is a luks volume I created on the old phone, so it already had data in it) and access them just fine via esfile explorer and various text editors.
The data is there, it's decrypted, it's accessible through command line, but all my apps simply refuse to acknowledge it.
Edit:
I'm not the only one experiencing this mounting phenomena... https://groups.google.com/forum/#!topic/android-kernel/JeY_u-pHcxQ
Edit:
According to this, android 4.2 made is so that application-created mount points are not globally accessible. They suggest a few workarounds which I have not yet had a chance to try. This certainly explains the problem though!

Related

Using all of the NTs storage

I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
One of the biggest issues I had with my nook was the 16/1GB division between content I can load and content from B&N/etc. Not being able to use that 16GB how I wanted was something I set forth to fix. Here is my solution to make this usable to non-rooted apps.
1) Root if not already rooted.
2) Make a directory inside of /data. I chose /data/usrdata.
3) remount / as RW with the command mount -o remount,rw -t rootfs rootfs / (credit to Indirect for this, as I could't find the command to do so)
4) mkdir /mnt/internal . We need somewhere to mount /data/usrdata/ and /mnt is public enough.
5) busybox mount -o bind /data/usrdata /mnt/internal. Mounts /data/usrdata to /mnt/internal.
6) For good measure, chmod 777 /mnt/internal and chmod 777 /data/usrdata.
Now, /mnt/internal should have whatever free space /data has, and should be read/write accessible from any program. A quick test with touch+terminal emulator shows new files as being created with RW permissions for all.
Alternatives: When I was initially thinking about ways to do this, my first reaction was to just open up /data to be read only to all, then have my usrdata folder be read/write all. However, I know part of android's app security model depends on some of these permissions. While I can't think of anything breaking or sensitive data being leaked, I decided against it. If anyone has any thoughts as to that scenario, I am very interested in hearing about it.
USB support: This will *not* be mountable under USB. Unfortunately you are still limited to transfering the data from a computer to the B&N internal storage or SDcard first, then moving the data internally. The problem that I see with this is similar to my understanding of the galaxy nexus situation, where the system can't unmount its /data partition and let the USB host take over. Another alternative to this could be to write an image file and mount that over usb (I've done this on my Evo, it worked so-so). Problem with that is that it really wouldn't grow/shrink with the storage. I suppose you could do some shell trickery and pipe it through gzip somehow, but that wouldn't help very much.
Let me know what you think and if you have any ways to improve this.
UPDATE: Persistance:
To make this persistant across reboots, run these commands as root:
1) mount -o rw,remount -t ext4 /dev/block/platform/mmci-omap-hs.1/by-name/system /system
2) echo mount -o remount,rw -t rootfs rootfs / >> /system/bin/clrbootcount.sh
3) echo mkdir /mnt/internal >> /system/bin/clrbootcount.sh
4) echo busybox mount -o bind /data/usrdata /mnt/internal >> /system/bin/clrbootcount.sh
5) echo mount -o remount,ro -t rootfs rootfs / >> /system/bin/clrbootcount.sh
All this does is put the following at the end of clrbootcount.sh
mount -o remount,rw -t rootfs rootfs / #Remounts root as RW. Root is regenerated at each reboot, so /mnt/internal is never going exist on a fresh startup
mkdir /mnt/internal #make /mnt/internal, see above
busybox mount -o bind /data/usrdata /mnt/internal #Binds the directory
mount -o remount,ro -t rootfs rootfs / #remounts root as RO. Unsure if this is necessary, but since it runs as RO, its probably better safe than sorry.
Thanks to eded333 for mentioning a good place for the script.
Click to expand...
Click to collapse
I was the one who wrote the script gameman. >.>'
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
this is a good work around
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Sent from my Nook Tablet using Tapatalk
Click to expand...
Click to collapse
That is correct, from what I understand as well.
Sent from my BNTV250 using Tapatalk
liquidzoo said:
Very nicely done.
Does Android possess a fstab? If so, could these changes (also) be made there and still be persistent?
Click to expand...
Click to collapse
From what I could tell, it does, but its not the normal /etc/fstab. It looks like they have a daemon or something that mounts the sdcard and the media (1gb) drive. When I first looked at its version of the fstab, it looked like it only took a block device, which doesn't quite work for the directory binding.
downsay said:
Am I understanding this correctly in that if I follow these guidelines I can move my data over to the Barnes and noble alotted storage that we were complaining about not having available?
Click to expand...
Click to collapse
Yes that is correct. You still cannot mount it under USB, however. If you have some other way of getting the files there, however, its open as an option. I've been using swiFTP (in the market) to do that. Could also copy and move from the media/sd cards that do mount to the PC, but thats a two step process. I've thought about getting MTP setup so that you can see that folder via USB, but haven't really had a chance to look into how that would work.
*Note, when using swiFTP and other programs more than likely, you may get some file permissions errors or other odd errors about corrupt files. These are just the file permissions that the program defaulted to, and can be fixed by doing a 'chmod -R 777 /mnt/internal/'. Don't have this problem on sdcard or media because they are just FAT32 formatted, which don't support permissions.
Trying to understand ...
gameman733 said:
I posted this in the nook touch forum by mistake. Please read below and let me know what you think.
Click to expand...
Click to collapse
I don't understand the purpose of the mounts. Why not just create /data/usrdata and put your stuff in there?
I know /data has "access-only/no-read" access for non-system apps, but anything in /data/usrdata/ should be visible (and no need to modify clrbootcount.sh).
If you need "/mnt/internal" (I don't see the need for that either), why not just use a soft link (which is permanent)???
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount. Using a simple link would be just as effective in this case.
However.. / is Read only. Even when remounted read-write, this filesystem is actually regenerated every boot. So nothing in /mnt would stay past the next restart.
The purpose for having it in /mnt (could have been anywhere, I suppose, but it seemed a little more appropriate) was for apps that can't browse /data. For example, gameboid and related programs would get to /data and show nothing, because you can't browse it as a non-rooted app. Having a symlink or bind mount elsewhere in the filesystem where they can browse helps with that. The alternative was to remove the no-browsing permissions from /data. I didn't feel comfortable with doing this, however, as I'm sure there are some security risks to doing this. It probably isn't a big deal, but since we have the tools to do it while maintaining those existing permissions, why not go ahead and do that?
Is there a solution that does not require being rooted?
[I was gonna start a thread about this 1.0 GB vs 16GB issue. Glad someone
beat me to it. ]
A day or two ago, I side-loaded a couple of movies, each about 400-MB in size,
and was surprised to notice that I had only 20% of my 1.0GB remaining.
I haven't 'bitten the bullet', and got brave enough to 'root' my Nook yet.
(Still not sure yet whether my wife will keep it, and it's an XMAS-gift for her.)
But, I'm quite fluent in Linux, so if we DO keep it, I'll definitely get around
to doing the 'root'.
Meanwhile, if anyone does find a way, without rooting, to re-allocate these
built-in assigned storage quotas, please post it in this thread.
Cheers...
gameman733 said:
The primary reason for using the mounts was that I was originally planning on trying to mount it in a way that would ignore file permissions, but didn't know at the time that you can't do that with a bind mount.
Click to expand...
Click to collapse
To solve this issue I've compiled fuse kernel module and bindfs userspace utility. Bindfs is similar to "mount -o bind" but can override permissions and ownerships. I can share how-to instruction and compiled binaries if you want

RW and RO mount shortcuts.

Okay, I got sick of typing
Code:
mount -o remount,rw /dev/block/mmcblk0p12 /system
or
Code:
busybox mount -o remount,rw /system
to mount the /system partition in RW mode so I created two very simple scripts that you can run through Script Manager to Mount RW and Mount RO.
I do quite a bit from ADB and I just found it more convenient to tap a shortcut on my home screen to mount the /system partition.
With the help of imchairmanm, I have fixed the scripts to be available globally, so all you have to do is type "mountrw" (without the quotation marks) to mount the /system partition in Read/Write mode, and type "mountro" (again, without the quotation marks) to mount the /system partition in Read Only mode.
So, now it can be run both ways!
Installation:
1. You must be rooted. (See my HowTo: Root your Motorola Droid X2 tutorial.)
2. You must have Busybox installed. If you are rooted, you have busybox installed. I've tested the scripts on BB 1.18.2, 1.19.2 and 1.19.3.
3. Download the mounts.zip file and extract it to a folder on your SDCard (internal or external, it doesn't matter). I use /mnt/sdcard/Scripts/Mounts/.
3. Download Script Manager from the market.
4. Open the Script Manager app and navigate to the folder you put the mount scripts in.
5. Tap the first mount script (mountro).
6. Tap the star and the Android superuser icon next to it. This configures the script as a favorite and to run the script as root.
7. Tap SAVE.
8. Repeat steps 5 through 7 for the second mount script (mountrw)
9. Now you can run each script from within Script Manager, or create shortcuts to them on your home screen.
To create the shortcuts, do the following:
1. Long press a blank area on your home screen and select Widget.
2. In the Choose Widget popup, scroll down to Script Manager Ads (if you have the free version) and tap it.
3. In the list, tap the mountro script. This will place the shortcut on your home screen.
4. Repeat steps 1-3 for the mountrw script.
Now, when you need to mount /system as RW all you need to do is tap the mountrw script, then when you are done, either reboot, or tap the mountro script.
The following is the code for each of the scripts:
mountro:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Only which is the default when
# Android is booted.
echo "Mounting /system in Read Only mode!"
busybox mount -o remount,ro / 2>/dev/null
busybox mount -o remount,ro rootfs 2>/dev/null
busybox mount -o remount,ro /system 2>/dev/null
echo "Done!"
mountrw:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Write in order to modify or add
# files to the /system file system.
echo "Mounting /system in Write mode!"
busybox mount -o remount,rw / 2>/dev/null
busybox mount -o remount,rw rootfs 2>/dev/null
busybox mount -o remount,rw /system 2>/dev/null
echo "Done!"
It's simple and no frills... The way I like it.
Alternative install:
I didn't realize it, but, I had already made a flashable zip. Just download mount_rw_ro-V1.1.zip and boot into the BSR and flash it from there.
If anyone has any suggestions, I'm open to them! Let me know!
Ciao!
Hm, I was curious since you said you couldn't get your scripts to run globally, so I tried them out by putting them in /system/xbin. After adjusting permissions and making sure owner and group were root, they ran fine and globally as-is. I wonder if the simpler version you started with would have worked or not?
imchairmanm said:
Hm, I was curious since you said you couldn't get your scripts to run globally, so I tried them out by putting them in /system/xbin. After adjusting permissions and making sure owner and group were root, they ran fine and globally as-is. I wonder if the simpler version you started with would have worked or not?
Click to expand...
Click to collapse
did you run them from /system/xbin? I put them in /system/xbin and then cd / to get back to root and tried to run them. They are not found.
Code:
# cd /system/xbin
cd /system/xbin
# pwd
pwd
/system/xbin
# ls -l mount*
ls -l mount*
lrwxrwxrwx root root 2011-12-05 13:08 mount -> /system/xbin/busybox
lrwxrwxrwx root root 2011-12-05 13:08 mountpoint -> /system/xbin/busybox
-rwxrwxrwx root root 316 2011-11-06 19:04 mountro
-rwxrwxrwx root root 328 2011-11-06 19:04 mountrw
# cd /
cd /
# pwd
pwd
/
# mountro
mountro
mountro: not found
# sh mountro
sh mountro
sh: Can't open mountro
#
That was the problem I was running into. I even tried sh mountro. The error "Can't open mountro" essentially means it can't find it.
If this is what you did, and you had different results, I would love to find out why. Thanks!
Ciao!
Yeah, that's what I meant by they are available globally. I can run them from anywhere in the filesystem. I'm not sure what the difference is. Mine have owner and group set to root and the applicable permissions set as well.
It runs through the script correctly, I get all of the echo messages, and if I cd to system afterwards, everything is rw or ro as it should be. I don't know what other information would be helpful for you, but I'll answer whatever other questions you might have. I don't quite understand why it'd ever have a problem with your scripts in the first place. It seems like a strange thing to happen.
Edit: I just ran through and ran the same commands as you did and they were all successful. It sounds like maybe something isn't right in your $PATH? That's the only thing I can think of. What does it say when you type "echo $PATH"? Either that or something with your terminal emulator or rom? Have you tried a different terminal? It shouldn't matter but you never know.
imchairmanm said:
Yeah, that's what I meant by they are available globally. I can run them from anywhere in the filesystem. I'm not sure what the difference is. Mine have owner and group set to root and the applicable permissions set as well.
It runs through the script correctly, I get all of the echo messages, and if I cd to system afterwards, everything is rw or ro as it should be. I don't know what other information would be helpful for you, but I'll answer whatever other questions you might have. I don't quite understand why it'd ever have a problem with your scripts in the first place. It seems like a strange thing to happen.
Edit: I just ran through and ran the same commands as you did and they were all successful. It sounds like maybe something isn't right in your $PATH? That's the only thing I can think of. What does it say when you type "echo $PATH"? Either that or something with your terminal emulator or rom? Have you tried a different terminal? It shouldn't matter but you never know.
Click to expand...
Click to collapse
I dunno what is going on. My path shows /system/xbin. Oh, I'm on Eclipse 1.3 (but that shouldn't matter)... Oh well.
Code:
# echo $PATH
echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
It happens from the adb shell and from the terminal program on my DX2.
Hm. My $PATH is the same except it also includes /data/local/bin. That shouldn't matter. I'm on eclipse too and running the commands from the terminal in eclipse parts. I don't know why something in the path wouldn't execute. Does "which mountrw" find it? I had a problem earlier where I thought it wasn't finding a script I wrote, but it actually was failing at the first line because I had the wrong path to sh listed. If which finds your scripts I'd say it's more likely something with the script rather than the system. I'd also try writing a little hello world script and seeing if you can get that to execute globally too.
imchairmanm said:
Hm. My $PATH is the same except it also includes /data/local/bin. That shouldn't matter. I'm on eclipse too and running the commands from the terminal in eclipse parts. I don't know why something in the path wouldn't execute. Does "which mountrw" find it? I had a problem earlier where I thought it wasn't finding a script I wrote, but it actually was failing at the first line because I had the wrong path to sh listed. If which finds your scripts I'd say it's more likely something with the script rather than the system. I'd also try writing a little hello world script and seeing if you can get that to execute globally too.
Click to expand...
Click to collapse
Aw, CRAP! I've run into this problem when I develop on a Windows machine and try to run it on a linux box... ARGH! Thank GOD I use gvim. I was able to change the file format from DOS to UNIX, then save it and push it back out to /system/xbin. chmod'd it to 777 and ran mountrw/mountro and they work now... How can I be so friggin' dense... I know better than that...
Oh, to answer your question on the which command, yes, which finds them both.
What clued me in was you saying that the problem might be with the script. Thanks! It FINALLY works! I've updated the OP with the corrected files.
Also, does anyone want me to make this a flashable zip? Let me know.
Ciao!

[SOLVED] "sh: applet not found" after BusyBox install

Background: On a rooted device, I installed busybox via the BusyBox Pro app, with the "symlinks" option checked. Afterwards, wifi stopped working, root stopped working, adb stopped working, and a lot of tasks started failing with "sh: applet not found".
The problem: BusyBox Pro 8.0 replaces /system/bin/ash with a symlink to busybox. This was problematic on my device, where /system/bin/sh was a symlink to ash, so now 'sh' is actually calling busybox, and this particular compilation of busybox didn't have 'sh' support compiled in, hence the "sh: applet not found" error everytime anything tried to call sh, which as it happens, is a lot! The bug was fixed quickly with a 8.1 release, but due to suspected caching policies on the Google Store, a lot of people still got the old release even after this was fixed!
Here's how I fixed this:
Prerequisite: You'll need a replacement sh binary. On another device, which was also an ARM device, sh was symlinked to 'mksh', and I just took this. You might want to verify that the binary works on your broken device before completing the final steps below.
Initial Wifi
It's only DHCP that is failing (on the "Obtaining IP address..." step), so go into your Wifi Settings, forget the network, add it again, and change DHCP to "static", manually fill in the appropriate IP info for your network, and you'll be good to go (encrypted network is fine).
Getting a Root terminal
Download KBOX from http://kevinboone.net/kbox.html
In KBox, menu -> more -> preferences, change shell -> "command line" to "/system/bin/ash"
su -s /system/bin/ash
Remounting /system as RW
In theory, all you should need to do is: busybox mount -o remount,rw /system
This didn't work for me, and I got a "permission denied (are you root)" error, I guess because the system was no longer booting properly. I had to redo some of the steps involved in rooting my device, in my case:
On phone:
mkdir /data/local/lib
echo ro.kernel.qemu=1 > /data/local.prop
reboot
(wait for reboot, and get into a root terminal again as per the above)
On PC (from previous files used for rooting my device):
adb push lsm_disabler.ko /data/local/lib/
Oh phone:
insmod /data/local/lib/lsm_disabler.ko
rm /data/local/lib/lsm_disabler.ko
cat > /data/local.prop
From this point, I was able to remount successfully:
mount -o remount,rw /system
Fixing sh
Now on your PC, push the replacement binary to /system/bin, in my case:
adb push mksh /system/bin
On phone:
cd /system/bin
busybox ln -sf sh mksh
Verify now that "./sh" gives you a working terminal.
If all is good:
mount -o remount,ro /system
reboot
All done! Wow, this saved me sending my device back to Japan, since it's still using the stock bootloader and there are now available update.zip's out there. Good luck everyone, feel free to ask questions :>
P.S. I'm going to contact BusyBox Pro's author now with some suggestions to prevent these kind of problems happening in the future.
Deleted.
Deleted.
I rant into the same problem on my Galaxy Tab. Thanks for this, it saved my day!
A little correction to this little thing:
Kinslayer81 said:
On phone:
cd /system/bin
busybox ln -sf sh mksh
Click to expand...
Click to collapse
This worked for me:
cd /system/bin
ln -sf mksh sh
chmod 755 sh
Thank you
Just want to say thanks.
Your Posting helped me out with the Problems on my htc flyer.
I installed BusyBox Pro by Stephen (Stericson) to fix a missing symlinks problem that I had after installing JRummy's Busy Box. I then encountered the applet not found problem and then just reinstalled JRummy's version and it fixed it without having to do anything else.
Kinslayer81 said:
Background: On a rooted device, I installed busybox via the BusyBox Pro app, with the "symlinks" option checked. Afterwards, wifi stopped working, root stopped working, adb stopped working, and a lot of tasks started failing with "sh: applet not found".
The problem: BusyBox Pro 8.0 replaces /system/bin/ash with a symlink to busybox. This was problematic on my device, where /system/bin/sh was a symlink to ash, so now 'sh' is actually calling busybox, and this particular compilation of busybox didn't have 'sh' support compiled in, hence the "sh: applet not found" error everytime anything tried to call sh, which as it happens, is a lot! The bug was fixed quickly with a 8.1 release, but due to suspected caching policies on the Google Store, a lot of people still got the old release even after this was fixed!
Here's how I fixed this:
Prerequisite: You'll need a replacement sh binary. On another device, which was also an ARM device, sh was symlinked to 'mksh', and I just took this. You might want to verify that the binary works on your broken device before completing the final steps below.
Initial Wifi
It's only DHCP that is failing (on the "Obtaining IP address..." step), so go into your Wifi Settings, forget the network, add it again, and change DHCP to "static", manually fill in the appropriate IP info for your network, and you'll be good to go (encrypted network is fine).
Getting a Root terminal
Download KBOX from http://kevinboone.net/kbox.html
In KBox, menu -> more -> preferences, change shell -> "command line" to "/system/bin/ash"
su -s /system/bin/ash
Remounting /system as RW
In theory, all you should need to do is: busybox mount -o remount,rw /system
This didn't work for me, and I got a "permission denied (are you root)" error, I guess because the system was no longer booting properly. I had to redo some of the steps involved in rooting my device, in my case:
On phone:
mkdir /data/local/lib
echo ro.kernel.qemu=1 > /data/local.prop
reboot
(wait for reboot, and get into a root terminal again as per the above)
On PC (from previous files used for rooting my device):
adb push lsm_disabler.ko /data/local/lib/
Oh phone:
insmod /data/local/lib/lsm_disabler.ko
rm /data/local/lib/lsm_disabler.ko
cat > /data/local.prop
From this point, I was able to remount successfully:
mount -o remount,rw /system
Fixing sh
Now on your PC, push the replacement binary to /system/bin, in my case:
adb push mksh /system/bin
On phone:
cd /system/bin
busybox ln -sf sh mksh
Verify now that "./sh" gives you a working terminal.
If all is good:
mount -o remount,ro /system
reboot
All done! Wow, this saved me sending my device back to Japan, since it's still using the stock bootloader and there are now available update.zip's out there. Good luck everyone, feel free to ask questions :>
P.S. I'm going to contact BusyBox Pro's author now with some suggestions to prevent these kind of problems happening in the future.
Click to expand...
Click to collapse
This helped get my wifi back after flashing a kernel.
Hey there,
I've got the same problem.
After reinstalling the ROM everything works fine,
but when I try to install busybox, I get the same failure everytimes.
How can I prevent it?
Do I have to follow the steps above?
And where do I get the sh binary from?
Sorry guys, I'm a little confused and hope you may help me..
Thanks!!
Kbox not open in my ics when I open it its automatically closed
And i want to ask the script su -s /system/bin/ash where i put this script

[Q] HTC One refuses to mount /system as rw

Hi,
I've been Google'ing all over and now am really stuck
I have an HTC One with Android 4.2.2 installed on it and the phone is ROOTED
I want to do something really simple however, due to a puzzling Busybox install I keep getting caught out!
So here's the issue; I want to install Archlinux on the phone in a chroot... documentation is here:
<can't post link>
no probs
Though the issue I'm facing is wget can't resolve host, I try nslookup and get the internal loopback address of the phone "127.0.0.1/localhost".
This seems to be due to no resolv.conf file existing in /system/etc... using information described here:
<can't post link>
I attampted:
Code:
mount -o remount,rw -t yaffs2 /dev/block/<output from mount cmd> /system
mount -o remount,rw /system
mount -o rw,remount /proc /system
these seem to work for a while as "mount" shows /system being rw..... only after a while this seems to revert back to ro?
Additionally if I try installing anything like Busybox from Stephen Stericson the phone just crashes and reboots itself?? - using both "normal" and "smart" install methods.
Busybox X seems to work well for the current runtime, however, after reboot it's gone?
I have absolutely no idea how to solve this as I've been reading and reading and reading and the closest thing I came up with is a watchdog timer mentioned on a Sony handset but then if there is such a thing on my HTC how to find the pid to kill it?
Unfortunately standard *NIX commands don't really seem to work well, ie.
Code:
ps aux | grep watch
so I have no idea how to even begin finding it.
I have tried using various GUI apps additionally which also just reboot the phone when checking the "remount /system rw" option.
Has anyone got any advise or suggestions that could help me win the battle??
Many thanks.
.....well I hope this helps someone now but found an app called: HTC One RW which did the trick!
Busybox installed properly, nslookup worked and now running shell script to install Archlinux

Lilipop (CM12) mounting a filesystem as root (not accessable to any other user)

I have liliopop CM12 installed on my Note3, I have a encrypted partition, which I mount using luks, I have the mount working now with out issues so the encrypted part can be ignored, if any one is interested I can explain how I did what I did and post the actual scripts used.
The problem is that if I su - from juicessh and then mount the partition the partition is mounted, but only the juice su'ed user can see it. I can log this user out and back in and still see it, but only this users sees it.
For instance
$whoami
10211
#su -
0
#exit
$whoami
10211
now if I run:
$su -l --shell /system/bin/sh -c 'mkdir /storage/sdcard2 ; chmod 777 /storage/sdcard2 ; mount -t ext4 /dev/sda1 /storage/sdcard2 ; df ; exit' ; df
Now this will show that /storage/sdcard2 is mounted when I'm root
when I'm non-root (AKA not ID 0) then I do not see the mount.
Now I login as root using sshdroid:
#whoami
root
#df
does not show sdcard2
Lastly via "Root explorer":
does not see anything mount in /storage/sdcard2 either.
So the issue I'm facing is that I can mount a partition as root and access it, but only as the user I mounted it as, in fact what even makes less sense is that root via sshdroid and root via juicessh can not see what the other user did (mount wise), though if I create a root accessible file that is fine. I used to do this is CM11 using the same commands (different mount points do to the OS change) without any issue. It is as if each root user is unique which is fine on the surface, but since I need access to this encrypted partition, only when accessing documents for work, which normally it is not mounted, but once mounted I need it to be accessible as any other sdcard. Any suggestions?
Thanks,
ERIC
Partly working
I got it partly working if I disable "Mount namespace separation", however I still have an issue that /storage/emulated/0 does not exist, until I use a program like Root Explorer, I mean it exists, but the shell script can not change to it (mount point not found exception), I'm assuming this is also something to do with Lilipop, but I'm not sure what or how to resolve it.
ERIC
Hi,
I state that they are not very knowledgeable about linux commands.
I have installed on my SM-G900F ROM cm12 and it works!
I created a second user, but it does not have root privileges.
I would like, however, to know how you can create a secono user with root privileges?
Thanks for the reply

Categories

Resources