To Unlock Your Phone - General Topics

Unlocking your phone by code free network tested on several Samsung
The phone is set in debug mode or debugging mode and connected to the computer to type in the console (cmd)
- Adb shell
Enter your (If you get an error when typing "su" and says permission denied, jump down,
*** 1 ***) and give root permission on the phone later in this order must type the following commands (** * 2 ***)
cd /
mount o remount rw /
mkdir / efs
mount-or nosuid, ro, nodev-t vfat / dev / block / STL5 / efs
cat /efs/mits/perso.txt
Check the attach file

Thanks

Related

[Q] Prolly need partitioning, need advice. Tf101g

To those of you who followed link here: don't rush ahead and execute adb command. Read the thread in its entirety, since it contains typos and trial n error.
Gl, hf
Hi. I've been stupid. U may flame me but plz also provide some advice to swallow it with.
I followed bad advice and flashed cwm 5xxxx. After that tried to run superwipe, which got stuck after a few steps. To my horror i realized i had run it from internal. Of course it wiped itself and i got stuck mid-partinioning i think.
Since cwm don't read ext sd i tried to push new recovery via easyflasher, but i can't seem to get a driver that lets my pc interact with the device.
Instead discovered i have adb acess if connected when device is in cwm. From there tried to run PERI v 0.4. At first step, trying to push recovery i get a message of no space available. I think this is due to borked partitioning with superwipe. I guess I can repartition with cwm, but now I've messed so much up I don't wanna do anything more without proper advice.
Thanks
bump
If you have adb access, then use it to push a new rom.
"adb push {shiny new rom or recovery} /sdcard/"
You might have to change /sdcard/ to whatever cwm 5x uses?
Then you can just flash it from cwm.
EDIT: I just saw that you have the tf101G - it might work, but you probably have to find the right rom or recovery.
sent from my transformer
gee one said:
If you have adb access, then use it to push a new rom.
"adb push {shiny new rom or recovery} /sdcard/"
You might have to change /sdcard/ to whatever cwm 5x uses?
Then you can just flash it from cwm.
EDIT: I just saw that you have the tf101G - it might work, but you probably have to find the right rom or recovery.
sent from my transformer
Click to expand...
Click to collapse
Good advice, problem is that im not very savvy. How do i execute that command and what if i need to repartition the internal sd?
When running oneclickrecovery i get following prompts:
Uh-oh! I'm softbricked or have a recovery-bootloop! D:
Never fear sir and/or madam! PERI is here! -trips-
Adb needs to be fully working for this to work properly.
Note that this will wipe your current recovery.
Also note that this may not work, don't taze me bro!
Run? Close if you want to cancel.
Press any key to continue . . .
List of devices attached
0123456789ABCDEF recovery
If you see your device here this will work, if not fix adb.
Press any key to continue . . .
running fix...
dd: writing '/dev/block/mmcblk0p3': No space left on device
4097+0 records in
4096+0 records out
2097152 bytes (2.0MB) copied, 0.345431 seconds, 5.8MB/s
rebooting tab, if at any step it doesn't reboot turn off and turn back on
Once back into an adb possible state continue...
Press any key to continue . . .
Pushing new recovery...
1331 KB/s (4599884 bytes in 3.374s)
Running wolf's exploit...
mv: can't rename '/data/local/tmp': No such file or directory
Going...
ln: /data/local/tmp: No such file or directory
Done!
Now lets reboot your TF again...
Continue when back into ADB again...
Press any key to continue . . .
Flashing new recovery...
dd: can't open '/sdcard/recoveryblob': No such file or directory
Done!
Continue to reboot your tab, do the button combination to test recovery.
(Hold volume-down as it's rebooting and press vol-up to enter recovery)
Press any key to continue . . .
Hopefully that fixed everything!
Press any key to continue . . .
Of course nothing was fixed and I still have cwm 5xxx which can't flash from ext sd. If I can only get another recovery I can flash any rom and that's that.
In device manager the device shows up as android adb interface when booted into cwm. I also have a device named android composite adb interface, but with a warning sign on it.
This is getting tiresome...
Edit: tried using quick adb pusher, but get message that i cant mount as r/w. In cwm cant mount data or sdcard/.android_secure.
Fun thing is I dont have root either.
It looks like your partitions are unformatted.
I think you need to get to a root shell via adb in recovery
- put your phone on recovery and plug into your computer
- type "adb remount" (you might get an error) then type "adb shell"
- you'll be in a terminal shell
- type "mount" to see how/what your sdcard is doing. Look for the line that has /sdcard on it. It might be something like /dev/block/mmcblk0p1 mounted at /sdcard blah blah...
- now to format your sdcard, type "mke2fs /dev/blah/whereever/your/sdcard/is/mounted/from/above"
- allow it to complete and type "exit". you might have to reboot your tab to get everything to remount
- once your tqab is back in recovery, type on your computer "adb push [some new recovery that uses the external sdcard or a new rom] /sdcard"
- if you have recovery bootloops, google around, there is a fix that wipes the reboot command from the misc partition. You can type it from an adb shell it's something like "dd if=/dev/block/zero of=/be/carefule/because/you/have/a/tf101G bs=1 count=13"
- Google is your friend. Linux is your friend. This is a bit of a high level overview, so you'll have to fill in the details yourself. Keep in mind that I don't have a tf101G and I never tried this before (a benefit of never using superwipe!)
Good luck!
OK. I'd like to try the method u describe but as I mentioned I'm really not tech savvy. I don't even know how to get to the point where I type "adb remount". Do I just open a cmd prompt? Tried that - didn't work.
I have downloaded sdk manager for when I did some stuff with my phone earlier and have the basic packages installed.
Are you on Windows? I think it's a path issue. You either need to put everything in the same folder and run everything from there or put adb in your path. I don't use Windows, so that's probably the best advice I can give you. "which adb" and "echo $PATH" probably won't work in Windows like they do in linux.
Ehm.. too techie answer for me to comprehend.
Yes I'm on win 7.
Put what in same folder as what?
Run from there by right clicking empty space in folder and choosing cmd?
What do you mean by putting adb in my path?
For some reason, lots of people on windows just put the recovery/rom and adb in the same folder and run it from there in the command prompt. Put it all in one place and use the cd command in the terminal to get there.
sent while running with scissors
Lol. Don't cut urself man. I might need your help again
I'll try later when kids asleep.
Allright. Learning curve is steep but im clinging on to it:
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb remount
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
remount failed: Success
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
~ # mount
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mmcblk0p2 on /cache type ext4 (rw,nosuid,nodev,relatime,user_xattr,ac
l,barrier=1,data=ordered)
~ # mke2fs /dev/block/mmcblk0p2
mke2fs /dev/block/mmcblk0p2
mke2fs 1.41.11 (14-Mar-2010)
/dev/block/mmcblk0p2 is apparently in use by the system; will not make a filesys
tem here!
~ # exit
exit
C:\Program Files (x86)\Android\android-sdk\platform-tools>
Any ideas?
You're almost there... You're /cache partition is already formatted (ext4) Be careful since you can really mess things up with the wrong commands or mis-typed commands.
It looks like you need to mount your sdcard manually. I'm not sure which partition it is. I'll check the stock rom in a little while- I have to run some errands while it downloads.
OK, I downloaded the stock rom and had a look at the /etc/recovery.fstab file in the stock recovery. Should be what we need.
Put your tablet in recovery. Then, in a windows terminal, type "adb remount" and then "adb shell" This wil put you into an android terminal. I don't know if you need read/write permissions in CWM? Who knows? Typing commands in here is the same as typing commands on your tablet (if anyone used the command line any more).
type "ls /dev/block/" and you should see a long list of - look for mmcblk1p1 or mmcblk1. It will probably be the first one.
type "ls /" and look for /sdcard. If it's not there type "mkdir /sdcard" This step creates the mount point if it doesn't exist.
Now type "mount /dev/mmcblk1p1 /sdcard" - Substitute whichever one is in your /dev/block directory from above.
EDIT: If you get errors that it's not formatted or "specify the type" then we'll have to format it first. "mke2fs /dev/block/mmcblk1p1"
Now, in a different windows terminal, type "adb push [a new rom/recovery] /sdcard/"
In CWM, you should be able to flash whatever you pushed there.
If it flashes, but you get bootloops or boot back into CWM, you probably have the dreaded CWM bootloops. You can fix that by typing "dd if=/dev/zero of=/dev/block/mmcblk0p3 bs=1 count=15" in the terminal as the first step after "adb shell" For this you will need root access (with the # prompt, not $) Type "su" if you don't ahve the # prompt. It might work? Note that this is experimental and wipes out a bit of your misc partition. I have no idea of what else is on there, so there might be unintended consequences.
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb remount
remount failed: Success
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
~ # ls /dev/block/
ls /dev/block/
loop0 loop3 loop6 mmcblk0p1 mmcblk0p4 mmcblk0p7 platform
loop1 loop4 loop7 mmcblk0p2 mmcblk0p5 mmcblk1
loop2 loop5 mmcblk0 mmcblk0p3 mmcblk0p6 mmcblk1p1
~ # ls /
ls /
cache proc system
data res tmp
default.prop root ueventd.goldfish.rc
dev sbin ueventd.rc
etc sdcard ueventd.ventana.rc
init staging
init.rc sys
~ # mount /dev/mmcblk1p1 /sdcard
mount /dev/mmcblk1p1 /sdcard
mount: mounting /dev/mmcblk1p1 on /sdcard failed: No such file or directory
~ #
I tried pushing anyway, but can't still mount sdcard on cwm from pad interface.
As for the sdcard contents, I have nothing there that can't be deleted.
use "mount /dev/block/mmcblk1p1 /sdcard" No need to repeat the ls commands.
Sorry for not answering rapidly. Baby chose this night to be at his worst.
First
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb remount
remount failed: Success
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
~ # mount /dev/block/mmcblk1p1 /sdcard
mount /dev/block/mmcblk1p1 /sdcard
~ #
New cmd
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb push cwm-6.0.1.2-t
ouch-external.zip /sdcard/
1332 KB/s (5070063 bytes in 3.715s)
C:\Program Files (x86)\Android\android-sdk\platform-tools>
Can't mount sdcard frow cwm. Can I also flash new rck manually?
Tried reboot and mounting again manually, but cwm won't mount.
Maybe try "mount /dev/block/mmcblk1 /sdcard" ???
I get invalid argument on that command.
What if we forget cwm and try format to default partinioning and push stock?
You could try pushing the stock rom to your tablet and then flashing it via the staging partition. The rom is about 522M, so you might need the sd card, but otherwise, you can push it anywhere it will fit. Staging partition is /dev/block/mmcblk0p4. Google around, the info is certainly in this forum. As long as you can get a root shell via adb, you can flash it. The stock rom is on the Asus sight. Just keep unzipping it until you see the blob file.
Of course, you can flash anything you want via the staging partition, if it's packed in a blob format. You might consider flashing a rooted rom instead of the stock.
I have stock on hd. Shall I mount staging via same commands as i mounted sdcard? Push there via adb. Then what command to flash the blob? The blob has no file extension. Shall i keep it that way?
Edit: ok i tried to unpack the recoveryblob from my desired version of cwm, but tool stopped working during process of writing recoveryblob.sos. I got the tool here http://forum.xda-developers.com/showpost.php?p=21620550&postcount=24
Next problem:
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb remount
remount failed: Success
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell
~ # mount /dev/block/mmcblk0p4
mount /dev/block/mmcblk0p4
mount: can't find /dev/block/mmcblk0p4 in /etc/fstab
~ #
Edit 2: I finally managed to get apx working if it somehow can help.

Tutorial ROKCHIP2918 ADB UBUNTU LINUX AND ROOT

1-Preparing the environment.
sudo add-apt-repository ppa: nilarimogard/webupd8
sudo apt-get update
sudo apt-get install-android-tools-tools adb-fastboot android
Those three commands install ADB TOOLS, for Ubuntu 12.04 and earlier versions.
2-Each manufacturer has its ID development.
This, in principle, we can solve in a simple way Ubuntu. We need to add a line in the file / etc / udev / rules.d.
The line to add to the file depends on the manufacturer and model of the device. We can find the Vendor ID and Product ID of the device running (after having connected to USB, of course):
$ lsusb
This will be returned
*
Bus 002 Device 021: ID 2207:0000
(This is an example of what we can give back, by brand and manufacturer)
This indicates that the Vendor ID is "2207" and the Product ID is "0000".
3-Let's do it step by step:
Enable USB debugging and unknown sources on the Android.
Go to Settings -> Security and check the Unknown sources checkbox, then go to Options and development USB debugging enabled.
Connects via USB to Ubuntu Android.
Create / edit a file in / etc / udev / rules.d called 51-android.rules:
$ sudo gedit / etc/udev/rules.d/51-android.rules
Add the following line and save it
SUBSYSTEMS == "usb", ATTRS {idVendor} == "....", MODE = "0666", GROUP = "plugdev"
***IMPORTANT: Place the idVendor ATTRS {idVendor} == "HERE"***
4-Restart udev
$ sudo restart udev
At this point adb and should recognize our device, but it is not. This is because the version of adb included in the Android SDK does not "understand" our Vendor ID (not a salesman "officially recognized").
To fix this do the following:
Create / edit a file in $ HOME / .android called adb_usb.ini:
$ gedit $ HOME / .android / adb_usb.ini
Add the following content and save it
# ANDROID 3RD PARTY USB VENDOR ID LIST - DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0 × 2207
************************************************** *****************************
At this point gave me a problem, which was solved in a way a little strange. The following file $ gedit $ HOME / .android / adb_usb.ini
has to look like:
# ANDROID 3RD PARTY USB VENDOR ID LIST - DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0 × 2207
# ANDROID 3RD PARTY USB VENDOR ID LIST - DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0 × 2207
It was the way it worked for me and found the tablet.
************************************************** *******************************
5-At this point adb and should recognize our device:
$ adb devices
List of devices attached
0123456789ABCDEF device
Although sometimes you need to stop and start the adb server:
$ adb kill-server
$ adb start-server
************************************************** *********************************
Or maybe we should use this other method to stop the deamon
************************************************** *********************************
Reinitiate the 'deamon', as follows:
$ sudo stop udevd
It is likely that in the process of detention remains in standby, so the terminal will show nothing after entering the command.
Do not panic, simply: Restart our machine.
After restarting our team, we will ensure that our tablet has enabled debug mode, for that we can address
Settings >> Applications >> Development
And check the option 'USB debugging'
Once marked, we connect our tablet via cable / USB, open a terminal command:
$ adb devices
Automatically our deamon 'udevd' ripped, since previously we had stopped. And if all goes well, it should show you a list of connected devices, with their ID's.
6-Now that our team recognizes our device we root him:
Superuser unloaded tool (ICS compatible version and with our platform ARM, MIPS, ROKCHIP, ALLWINNER, etc.) and extract the application "Superuser.apk" and binary "your" in, for example, / tmp.
Su and Superuser installed:
$. / adb remount
$. / adb push / tmp / su / system / bin / su
2568 KB / s (22364 bytes in 0.008s)
$. / adb push / tmp / su / system / xbin / su
2843 KB / s (22364 bytes in 0.007s)
$. / Adb push / tmp / Superuser.apk / system / app / Superuser.apk
4593 KB / s (843503 bytes in 0.179s)
$. / adb shell chown 0.0 / system / xbin / su
$. / adb shell chmod 6775 / system / xbin / su
$. / adb shell chown 0.0 / system / bin / su
$. / adb shell chmod 6775 / system / bin / su
$. / adb remount
remount succeeded
$. / adb reboot
We hope to restart the tablet and go!
Sources:
http://rubensa.wordpress.com/2012/05/21/energy-sistem-i828-hd-ics-4-0-3-rooting/
http://www.htcmania.com/showthread.php?t=469742

[Q] (vold.fstab) storage is messed up \O/

I edit ( vold.fstab ) for swaping sdcard with external_sdcard .
but now my tab dose not show any storage ?
tab: karbonn tornado
problem resolved
Flash with stock rom, and its done :good:
Download any stock rom from here :
androidxda(.)com/download-karbonn-stock-rom-models
:victory:
or you can change it with ADB PULL
Here some text which i find on net :
Download the Android Debug Bridge from here, and extract the contents (to the same directory).
Connect your device to your computer using the USB cable and open up a command prompt (Windows logo key + R, type cmd and press Enter).
Once that is open, type the following commands:
cd <entire path to adb.exe file>
adb shell
su
mount -o remount,rw /system (if that doesn't work: mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system)
exit
exit
adb push <path to original file> /system.etc/vold.fstab
adb reboot
That will grant root, mount the system as writeable and then push the original file and overwrite the modified one (and reboot your device).
Click to expand...
Click to collapse
I don't know about Android Commander, but a simpler way (in my opinion) would be to use ADB. You may have already installed the Android SDK (if not, go here). I assume that you don't have modified your System Path.
Move your vold.fstab to C:\Program Files\Android\android-sdk\platform-tools or C:\Program Files (x86)\Android\android-sdk\platform-tools
Go to the android-sdk folder, shift+right click on platform-tools and choose "Open command prompt here"
Next steps depends if you have a custom rom (a) or not (b) (see comments).
We take root privilege:
a) If your device is 4.0 or above, type adb root
b) Type adb shell then su
We make /system writeable:
a) adb remount
b) mount -o remount,rw /system then exit
adb push vold.fstab /system
adb reboot
This should do the trick.
Click to expand...
Click to collapse
to pull (read) should not need root.
adb pull /system/etc/vold.fstab
or
adb pull /etc/vold.fstab
what output did you get?
_____________________________________________________
adb pull /etc/vold.fstab
edit vold.fstab and change the following line:
dev_mount usbdisk /mnt/usbdisk auto /devices/platform/tegra-ehci
to
dev_mount usbdisk /mnt/usbOTG auto /devices/platform/tegra-ehci
save the file, and go back to the command line
adb remount
adb push vold.fstab /etc/vold.fstab
abd reboot
Click to expand...
Click to collapse
But i dont get any of em

Mounting Internal Storage as a USB Mass Storage Device and Recovering Data

CleverCoder's Guide to Mounting Android’s Internal Storage As A Mass Storage USB Device
I found inspiration from this guide: http://mohammadag.xceleo.org/mounting-your-android-devices-internal-storage/
His process did not work exactly, but by changing the “lun” to “lun0” and the path to the “android_usb” device, I was able to get this to work with my rooted Samsung Note 10.1. The instructions below were verified on my Note 2.
I was motivated to find this solution after I accidentally deleted my daughters world that she worked so hard to create in Survivalcraft. Ultimately, I wasn’t able to recover her world, but I learned a lot in the process. Enjoy!
Steps:
Boot into recovery mode (Usually holding volume (and home) down while powering up). I find the Wiki on CyanogenMod to be helpful to find device-specific bootloader instructions.
Invoke a root shell using ADB: “adb shell" (Note: This assumes you have the Android SDK installed and /platform-tools are in your PATH)
Find the /data partition, determine the block device that corresponds to it:
Code:
mount | grep /data
…
/dev/block/mmcblk0p16 on /data type ext4 (rw,seclabel,relatime,user_xattr,barrier=1,data=ordered)
…
Click to expand...
Click to collapse
Make a note of the block device name. In my case, it's "/dev/block/mmcblk0p16". Unmount the /data partition to allow mounting as a mass storage device:
Code:
umount /data
Locate the “mass storage” device LUN entry. (In my case, it was ..\lun0 rather than ..\lun):
Code:
find /sys -name lun*
…
/sys/devices/platform/s3c-usbgadget/gadget/lun0
/sys/devices/virtual/android_usb/android0/f_mass_storage/lun0
…
Click to expand...
Click to collapse
In this case, we want to make a note of the entry with "f_mass_storage" in it. This is the entry that corresponds to a USB Mass Storage device.
Map the block device to the mass storage logical device LUN “file”. Note, this will be a file called “file” within the LUN folder. For example:
"/sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file":
~# echo BLOCK_DEVICE_HERE > LUN_FILE_PATH_HERE
For example:
Code:
echo /dev/block/mmcblk0p16 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
Note: the ADB shell appears to wrap at around 80 characters, making it look like the line is split.
Reconfigure the USB device in “mass storage” mode. This has to be done in one command, since it will terminate the ADB connection. Also, the path varies to the “android_usb” device. It may be:
/sys/devices/virtual/android_usb/android0/
/sys/class/android_usb/android0/
You can use "find /sys -name *android0*" to help narrow the options. I believe either entry will work. YMMV
On my Note 2 the following worked:
Code:
echo "echo 0 > /sys/devices/virtual/android_usb/android0/enable && echo \"mass_storage,adb\" > /sys/devices/virtual/android_usb/android0/functions && echo 1 > /sys/devices/virtual/android_usb/android0/enable" > enable_mass.sh
sh enable_mass.sh &
This should terminate the ADB connection and cause a new USB device to appear, representing the /data volume mounted as a mass storage device.
At this time, the block device associated with the /data partition should show up as a USB mass storage device on your computer. I verified this with OSX. OSX did not support the ext3/4 filesystem, however, Unix utilities that support it will work.
Recovering Files
Once the device is mounted on your host machine, you can use PhotoRec (http://www.cgsecurity.org/wiki/PhotoRec) to recover files. It performs a file signature based recovery, is very powerful, and works with any file you can think of. It’s also easy to add support for your own file types.
I hope this helps others.
Cheers!
- Sean
Have anyone tried it?
Failed while do the step with the lun0/file.
Permission denied
Quite interesting :good: and works as expected with lun/file
Thanks for this amazing post
great
command done for E300K over Wifi adb
while system running normally
working great thanks
Code:
echo /dev/block/mmcblk0p20 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
echo 0 > /sys/devices/virtual/android_usb/android0/enable
echo "mass_storage,adb" > /sys/devices/virtual/android_usb/android0/functions
echo 1 > /sys/devices/virtual/android_usb/android0/enable
---------- Post added at 05:10 AM ---------- Previous post was at 05:08 AM ----------
wondering how we could mount many partition at the same time
will see
Edit : seems to be related to the module that provide mass storage gadget, it's set to 1 emulation for the moment... i think i have to recompile that stuff and/or the kernel to have this feature... any way not for now ^^
Note : an alternative to check deleted files is R-Studio work well
Some Hint Please?
CleverCoder said:
CleverCoder's Guide to Mounting Android’s Internal Storage As A Mass Storage USB Device
I found inspiration from this guide: http://mohammadag.xceleo.org/mounting-your-android-devices-internal-storage/
His process did not work exactly, but by changing the “lun” to “lun0” and the path to the “android_usb” device, I was able to get this to work with my rooted Samsung Note 10.1. The instructions below were verified on my Note 2.
I was motivated to find this solution after I accidentally deleted my daughters world that she worked so hard to create in Survivalcraft. Ultimately, I wasn’t able to recover her world, but I learned a lot in the process. Enjoy!
Steps:
Boot into recovery mode (Usually holding volume (and home) down while powering up). I find the Wiki on CyanogenMod to be helpful to find device-specific bootloader instructions.
Invoke a root shell using ADB: “adb shell" (Note: This assumes you have the Android SDK installed and /platform-tools are in your PATH)
Find the /data partition, determine the block device that corresponds to it:
Code:
mount | grep /data
Make a note of the block device name. In my case, it's "/dev/block/mmcblk0p16". Unmount the /data partition to allow mounting as a mass storage device:
Code:
umount /data
Locate the “mass storage” device LUN entry. (In my case, it was ..\lun0 rather than ..\lun):
Code:
find /sys -name lun*
In this case, we want to make a note of the entry with "f_mass_storage" in it. This is the entry that corresponds to a USB Mass Storage device.
Map the block device to the mass storage logical device LUN “file”. Note, this will be a file called “file” within the LUN folder. For example:
"/sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file":
~# echo BLOCK_DEVICE_HERE > LUN_FILE_PATH_HERE
For example:
Code:
echo /dev/block/mmcblk0p16 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun0/file
Note: the ADB shell appears to wrap at around 80 characters, making it look like the line is split.
Reconfigure the USB device in “mass storage” mode. This has to be done in one command, since it will terminate the ADB connection. Also, the path varies to the “android_usb” device. It may be:
/sys/devices/virtual/android_usb/android0/
/sys/class/android_usb/android0/
You can use "find /sys -name *android0*" to help narrow the options. I believe either entry will work. YMMV
On my Note 2 the following worked:
Code:
echo "echo 0 > /sys/devices/virtual/android_usb/android0/enable && echo \"mass_storage,adb\" > /sys/devices/virtual/android_usb/android0/functions && echo 1 > /sys/devices/virtual/android_usb/android0/enable" > enable_mass.sh
sh enable_mass.sh &
This should terminate the ADB connection and cause a new USB device to appear, representing the /data volume mounted as a mass storage device.
At this time, the block device associated with the /data partition should show up as a USB mass storage device on your computer. I verified this with OSX. OSX did not support the ext3/4 filesystem, however, Unix utilities that support it will work.
Recovering Files
Once the device is mounted on your host machine, you can use PhotoRec (http://www.cgsecurity.org/wiki/PhotoRec) to recover files. It performs a file signature based recovery, is very powerful, and works with any file you can think of. It’s also easy to add support for your own file types.
I hope this helps others.
Cheers!
- Sean
Click to expand...
Click to collapse
Hello sir, I want to ask you.
What recovery version do you use? Philz Touch? TWRP or another? can you please help me.? I am using Galaxy Note II device (GT-N7100)
When I am using TWRP recovery I can do all steps you provide but no luck. Then I am try using Philz Touch, adb shell is error, Device Not Found.
What can I do? Can you please help me? :good:
I need to recover some photos that I accidentally deleted.
Hi Sean,
This is a great idea!!! I've been struggling for the past two weeks to recover data from my HTC One M7 ever since I accidentally hit the factory reset button!:crying:
I got a few questions...
Does this method work on my M7 which has only the internal memory and no SD card?
IIf I'm trying this directly on a terminal window on he phone, how would the last command change?
Also, once done, how do we mount /data back?
Sorry for the noob questions!
Thanks a lot!
No response from HTC One M7
Hello Experts,
I tried the above mentioned method on my HTC One M7. It was lun0 in my case. I have unmounted /data. However, I still found that mmcblkp037 that was mounted on /data was still linked to /sdcard for some reason. I proceeded to unmount /sdcard too. (There is no SD card in my device btw).
After unmounting both /data and /sdcard, I proceeded to edit the lun0/file and then the long command all in one go. Unfortunately nothing happens, the adb shell remains active and I do not see a USB device appearing on My Computer. I've added the snapshots from the terminal window.
Can someone please help?:crying:
Thanks!!!
So i am trying to run this so that i can do a photo recovery on the internal storage. At first i wasn't getting the list of mmcblk0p and what they were assigned to. I found a different command that I think returns the correct information ( mmcblk0p26) when i make it to the end, it mounts it on my pc as the cd rom drive, but i cant do anything with it and it doesnt show up in my recovery program. I ran the command again and i got ( mmcblk0p26-orig) but again at the end, i still only have the cd rom that it mounts. im not sure if im not pointing to the correct mmcblk or what im missing. Any help is appreciated.
anyone?
Issues with step 4 umount
Hi together,
I have issues by proceeding step 4. "umount /data" it all the times says: "umount: bad /etc/fstab: No such file or directory"
I tried so many things to solve it.
Could you please help me?
I am unable to switch to mass_storage on my Moto G 2013.
I tried with DriveDriod Android App and it successfully enabled mass_storage but I am unable toreplicate the same manually.
This is what I tried:
[email protected]:/sdcard # find /sys -name lun*
/sys/devices/virtual/android_usb/android0/f_mass_storage/lun
/sys/devices/platform/msm_hsusb/gadget/lun0
[email protected]:/sdcard #
[email protected]:/sdcard # mount | grep /data
/dev/block/mmcblk0p36 on /data type f2fs (rw,seclabel,nosuid,nodev,noatime,nodiratime,background_gc=on,user_xattr,inline_xattr,acl,inline_data,nobarrier,active_logs=6)
[email protected]:/sdcard #
[email protected]:/sdcard # echo "/dev/block/mmcblk0p36" > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file
[email protected]:/sdcard #
[email protected]:/sdcard # setprop sys.usb.config mass_storage,adb
Click to expand...
Click to collapse
No luck in mounting the partition as UMS.
Please Help.
Thanks.
@CleverCoder im trying this on a OneplusX but it ends up showing as unallocated space in gparted. Any clue?
All worked fine with a bq aquaris a4.5.
~#: umount /data
umount: can't umount /data: Invalid argument
Click to expand...
Click to collapse
Why can't I unmount the /data partition?
Any hints please?
Useful guide. Thanks. :good:
Additionally, you may look into kernel source of your device or simply into these USB related initramfs files for further details what you need to edit on your device:
/init.qcom.usb.rc
/init.usb.rc
/init.recovery.usb.rc (on TWRP)
Click to expand...
Click to collapse
You can find in these files the USB vendor id and product id values provided by your device manufacturer or Google. These values should be fed to corresponding files so that PC may properly identify your phone as a USB mass storage device. In given example, 2717 is USB Vendor ID of Xiaomi; manufacturer of Redmi Note 4.
Sample init.qcom.usb.rc (RN4/mido):
Code:
# Following are the parameters required for usb functionality. They provide configurable options like
# product_id/vendor id and allows specifying required functions:
#
# Required parameters:
#
# /sys/class/android_usb/android0/enable: Enables/disables usb composition
# Value: 0 (disable), 1 (enable)
[...]
# /sys/class/android_usb/android0/functions: Stores name of the function drivers used in usb composition.
# Value: Passed one per function driver. e.g. diag[,adb]
[...]
on property:sys.usb.config=mass_storage,adb && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/idVendor 2717
write /sys/class/android_usb/android0/idProduct FF28
write /sys/class/android_usb/android0/functions adb,mass_storage
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}
#Mass-storage only composition
on property:sys.usb.config=mass_storage && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/idVendor 2717
write /sys/class/android_usb/android0/idProduct FF20
write /sys/class/android_usb/android0/functions mass_storage
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
A good source is https://android.googlesource.com/kernel/common/+/bcmdhd-3.10/Documentation/usb/mass-storage.txt
Code:
[B]mido:/ #[/B] (find / -maxdepth 1 -type f) | while read fyle; do grep -iE "/sys.{,}lun" "$fyle" && printf ">>> $fyle\n\n"; done
/sys/class/android_usb/android0/f_mass_storage/lun/file
/sys/class/android_usb/android0/f_mass_storage/lun/file
>>> /init.usb.rc
[...]
[B]mido:/ #[/B] find /sys -iname lun*
/sys/devices/soc/7000000.ssusb/7000000.dwc3/gadget/lun0
/sys/devices/virtual/android_usb/android0/f_mass_storage/lun
[...]
[B]mido:/ #[/B] file /sys/class/android_usb/android0/f_mass_storage/lun
/sys/class/android_usb/android0/f_mass_storage/lun: symbolic link to ../../../../soc/7000000.ssusb/7000000.dwc3/gadget/lun0
[B]mido:/ #[/B] file /sys/class/android_usb/f_mass_storage/lun
/sys/class/android_usb/f_mass_storage/lun: symbolic link to ../../../../soc/7000000.ssusb/7000000.dwc3/gadget/lun0
[B]mido:/ #[/B] file /sys/devices/virtual/android_usb/android0/f_mass_storage/lun
/sys/devices/virtual/android_usb/android0/f_mass_storage/lun: symbolic link to ../../../../soc/7000000.ssusb/7000000.dwc3/gadget/lun0
[B]mido:/ #[/B] file /sys/class/android_usb/android0
/sys/class/android_usb/android0: symbolic link to ../../devices/virtual/android_usb/android0
So, the original files to modify are:
/sys/devices/soc/7000000.ssusb/7000000.dwc3/gadget/lun0
and
/sys/devices/virtual/android_usb/android0
Click to expand...
Click to collapse
All others are symlinks. Check your devices accordingly.
Simply use these files:
Code:
echo '0' > /sys/class/android_usb/android0/enable
echo '/dev/block/mmcblk0p**' > /sys/class/android_usb/android0/f_mass_storage/lun/file; # replace ** with partition number
echo 'mass_storage,adb' > /sys/class/android_usb/android0/functions
If your /data partition is encrypted and TWRP can decrypt it, you should use:
Code:
echo '/dev/block/dm-0' > /sys/class/android_usb/android0/f_mass_storage/lun/file
Additional settings:
Code:
setprop persist.sys.usb.config mass_storage,adb
setprop sys.usb.config mass_storage,adb; # disabling mtp will probably cause adb unauthorized
If you want to mount /data read-only, being on safe side or to avoid overwrite if want to recover deleted stuff:
Code:
echo '1' > /sys/class/android_usb/android0/f_mass_storage/lun/ro
And finally:
Code:
echo '1' > /sys/class/android_usb/android0/enable
Don't try this in running ROM, it's only for recovery mode.
Don't forget to unmount /data from your computer before disconnecting. Otherwise eMMC may get corrupted.
You can mount other partitions having a filesystem (like /system or /cache) in similar way, but that's rarely needed.
Can you tell me how to disable mass_storage again? revert everything back?
osrl said:
Can you tell me how to disable mass_storage again? revert everything back?
Click to expand...
Click to collapse
"sysfs" is a volatile filesystem. Everything is reset on reboot. Or you may revert changes manually:
Code:
echo 0 >/sys/class/android_usb/android0/enable
echo "" >/sys/class/android_usb/android0/f_mass_storage/lun/file
setprop persist.sys.usb.config adb
setprop sys.usb.config adb
echo 1 >/sys/class/android_usb/android0/enable
honor 9 error lun
Hello, On my Honor 9 I'm trying to do the same but I'm stuck on
find /sys -name lun*
Click to expand...
Click to collapse
because this command gives no lines found, it seems that I don't have any directory with "lun" written in it, so I'm unable to continue the tutorial, what am I doing wrong?
eyewee said:
honor 9 error lun
Hello, On my Honor 9 I'm trying to do the same but I'm stuck on
because this command gives no lines found, it seems that I don't have any directory with "lun" written in it, so I'm unable to continue the tutorial, what am I doing wrong?
Click to expand...
Click to collapse
i met this same problem. My phone is OPPO R15x PBCM.
i have ever installed an apk named UMS interface which can be downloaded from coolapk and found its code in github . this apk can allow root user create an image in their sdcard and mount it as a usb device or mount an external sd card as a usb device. the latter is like ums enabler .
it work normally, until i reinstalled OS of my phone. then it always return Mass storage Unit is not ready. i take a glance at the code of the apk, and found this warning exist only when /sys/devices/virtual/android_usb/android0/f_mass_storage/lun doesn't exist. exactly, /sys/devices/virtual/android_usb/android0/f_mass_storage/ doesn't exist. when i ls /sys/devices/virtual/android_usb/android0, it only return f_audio_source f_midi power state subsystem uevent, not
Code:
f_mass_storage
. no matter i reinstalled OS for many times, nothing become normal.
Code:
grep f_mass_storage /init.usb.rc
will return
Code:
chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
, but i don't know its meaning. i don't have enough knowledge about android.
thanks anyone for help!

Pixel 5a sdcard folder does not exist anymore

Out of nowhere the screen went black and started flickering without being dropped.
I can interact with the phone via adb commands and was trying to recover data.
I ran the commands below and it's as if the /storage/emulated/0 folder is nonexistent.
Is the phone's storage permanently damaged? I can't adb backup or reset the phone since the screen does not work
I was thinking of booting twrp and using the command line to perform a backup but to my knowledge there is not a twrp image for the Pixel 5a on Android 13.
Code:
barbet:/storage/emulated/0 $ du -ms *
du: *: No such file or directory
barbet:/storage/emulated/0 $ ls -la
total 0
drwxr-xr-x 2 root root 40 1971-07-28 00:58 .
drwxr-xr-x 3 root root 60 1971-07-28 00:58 ..
barbet:/ $ ls
acct cache data_mirror etc lost+found odm_dlkm proc storage system_ext
apex config debug_ramdisk init metadata oem product sys vendor
bin d dev init.environ.rc mnt persist sdcard system vendor_dlkm
bugreports data dsp linkerconfig odm postinstall second_stage_resources system_dlkm
$ adb push file.txt /storage/emulated/0/
file.txt : 1 file pushed, 0 skipped. 1.1 MB/s (316 bytes in 0.000s)
adb: error: failed to copy 'file.txt ' to '/storage/emulated/0/file.txt ': remote couldn't create file: Permission denied
$ adb pull /storage/emulated/0/
/storage/emulated/0/: 0 files pulled, 0 skipped.
This errror msg says
Code:
adb: error: failed to copy 'file.txt ' to '/storage/emulated/0/file.txt ': remote couldn't create file: Permission denied
says all.
Your device's Android 13 does not allow ADB to access storage /data/media/0 ,
BTW:
/storage/emulated/0/ is actually /data/media/0/ exposed through an emulated / virtual filesystem, not the actual one.
I see. I have used the prior commands before on other Android versions and it did not occur to me it was an Android 13 limitation.
I have Magisk installed. Is there a way for me to grant adb root access without being able to see the screen?
The below command works on an android 11 phone but on the Pixel 5a the storage is mounted and when I click on it it unmounts.
Code:
adb shell svc usb setFunctions mtp true
first, find your .android directory on PC and backup your adbkey.pub
then use scrcpy to mirror screen to PC via adb.
Control your Android Smartphone from your PC for free with scrcpy
A new tool called "scrcpy" allows you to display your phone screen on your computer with just a USB connection and ADB. No root required.
www.xda-developers.com
Your phone is rooted, so don't reboot or do anything to get stuck in BFU state. use the power of root instead.
type su and check data is decrypted. you can list files in /data/media/0
Thanks for the replies. I was able to get a free screen replacement at Ubreakifix through an extended Google warranty. The employee was not to knowledgeable about which specific one but I think it's this one.
I tried scrcpy and it worked to enable adb shell root access.
Interestingly, the adb command to enable mtp worked when the screen was repaired.

Categories

Resources