[Question] Samsung GS3 mini (I8190) EFS script - Galaxy S III Mini Q&A, Help & Troubleshooting

I have device with IMEI NULL that I want to mount (or replace the efs into generic) in adb in similar with this script:
cd c:/androidsdk/tools
adb shell
su
mke2fs /dev/block/mmcblk0p3 ( skip to next step if fail)
mount -w -t ext4 /dev/block/mmcblk0p3
reboot
Click to expand...
Click to collapse
I tried the above script but unfortunately it brokes the partition because I think that code is not for i8190, but no worry about that because I already managed to fix it with pit file.
Anybody can share it with me?especially developers please.
Thanks in advance.

cz4r3n said:
I have device with IMEI NULL that I want to mount (or replace the efs into generic) in adb in similar with this script:
I tried the above script but unfortunately it brokes the partition because I think that code is not for i8190, but no worry about that because I already managed to fix it with pit file.
Anybody can share it with me?especially developers please.
Thanks in advance.
Click to expand...
Click to collapse
0p3 is PIT partition. mmcblk0p11 is EFS, but i'm not sure what you're trying to do here.

tys0n said:
0p3 is PIT partition. mmcblk0p11 is EFS, but i'm not sure what you're trying to do here.
Click to expand...
Click to collapse
I'm trying to mount the efs to create generic efs.tnx for the reply
EDIT: Is this the proper way of mounting or formatting efs?
Can I used this command in general?
adb shell
mke2fs -T ext4 /dev/block/mmcblk0p11
mkdir /efs
mount -w -t ext4 /dev/block/mmcblk0p11 /efs
Click to expand...
Click to collapse

cz4r3n said:
I'm trying to mount the efs to create generic efs.tnx for the reply
EDIT: Is this the proper way of mounting or formatting efs?
Can I used this command in general?
Click to expand...
Click to collapse
I think it could work. Otherwise try
Code:
mount -o rw,remount -t ext4 /dev/block/mmcblk0p11 /efs

tys0n said:
I think it could work. Otherwise try
Code:
mount -o rw,remount -t ext4 /dev/block/mmcblk0p11 /efs
Click to expand...
Click to collapse
I tried and here is the log:
D:\adbsdk\sdk\platform-tools>adb shell
~ # ←[6nmke2fs -T ext4 /dev/block/mmcblk0p11
mke2fs -T ext4 /dev/block/mmcblk0p11
mke2fs 1.41.11 (14-Mar-2010)
/dev/block/mmcblk0p11 is apparently in use by the
stem here!
~ # ←[6nmkdir /efs
mkdir /efs
mkdir: can't create directory '/efs': File exists
Click to expand...
Click to collapse

cz4r3n said:
I tried and here is the log:
Click to expand...
Click to collapse
Ok. Only thing I can think of is to do it from recovery and try to unmount it first.

tys0n said:
Ok. Only thing I can think of is to do it from recovery and try to unmount it first.
Click to expand...
Click to collapse
I'm doing it in recovery mode.Im using Team Win Recovery Project v2.6.0.0.
here is the log after unmounting efs from recovery:
D:\adbsdk\sdk\platform-tools>adb shell
~ # ←[6nmke2fs -T ext4 /dev/block/mmcblk0p11
mke2fs -T ext4 /dev/block/mmcblk0p11
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1024 inodes, 4096 blocks
204 blocks (4.98%) reserved for the super user
First data block=0
1 block group
32768 blocks per group, 32768 fragments per group
1024 inodes per group
Writing inode tables: done
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
~ # ←[6nmkdir /efs
mkdir /efs
mkdir: can't create directory '/efs': File exists
~ # ←[6nmount -w -t ext4 /dev/block/mmcblk0p11 /efs
mount -w -t ext4 /dev/block/mmcblk0p11 /efs
~ # ←[6n
Click to expand...
Click to collapse

cz4r3n said:
I'm doing it in recovery mode.Im using Team Win Recovery Project v2.6.0.0.
here is the log after unmounting efs from recovery:
Click to expand...
Click to collapse
Yeah, your /efs dir is still in root directory, but it looks like you got it formated and remounted.

double post (deleted)

ah ok, ya I think so, because it shows factory mode in the screen already.I am expecting that the imei will be converted to 004 but it still shows null.
Anyway, tnx for a big hand.Now then, I'll try to use special box to re-write the original imei.tnx tnx...really appreciate it

cz4r3n said:
ah ok, ya I think so, because it shows factory mode in the screen already.I am expecting that the imei will be converted to 004 but it still shows null.
Anyway, tnx for a big hand.Now then, I'll try to use special box to re-write the original imei.tnx tnx...really appreciate it
Click to expand...
Click to collapse
You got any files in your /efs now?

tys0n said:
You got any files in your /efs now?
Click to expand...
Click to collapse
I used Root Explorer to check the folder and my imei is empty.Unfortunately I have no efs backup.
Any recommendation sir?tnx

cz4r3n said:
I used Root Explorer to check the folder and my imei is empty.Unfortunately I have no efs backup.
Any recommendation sir?tnx
Click to expand...
Click to collapse
Any "FactoryApp" folder in /efs? If so, try
Code:
adb shell
su
echo -n ON > /efs/FactoryApp/factorymode
to get out of factory mode. Then reboot.
Use dialpad and enter *#*#0011#, use menu button and choose "back" , menubutton and "back" again. There you should have an option to rebuild/restore NV. Doubt it will bring back IMEI tho :/

tys0n said:
Any "FactoryApp" folder in /efs? If so, try
Code:
adb shell
su
echo -n ON > /efs/FactoryApp/factorymode
to get out of factory mode. Then reboot.
Use dialpad and enter *#*#0011#, use menu button and choose "back" , menubutton and "back" again. There you should have an option to rebuild/restore NV. Doubt it will bring back IMEI tho :/
Click to expand...
Click to collapse
It's not working, I dialed *#*#0011# and pressed menu or home button (am I right?) there is no option in choosing "back".

cz4r3n said:
It's not working, I dialed *#*#0011# and pressed menu or home button (am I right?) there is no option in choosing "back".
Click to expand...
Click to collapse
After *#*#0011# you should get to factoryapp settings. When you push menubutton you will get a menu where you can choose back.
Btw, are you on stock rom?

tys0n said:
After *#*#0011# you should get to factoryapp settings. When you push menubutton you will get a menu where you can choose back.
Btw, are you on stock rom?
Click to expand...
Click to collapse
Yes I'm on stock rom.Btw, I used this *#0011# and it prompt me in Service Menu and I used below method also but it's not working:
1. Dial *#0011#
2. press Menu then tap BACK
3. press the Menu again the tap KEY INPUT then enter 1, (wait a few seconds) it auto jumped into service menu.
4. press Menu then tap BACK
Your are now in the SERVICE MODE MAIN MENU
Click to expand...
Click to collapse
Service Menu still blank

cz4r3n said:
Yes I'm on stock rom.Btw, I used this *#0011# and it prompt me in Service Menu and I used below method also but it's not working:
Service Menu still blank
Click to expand...
Click to collapse
Not sure why that is :/ Try to reflash stock in odin.

tys0n said:
Not sure why that is :/ Try to reflash stock in odin.
Click to expand...
Click to collapse
I already did.before I'm on 4.1.2 but i downgraded to 4.1.1 to make sure.but still no luck...
I think because of the absence of nv_data.

cz4r3n said:
I already did.before I'm on 4.1.2 but i downgraded to 4.1.1 to make sure.but still no luck...
Click to expand...
Click to collapse
Ok. I'll send you a pm. Let's see if we can work this out.

Related

how do you wipe an ext3 partition from console?

I need to wipe my ext part from the console how can I do this?
in the console:
mount /system
rm -r /system/sd/
are you spacing these commands? It is not working
From recovery console
Code:
mke2fs -j /dev/block/mmcblk0p2
Will completely reformat ext3 partition destroying data and rebuilding table.
pistol4413 said:
in the console:
mount /system
rm -r /system/sd/
Click to expand...
Click to collapse
um, don't you have to mount the partition as rw first?
Code:
mount -o rw /dev/block/mmcblk0p2 /system/sd
This is how I installed without any problems:
: rename to update.zip
: place in the root of sd card
: shut off device
: boot into recovery
: wipe (alt w)
: go to console (alt x) and hit enter
(enter)
# mount -o rw /dev/block/mmcblk0p2 /system/sd
# cd /system/sd
# rm -rf /system/sd/*
# reboot recovery
: now wipe again (alt w)
: run a filesystem check from the menu. If it tells you to run it manually,
drop to a console (alt+x) and run "e2fsck /dev/block/mmcblk0p2".
: flash
Enjoy!!
AdrianK said:
um, don't you have to mount the partition as rw first?
Code:
mount -o rw /dev/block/mmcblk0p2 /system/sd
Click to expand...
Click to collapse
Lol yea i forgot to add it in srry
I, personally, used to use the recovery console or adb. But just download ubuntu and run it from live cd (basically boots linux from cd without installing anything on hard drive). Partition tool inside the OS beats any other method.
dumfuq said:
From recovery console
Code:
mke2fs -j /dev/block/mmcblk0p2
Will completely reformat ext3 partition destroying data and rebuilding table.
Click to expand...
Click to collapse
use that one. Best one available. doing a rm -rf on /system/sd sometimes still leaves some files. reformating ext3 and rebuilding the tables are the best way
yourtravelboy said:
This is how I installed without any problems:
: rename to update.zip
: place in the root of sd card
: shut off device
: boot into recovery
: wipe (alt w)
: go to console (alt x) and hit enter
(enter)
# mount -o rw /dev/block/mmcblk0p2 /system/sd
# cd /system/sd
# rm -rf /system/sd/*
# reboot recovery
: now wipe again (alt w)
: run a filesystem check from the menu. If it tells you to run it manually,
drop to a console (alt+x) and run "e2fsck /dev/block/mmcblk0p2".
: flash
Enjoy!!
Click to expand...
Click to collapse
Would you mind to tell me that if this instruction also apply to reformat ext3. I ask this question because I see the "mmcblk0p2" instead of "mmcblk0p3" in your instuction. I saw some posts which indicate that mmcblk0p2 is for ext2 but the mmcblk0p3 is for ext3. Am I correct?
p_pen said:
Would you mind to tell me that if this instruction also apply to reformat ext3. I ask this question because I see the "mmcblk0p2" instead of "mmcblk0p3" in your instuction. I saw some posts which indicate that mmcblk0p2 is for ext2 but the mmcblk0p3 is for ext3. Am I correct?
Click to expand...
Click to collapse
no, mmcblk0 references your sdcard mmcblk0px means partition substitute in 1 for fat32, 2 for ext2/3/4, and 3 for linux-swap.
p_pen said:
Would you mind to tell me that if this instruction also apply to reformat ext3. I ask this question because I see the "mmcblk0p2" instead of "mmcblk0p3" in your instuction. I saw some posts which indicate that mmcblk0p2 is for ext2 but the mmcblk0p3 is for ext3. Am I correct?
Click to expand...
Click to collapse
This is Not correct.
Everything in /dev/block is a different block device
mmcblk0p3 represents the third partition on you sdcard.
Usually this would be a linux swap partition.
To format ext3 look at my post above...for ext2 just remove the -j flag in the command.
dumfuq said:
This is Not correct.
Everything in /dev/block is a different block device
mmcblk0p3 represents the third partition on you sdcard.
Usually this would be a linux swap partition.
To format ext3 look at my post above...for ext2 just remove the -j flag in the command.
Click to expand...
Click to collapse
thanks for the simple ass formatting command. i actually bookmarked this page so that whenever this question is asked again (we all know it will be) i can easily pop this answer out.
I appreciate for your quick ans. It really solve my concern.
david1171 said:
thanks for the simple ass formatting command. i actually bookmarked this page so that whenever this question is asked again (we all know it will be) i can easily pop this answer out.
Click to expand...
Click to collapse
You should probably just memorize it.
mke2fs -j
Make_extended2_filesystem with journal
I thought this thread died just gave up just revisited this and it works thank you all for your help the command is "mke2fs /dev/block/mmcblk0p3" thank you I am sick of using acronis disk director it works but this takes an extra 10 min.
confused
can someone explain this more.
What is recovery console? How do i get there? Cause if its in my phone I cant get to it cause my boot screen is looping
Can you explain step by step in more detail
spazoid said:
can someone explain this more.
What is recovery console? How do i get there? Cause if its in my phone I cant get to it cause my boot screen is looping
Can you explain step by step in more detail
Click to expand...
Click to collapse
Boot pressing Home + Power
Scroll down to Enter Console
click the trackball
it will say <Press Enter>, so press enter
then type the following
Code:
mke2fs -j /dev/block/mmcblk0p2
and press enter
your ext is partitioned
to reboot your phone, type
Code:
reboot
and press enter
spazoid said:
can someone explain this more.
What is recovery console? How do i get there? Cause if its in my phone I cant get to it cause my boot screen is looping
Can you explain step by step in more detail
Click to expand...
Click to collapse
how exactly have you used your phone without knowing what the recovery console is.......
power down your phone
hold home and power to boot it up
press alt and x on the keyboard
press enter
type mke2fs -j /dev/block/mmcblk0p2
now type reboot recovery
wipe your phone
flash your rom.
reboot your phone with home and back.
Somebody please kill me!
Its clear the op didnt ****ing search when he asked this, otherwise he would have found my post explaining how to wipe your ext partition from your console. God dammit this is pissing me off

The CWM for Ouya project

Well, since i'm not aware of anyone else doing it, and it will be necessary for any real development to occur, I have decided to try porting Clockworkmod Recovery to the Ouya. I am downloading ubuntu right now and I'll start trying to build it from source against our current recovery tonight or tomorrow night depending on how long the setup and prerequisites take.
The reason I'm posting this now, is to solicit help. I've never built CWM before, but XDA has a really great tutorial I'm going to follow, but if anyone here has had experience in the past I'd love some help/tips, and other than that I would like a few brave souls to volunteer and try flashing it on their Ouya when/if I have a build that works on my own.
I'll update this thread with my progress, if I make any, and please let me know if any of you are willing to help in any way.
Update 1:
I have compiled a version of CWM recovery that theoretically should work, but I'm unable to flash it. I have installed flash_image onto the ouya and it works fine, but i normally would have used "flash_image recovery recovery.img" however there is no "recovery" partition on the ouya. This is what I get:
./flash_image recovery recovery.img
error scanning partitions: No such file or directory
Mount reveals the following info:
mount
rootfs / rootfs ro,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/platform/sdhci-tegra.3/by-name/APP /system ext4 ro,relatime,user_xatt
r,acl,barrier=1,data=ordered 0 0
/dev/block/platform/sdhci-tegra.3/by-name/CAC /cache ext4 rw,nosuid,nodev,noatim
e,errors=panic,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=wri
teback 0 0
/dev/block/platform/sdhci-tegra.3/by-name/UDA /data ext4 rw,nosuid,nodev,noatime
,errors=panic,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=writ
eback 0 0
/dev/fuse /storage/sdcard0 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1
023,default_permissions,allow_other 0 0
This is the script from the OTA update:
#!/system/bin/sh
if ! applypatch -c EMMC:/dev/block/platform/sdhci-tegra.3/by-name/SOS:5906432:f80238c4f4a53888b547e4463fb4751343f23412; then
log -t recovery "Installing new recovery image"
applypatch EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5277696:5d7013bf98f76199ea5b7d7d8baeb07fa3ad26ff EMMC:/dev/block/platform/sdhci-tegra.3/by-name/SOS f80238c4f4a53888b547e4463fb4751343f23412 5906432 5d7013bf98f76199ea5b7d7d8baeb07fa3ad26ff:/system/recovery-from-boot.p
else
log -t recovery "Recovery image already installed"
fi
but I can't make any sense of it. If anyone can help out i'd much appreciate it...
sonofskywalker3 said:
but I can't make any sense of it. If anyone can help out i'd much appreciate it...
Click to expand...
Click to collapse
This seems to be the magic lines in the update script:
if ! applypatch -c EMMC:/dev/block/platform/sdhci-tegra.3/by-name/SOS:5906432:f80238c4f4a53888b547e4463fb4751343f23412; then
log -t recovery "Installing new recovery image"
applypatch EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5277696:5d7013bf98f76199ea5b7d7d8baeb07fa3ad26ff EMMC:/dev/block/platform/sdhci-tegra.3/by-name/SOS f80238c4f4a53888b547e4463fb4751343f23412 5906432 5d7013bf98f76199ea5b7d7d8baeb07fa3ad26ff:/system/recovery-from-boot.p
Click to expand...
Click to collapse
I don't know much about the applypatch program. It might just be another script. Since it isn't being called with a "./", I'd imagine it is installed somewhere that the path mentions. Try looking for "applypatch" to see if it is a program or script. In a terminal running on the Ouya, try running "echo $PATH". Hopefully you get a list of directories containing program locations (e.g. /usr/bin/ ...etc). Applypatch might be in one of those directories.
UPDATE 1:
applypatch is a binary, not a script. It is located in /system/bin/
I tried running it without arguments on my Nexus 7 (to see if we would luck out with a nice "usage" message), but for some annoying reason I can't give it execute permissions, even as root. I'll look deeper into the scripts
UPDATE 2:
I need to verify this on my Ouya, but from the updater-script in the latest OTA, the kernel partition is /dev/block/platform/sdhci-tegra.3/by-name/LNX (I'm going out on a limb here boys, but I think LNX stands for Linux, aka, our kernel, lol).
UPDATE 3:
Seems like the recovery partition is /dev/block/platform/sdhci-tegra.3/by-name/SOS
I don't know much about the details of "applypatch", but the recovery script you posted above seems to first check to see if the recovery partition hashes to f80238c4f4a53888b547e4463fb4751343f23412 (the hash of the latest and greatest recovery). If it doesn't, then we flash the latest recovery, which from the looks of it consists of the kernel (in LNX) with a patch applied to it from recovery-from-boot.p (another mess of binary). In other words, it looks like they build a recovery from the existing kernel, as the name "recovery-from-boot" implies (the kernel is packaged in a file called boot.img).
Long story short, it looks like you can write to the block device /dev/block/platform/sdhci-tegra.3/by-name/SOS to write a new recovery. Aka, in a hacked version of the OTA script, include the line
package_extract_file("recovery.img", "/dev/block/platform/sdhci-tegra.3/by-name/SOS");
where recovery.img is the name of your new recovery. They did something very similar to the kernel (LNX). I'm pretty sure that the correct way to do something like this is to use "dd" after verifying the image is correct (by running a hash against the image). I'm not sure why the Ouya team is using package_extract_file() instead of dd. I'm not in front of my Ouya though, LNX and SOS could be folders rather than block devices (although /dev/block seems to imply otherwise).
You can remove most of the other lines in the script that install the actual OTA update files. If you need help, let me know. I can make a custom update-script for you.
WARNING!!!!!!!! The above is just my take on things from looking at the scripts for 20 minutes. This could total brick your device if your recovery isn't of the right format or is not correctly built. Don't say I didn't warn ya.
You might want to read off the contents of the SOS to compare in a hex editor to your recovery. We might find out some things that would prevent a brick.
Sent from my Nexus 7 using xda premium
Thank you for all your detailed information. I assumed that if my cwm recovery build failed I could just flash the boot.img from the ota and restore it, but it sounds like that might not be correct if the update is dependent on a hashed, preexisting recovery/kernel. I used the boot.img from the ota to build the recovery at http://builder.clockworkmod.com/ and it showed successful and gave me these four files:
https://dl.dropboxusercontent.com/u/7653846/Archive.zip
So to test, should I be able to flash_image /dev/block/platform/sdhci-tegra.3/by-name/SOS recovery.img?
my concern is that particular block doesn't show up on a mount command...
sonofskywalker3 said:
Thank you for all your detailed information. I assumed that if my cwm recovery build failed I could just flash the boot.img from the ota and restore it, but it sounds like that might not be correct if the update is dependent on a hashed, preexisting recovery/kernel. I used the boot.img from the ota to build the recovery at http://builder.clockworkmod.com/ and it showed successful and gave me these four files:
https://dl.dropboxusercontent.com/u/7653846/Archive.zip
So to test, should I be able to flash_image /dev/block/platform/sdhci-tegra.3/by-name/SOS recovery.img?
my concern is that particular block doesn't show up on a mount command...
Click to expand...
Click to collapse
I'm putting together an zip to flash in the stock recovery. This way we mimic what the stock updates do to flash over partitions.
I'm reading http://forums.ouya.tv/discussion/1380/recovery-mode right now in order to figure out how to get into the stock recovery.
One thing that I noticed is that I think your recovery is slightly larger than the stock one. I'm not sure how large SOS is, but I wouldn't want to flash over adjacent blocks (i.e. write out of bounds).
Makes sense. You must know something I don't if you can get it to flash in stock recovery... I tried simply adding files to the ota zip and flashing it and it failed.
sonofskywalker3 said:
Makes sense. You must know something I don't if you can get it to flash in stock recovery... I tried simply adding files to the ota zip and flashing it and it failed.
Click to expand...
Click to collapse
It probably doesn't work because the update.zip we're using is signed.
Just a thought, but an easier way to go, albeit dangerous, is to do the following. You need root access over adb to do this. Using dd is VERY dangerous. THIS MIGHT NOT WORK. We need to make sure that what we are writing to (/dev/block/platform/sdhci-tegra.3/by-name/SOS) is truly the block device containing the recovery partition or else this might brick the Ouya. In the past, I've seen recovery written to /dev/block/mmcblk0pX, where X is the recovery partition for the particular device. I'm not much of a tegra guy. I know more about Samsung's stuff.
1) place the recovery.img on your ouya (let's say in /sdcard/recovery.img)
2) open a terminal running on your Ouya (over adb would probably be best, e.g. "adb shell")
3) enter a root shell, type "su"
4) make a backup of your existing recovery partition with "dd if=/dev/block/mmcblk0p1 of=/sdcard/origRecovery.img"
5) write the new recovery to the recovery partition with "dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p1"
6) perform the following from user mbm in the Ouya forums to get into recovery (thread http://forums.ouya.tv/discussion/1380/recovery-mode)
This is a hack, an unintended sequence of events that results in recovery mode; what you need to do is crash the startup using sysrq.
For this you'll need a usb keyboard with the sysrq key, this is usually the printscreen button if your keyboard isn't labeled. As the OUYA starts to boot, hold down the alt-sysrq keys and press i, wait a few seconds and then repeat. This key combination is kill-all-tasks; thanks to whoever left this enabled in the kernel. Each time you kill the tasks the init process will restart them, after about 5 or 6 times init will print a warning on the console that one of the processes marked critical has been restarted too many times -- this then triggers an automatic reboot into recovery mode.
Unfortunately it's not always obvious when the ouya is in recovery mode. You might get screen with the ouya logo and a large red exclamation mark, or the screen might be entirely black; usually I got a black screen. Press the home button on the keyboard to bring up the recovery menu; it's actually a toggle so feel free to press the home button repeatedly until you see the menu since the timing isn't otherwise obvious.
Click to expand...
Click to collapse
There are two big unknowns here:
1) We don't know for sure that the new recovery (CWM) will actually work
2) We don't know for sure that /dev/block/platform/sdhci-tegra.3/by-name/SOS is the correct place to be writing a recovery
I'll see what I can dig up regarding /dev/block/platform/sdhci-tegra.3/by-name/SOS
---------- Post added at 02:53 PM ---------- Previous post was at 02:30 PM ----------
/dev/block/platform/sdhci-tegra.3/by-name/SOS is a link to /dev/block/mmcblk0p1
So far, it appears that the layout is the following:
Kernel (boot.img) is mmcblk0p2
Recovery is mmcblk0p1
System is mmcblk0p3
Sent from my SCH-I535 using xda premium
---------- Post added at 02:56 PM ---------- Previous post was at 02:53 PM ----------
I would imagine that if the recovery partition really is SOS, then the above steps would work if you could run them as root.
Sent from my SCH-I535 using xda premium
Some definite info:
SOS is recovery
OUYA firmware updates patches the boot partition on the fly (binary patching) - silly and error prone, but *shrug*. Don't need apply patch at all. dd is fine
It's much safer to use 'fastboot boot recovery.img' while in fastboot mode. This allows loading recovery or boot.img's into ram and execute them from there. Once that works 100%, you can flash it to SOS.
As most people already know, it's not possible to force the device into recovery. It has to be done with something like 'adb reboot recovery'.
mybook4 said:
I'm putting together an zip to flash in the stock recovery. This way we mimic what the stock updates do to flash over partitions.
I'm reading http://forums.ouya.tv/discussion/1380/recovery-mode right now in order to figure out how to get into the stock recovery.
One thing that I noticed is that I think your recovery is slightly larger than the stock one. I'm not sure how large SOS is, but I wouldn't want to flash over adjacent blocks (i.e. write out of bounds).
Click to expand...
Click to collapse
It's 8MB. If you dd to the block device (e.g. mmcblk0p1), you can't write out of bounds. The linux kernel knows the size and refuses it.
rayman said:
Some definite info:
SOS is recovery
OUYA firmware updates patches the boot partition on the fly (binary patching) - silly and error prone, but *shrug*. Don't need apply patch at all. dd is fine
It's much safer to use 'fastboot boot recovery.img' while in fastboot mode. This allows loading recovery or boot.img's into ram and execute them from there. Once that works 100%, you can flash it to SOS.
As most people already know, it's not possible to force the device into recovery. It has to be done with something like 'adb reboot recovery'.
Click to expand...
Click to collapse
I did the following with skywalker's recovery.
1) Attached a usb keyboard to the Ouya's full size usb port
2) Attached my computer to the Ouya's micr usb port
3) Ran "adb reboot bootloader" (the Ouya rebooted to a blank screen)
4) Waited 30 seconds and ran "fastboot boot recovery.img" (skywalker's recovery file)
The Ouya rebooted into CWM Recovery v6.0.3.2!
Error messages were encountered on the recovery screen (image attached)
5) Navigated around CWM with the arrow keys and the enter key
6) Rebooted with "reboot system now". Ouya booted right up.
When we flash the recovery to mmcblk0p1, we should rename /system/etc/install-recovery.sh (and maybe /system/recovery-from-boot.p) to prevent the recovery partition from being overwritten.
Looks like we need to adjust the recovery so it properly mounts the partitions. Hopefully after that we are good to go.
Wow, that's awesome progress! So I'll try the same steps when I get home tonight and then try building another recovery with proper mount points.
sonofskywalker3 said:
Wow, that's awesome progress! So I'll try the same steps when I get home tonight and then try building another recovery with proper mount points.
Click to expand...
Click to collapse
I think it should be a matter of placing the proper partitions in the fstab prior to creating the recovery image. From the error messages it looks like /cache and /data are the culprits.
If you get a chance to, please post the fstab you use so we can double check everything (want to avoid the potential for bricks).
Sent from my SCH-I535 using xda premium
I did the build without a custom fstab first to see if it would work. I'll make one tonight, or if anyone here has done it before feel free to make sure it's done right, this will be my first try at it.
Update:
Started making the fstab and got rid of the errors on my second build, seems it still can't mount some. making progress though.
Update2:
I have compiled a new recovery using the following recovery.fstab:
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA
/sdcard fuse /dev/fuse
this is based on information gathered from the mount command in an adb shell. it no longer gives the long string of errors, or complains that it can't mount any partitions except i get the following errors now:
can't mount /cache/recovery/command
can't mount /cache/recovery/last_log
can't open /cache/recovery/last_log
and a few others. not sure how to proceed at this point. I'm searching Google, but has anyone run into this before?
sonofskywalker3 said:
I did the build without a custom fstab first to see if it would work. I'll make one tonight, or if anyone here has done it before feel free to make sure it's done right, this will be my first try at it.
Update:
Started making the fstab and got rid of the errors on my second build, seems it still can't mount some. making progress though.
Update2:
I have compiled a new recovery using the following recovery.fstab:
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA
/sdcard fuse /dev/fuse
this is based on information gathered from the mount command in an adb shell. it no longer gives the long string of errors, or complains that it can't mount any partitions except i get the following errors now:
can't mount /cache/recovery/command
can't mount /cache/recovery/last_log
can't open /cache/recovery/last_log
and a few others. not sure how to proceed at this point. I'm searching Google, but has anyone run into this before?
Click to expand...
Click to collapse
I'm still new at making a recovery.fstab, but I noticed the following:
From running "ls -l /dev/block/platform/sdhci-tegra.3/by-name/"
lrwxrwxrwx root root 2013-05-25 02:23 APP -> /dev/block/mmcblk0p3
lrwxrwxrwx root root 2013-05-25 02:23 CAC -> /dev/block/mmcblk0p4
lrwxrwxrwx root root 2013-05-25 02:23 LNX -> /dev/block/mmcblk0p2
lrwxrwxrwx root root 2013-05-25 02:23 MDA -> /dev/block/mmcblk0p8
lrwxrwxrwx root root 2013-05-25 02:23 MSC -> /dev/block/mmcblk0p6
lrwxrwxrwx root root 2013-05-25 02:23 SOS -> /dev/block/mmcblk0p1
lrwxrwxrwx root root 2013-05-25 02:23 UDA -> /dev/block/mmcblk0p9
lrwxrwxrwx root root 2013-05-25 02:23 UPP -> /dev/block/mmcblk0p5
lrwxrwxrwx root root 2013-05-25 02:23 USP -> /dev/block/mmcblk0p7
Click to expand...
Click to collapse
Since the APP, CAC, LNX files are links to mmcblk0pX devices, maybe we should be using the mmcblk0pX names?
We should look at more examples to see what the recovery.fstab for other devices looks like. From what I've seen of other devices, mmcblk0pX devices are listed in recovery.fstab.
P.S. So far, I think we are fairly certain that
APP is the system partition
CAC is the cache partition
LNX is kernel boot.img
SOS is the recovery partition
I'm not sure what the rest are (data, etc). Is there a definitive list somewhere?
Here's what I was able to find based on your suggestion, it's the recovery.fstab from the nexus 7:
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA length=-32768
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX
/recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
Obviously this isn't exactly right, but it's a start until we can find more about the mounts.
I tried making the recovery.fstab using the mmcblk numbers but that made no difference... Cache always mounts empty. I'm going to try one more thing, then I'll post my final results and go to bed.
Update:
Well still no love, and no noticeable progress between recovery 2 and 7, but I feel like we're chipping away in the right direction. I'll seek some help from some more experienced recovery people tomorrow.
sonofskywalker3 said:
Here's what I was able to find based on your suggestion, it's the recovery.fstab from the nexus 7:
/systemext4/dev/block/platform/sdhci-tegra.3/by-name/APP
/cacheext4/dev/block/platform/sdhci-tegra.3/by-name/CAC
/dataext4/dev/block/platform/sdhci-tegra.3/by-name/UDAlength=-32768
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/bootemmc/dev/block/platform/sdhci-tegra.3/by-name/LNX
/recoveryemmc/dev/block/platform/sdhci-tegra.3/by-name/SOS
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
Obviously this isn't exactly right, but it's a start until we can find more about the mounts.
I tried making the recovery.fstab using the mmcblk numbers but that made no difference... Cache always mounts empty. I'm going to try one more thing, then I'll post my final results and go to bed.
Click to expand...
Click to collapse
Good stuff.
Not sure how we are going to get the field length= . I noticed the same field being used in the US Galaxy S III recovery https://raw.github.com/CyanogenMod/android_device_samsung_d2-common/cm-10.1/recovery.fstab
length= field is probably not needed, as the stock recovery doesn't list it.
Sent from my SCH-I535 using xda premium
Here's the recovery.fstab from my Ouya's recovery partition.
# mount point fstype device
/recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS
/boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
/metadata emmc /dev/block/platform/sdhci-tegra.3/by-name/MDA
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA
/sdcard vfat /dev/block/platform/sdhci-tegra.0/by-num/p1
Click to expand...
Click to collapse
I tried doing CWM build with this recovery.fstab. /system, /data, and /cache all mounted.
Couldn't mount /sdcard automatically (trying to choose zip from sdcard) or manually (in mounts and storage, mount /sdcard).
I tweaked the recovery.fstab to the following:
/recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS
/boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
/metadata emmc /dev/block/platform/sdhci-tegra.3/by-name/MDA
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA
/sdcard datamedia /dev/null
Click to expand...
Click to collapse
This one mounted /sdcard correctly. I can "choose a zip from sdcard". I didn't actually choose a zip yet. I didn't format any of the partitions. I suppose we could try making a quick cwm zip to write something to the sdcard to test it out.
I've attached the stock Ouya recovery.img (from SOS partition). THIS IS NOT A CWM FLASHABLE ZIP, it only contains a zipped up version of the stock recovery.img. The md5 hash of the unzipped recovery.img is a6c1a6962984e9080ed8821628c4cc3f.
I've attached the CWM recovery.img that worked for me. THIS IS NOT A CWM FLASHABLE ZIP, it only contains a zipped up version of a newly built CWM recovery.img. The md5 hash of the unzipped recovery.img is c6b37906f280b16cd200503c3cde6dfb.
well, when I build using your suggested recovery.fstab i'm still getting the same error about the cache, but i booted the cwm you built and saw what you meant. can you post your actual recovery.fstab file so I can try to build with it? where did you get the boot.img you are using?
Update!
It worked!! I booted to your attached cwm and I'm running a nandroid backup right now. I'll try a restore next. In the meantime I'm putting together a Playmusic.zip flashable zip with the files necessary to get play music up and running and I'll try flashing it. Awesome work tracking down those partitions!
sonofskywalker3 said:
well, when I build using your suggested recovery.fstab i'm still getting the same error about the cache, but i booted the cwm you built and saw what you meant. can you post your actual recovery.fstab file so I can try to build with it? where did you get the boot.img you are using?
Click to expand...
Click to collapse
I edited the comment right above yours.
Recovery Builder wants the stock recovery.img, so I used adb to copy my Ouya's recovery partition to the sdcard, then I used adb pull to copy the recovery partition to my computer.
1) adb shell
2) su
3) cd /dev/block/platform/sdhci-tegra.3/by-name
4) dd if=SOS of=/sdcard/stockRecovery.img
5) exit
6) adb pull /sdcard/stockRecovery.img .
I used the recovery.fstab attached to this post. I obtained the stock Ouya recovery.fstab by doing the following:
I used split_bootimg.pl to split up the recovery.img into kernel and ramdisk (see Alternate Method in http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images). I used gzip to unzip the ramdisk and saw the stock recovery.fstab in /etc.
Here's what I did step by step:
1) split_bootimg.pl stockRecovery.img
2) mkdir ramdisk
3) cd ramdisk
4) gzip -dc ../stockRecovery.img-ramdisk.gz | cpio -i
in the ramdisk directory is etc/recovery.fstab
I then copied this file and edited the last line (/sdcard stuff). I used the new recovery.fstab with the Recovery Builder.
sonofskywalker3 said:
It worked!! I booted to your attached cwm and I'm running a nandroid backup right now. I'll try a restore next. In the meantime I'm putting together a Playmusic.zip flashable zip with the files necessary to get play music up and running and I'll try flashing it. Awesome work tracking down those partitions!
Click to expand...
Click to collapse
Awesome! Let us know how the backup/restore and zip flashing goes.
Once we verify that this CWM works correctly, people should be able write the new recovery by doing the following (NOTE this wasn't tested yet. I need to test it out first):
1) adb reboot bootloader
2) wait 30 seconds (blank screen is normal)
3) fastboot flash recovery recovery.img
4) fastboot reboot recovery (need a usb keyboard to navigate CWM)
5) flash a CWM zip to prevent stock recovery overwrite (we need to make this. The zip file should mount /system, rename recovery-from-boot.p to recovery-from-boot.bak, and unmount /system)
6) profit
Most of this could potentially be automated into a root/install CWM script.
Backup worked fine, flash worked and I'm booting now to make sure it put the files where it was supposed to and see if they work. Then i'll reboot and restore and make sure those files go away.One thing to note is that when i choose reboot system now it asked me to disable recovery flash,so I took the plunge and said yes, we'll see if it goes back to stock or not...
Update:
The .zip I built said it flashed correctly (unless i'm reading wrong the parts i could see with the overscan problems i'm having) but the files did not go to /system/app. I have attached the .zip file to see if I did something wrong with it, I just grabbed a sample from online and changed the files, haven't checked updater-script yet. I am restoring now, will post update on if that works.
It rebooted to stock recovery, as I expected, so still haven't flashed it just yet.
Well my oversensitive keyboard just hit enter twice so I'm actually backing up again, but I have to leave and take my daughter to a muesuem now, so I won't be able to continue until later. Good luck, i'll be keeping up with this thread on my phone.
Edit: removed non working zip

Phone won't accept decryption (FDE) password anymore.

My device: HTC One M7 Android 4.2.2, S-ON, Root, CWM recovery (years old version)
My ultimate goal was: Get xposed framework. Install via app failed after rebooting due to S-ON, so I wanted to install through recovery. (this is irrelevant to the issue IMO)
What I tried to get there: Decrypting my /data partition in adb (because CWM doesn't support it)
What I found: https : // forumDOTfairphoneDOTcom/t/how-to-mount-encrypted-data-in-recovery/25724
Everything(!) I actually did: (commands after $ means executed on host machine (ubuntu), prefixed by ~ # means run on phone in adb shell)
$ adb shell
~ # setprop ro.crypto.state encrypted
~ # vdc cryptfs checkpw "<wrong password>"
200 0 1
~ # mount /dev/block/dm-0 /data
mount: mounting /dev/block/dm-0 on /data failed: no such file or directory
(( a couple commands like ls and cat to find out what my /data partition should be ))
(( ended up finding out in fstab that it's mmcblk0p37 ))
~ # mount /dev/block/mmcblk0p27 ((accidentally wrong one))
mount: mounting /dev/block/mmcblk0p27 on /data failed: Invalid argument
~ # mount /dev/block/mmcblk0p37
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
(( notice i entered wrong password ))
~ # vdc cryptfs checkpw "<right password>"
200 0 2
~ # mount /dev/block/mmcblk0p37
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
(( a couple more tried of the previous two commands for no legit reason ))
~ # mount -o rw,remount /dev/block/mmcblk0p37
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
(( exit adb shell ))
(( execute $ adb remount )) (( as google suggested (on host machine, not in adb shell obv) ))
$ adb shell
~ # mount -t ext2 /dev/block/mmcblk0p37 (( accidentally wrong fstype ))
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
~ # mount -t ext4 /dev/block/mmcblk0p37
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
~ # mount -t ext4 /dev/block/mmcblk0p27 (( why not? ))
mount: mounting /dev/block/mmcblk0p37 on /data failed: Invalid argument
~ # exit (( i got frustrated ))
Before I did all this the phone was working normally (after install xposed via app (which gave me xposed version 3x because I had that one previously installed via receovery. But I wanted the newest (5x) so I went all that way)). After I did all these steps - which to me are readonly things which shouldn't brick anything - I got frustrated and wanted to give up, so I rebooted. Now everytime I enter the - 100% correct - password, it tells me to "try again" (guessing it means wrong password? idk).
The whole xposed stuff is irrelevant in my opinion, because after I've installed it using the xposed installer (APK) I rebooted twice and decryption worked fine both times.
What the hell have I done (I'd say I'm a linux expert and I honestly don't see how I could've possible broken anything by what I did) and how can I fix it?
UPDATE: I got myself the cryptheader from the "extra" partition using the read_emmc vulnerability. That way I got the encrypted key and salt. (cryptheader)
I then used this and a modified bruteforce script to check if my right password is still right. Result: It doesn't seem so.
My password contained special characters and was 15 chars long, bruteforce is not an option.
Is there anyway what I did could've changed the password? If so, can I reproduce and get the new key somehow? The cryptheader is not corrupted and still intact. The /data partition (encrypted) is not corrupted and still intact. (I assume this because the encrypted partition's hexdump starts with "This is an encrypted partition", which is a HTC easter egg.)
htcuser311 said:
UPDATE: I got myself the cryptheader from the "extra" partition using the read_emmc vulnerability. That way I got the encrypted key and salt. (cryptheader)
I then used this and a modified bruteforce script to check if my right password is still right. Result: It doesn't seem so.
My password contained special characters and was 15 chars long, bruteforce is not an option.
Is there anyway what I did could've changed the password? If so, can I reproduce and get the new key somehow? The cryptheader is not corrupted and still intact. The /data partition (encrypted) is not corrupted and still intact. (I assume this because the encrypted partition's hexdump starts with "This is an encrypted partition", which is a HTC easter egg.)
Click to expand...
Click to collapse
I'm far from being a linux expert but the simplest would be to factory reset using htc's recovery to remove /data encryption and start from scratch (unless you have some really important data that must be saved from your /data partition)
alray said:
I'm far from being a linux expert but the simplest would be to factory reset using htc's recovery to remove /data encryption and start from scratch (unless you have some really important data that must be saved from your /data partition)
Click to expand...
Click to collapse
I have decided to give up on trying and did a "factory reset" (formatted /data and /data/sdcard through CWM, rebooted, set up device for first use, formatted /data again through CWM to result in clean system).
Fun-fact: Before I did what bricked the system I actually made a backup. The device (µSD-Card) decided to go corrupted filesystem though. I managed to recover most of the files but the /system partition backup (which might have saved me) remained corrupted. I was able to restore all my personal data though, so doing a factory reset wasn't that bad for me.

HELP! SM-N9208 Failed to mount /Efs (invalid argument)

I deleted my efs folder and now it says error. I have tried other fixes from xda like this using twrp and adb
Code:
adb shell
Code:
mke2fs /dev/block/mmcblk0p3
Code:
mount -w -t ext4 /dev/block/mmcblk0p3
Code:
reboot
but everytime i input the first line it says could not stat /dev/block/mmcblk0p3 --- No such file or directory.
And when i try to flash stock firmware using odin whenever i finish flashing it is stuck on samsung logo. Anyone know how to solve this problem and fix? Thanks
dukesterology said:
I deleted my efs folder and now it says error. I have tried other fixes from xda like this using twrp and adb
Code:
adb shell
Code:
mke2fs /dev/block/mmcblk0p3
Code:
mount -w -t ext4 /dev/block/mmcblk0p3
Code:
reboot
but everytime i input the first line it says could not stat /dev/block/mmcblk0p3 --- No such file or directory.
And when i try to flash stock firmware using odin whenever i finish flashing it is stuck on samsung logo. Anyone know how to solve this problem and fix? Thanks
Click to expand...
Click to collapse
If you have taken a back up of your efs through twrp then you can restore it in twrp.
Or
Download latest firmware of your device & reflash it through Odin.

Can you remove encryption?

I setup Lineage 16 on my Xperia X and encrypted the phone. Now whenever I try other ROMS (installed from twrp) it always asks for my encryption password in TWRP and on bootup. I've already tried wiping all of the partitions, I've tried changing the filesystems, I've tried the ADB command ./adb shell recovery --wipe_data --set_filesystem_encryption=off
Encryption is still intact. What can I do to nuke the phone?
I experienced something similar a while ago and if I recall correctly then played around in TWRP with "repair filesystem", and finally I got it working unencrypted again
I was in the same situation. The only way for me was to install a stock fw with Flashtools (while in bootloader mode)...and start again from zero.
Connect to PC and enter recovery
Then type following commands
Caution!!
You will lose all data!!
$ adb shell
# umount /data
# umount /sdcard
# make_ext4fs /dev/block/platform/msm_sdcc.1/by-name/userdata
Click to expand...
Click to collapse
This is pure format command. Encryption will be removed.
But only these commands we loose crypt footer. (We can never re-encrypt)
You had better add these commands also.
$ adb shell
# umount /data
# umount /sdcard
# make_ext4fs /dev/block/platform/msm_sdcc.1/by-name/userdata
(Upper section commands)
# e2fsck -f /dev/block/platform/msm_sdcc.1/by-name/userdata
(You should check "Block count" section)
# resize2fs -f /dev/block/platform/msm_sdcc.1/by-name/userdata xxxxxxxx
Click to expand...
Click to collapse
If "Block count" equals 2991611, type like this (subtract 4 from block count... 2991611-4=2991607)
# resize2fs -f /dev/block/platform/msm_sdcc.1/by-name/userdata 2991607
Click to expand...
Click to collapse

Categories

Resources