Hello all,
Last night I ran the following command (with the phone in recovery and everything unmounted) to back up my Nexus 5's userdata partition to my computer:
Code:
adb pull /dev/block/platform/msm_sdcc.1/by-name/userdata
My phone is encrypted, so I use "cryptsetup --type=plain open" to obtain a plaintext version on /dev/mapper/my-nexus-backup. But I cannot mount the mapped device using "mount"! It complains that iit can't find the filesystem.
So, how would I mount such an image? Or, even better, what's the best way to dd it back to the userdata partition on the device?
And yes, next time I will just use a Nandroid, even if it means having to erase things to make room.
See if @rootSU or @bitdomo can help. They're gurus at this type of stuff
Sent from my Nexus 5 using XDA Free mobile app
Sorry, where are you mounting exactly? Are you trying to mount an image on a Linux box after the pull?
If not can you please share the full step of commands and what you expect to happen please?
Sent from my Nexus 5 using Tapatalk
rootSU said:
Sorry, where are you mounting exactly? Are you trying to mount an image on a Linux box after the pull?
If not can you please share the full step of commands and what you expect to happen please?
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Hey rootSU. I pulled the image from my phone, decrypted it, and tried to mount it:
Code:
$ adb pull /dev/block/platform/msm_sdcc.1/by-name/userdata
$ su
# losetup /dev/loop1 userdata
# cryptsetup open --type plain /dev/loop1 nexus
Enter passphrase:
# mount /dev/mapper/nexus /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/mapper/nexus,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
I'm not sure why that doesn't work. It's just ext4, right? I'd still find it instructive to figure out how to mount it; hopefully you can shed some light?
As far as getting the image back on the device's partition, I was a bit stuck, because there's obviously no room on the device to copy it to. I finally figured out a method involving netcat. Essentially I forwarded a local TCP port to my device (in recovery) using adb, then used netcat to feed dd the image.
Code:
$ adb forward tcp:4444 tcp:4444
$ adb shell
# nc -l -p 4444 -e dd of=/dev/block/platform/msm_sdcc.1/by-name/userdata
This will hang as it waits for an inbound connection. From a second shell:
Code:
$ dd if=userdata | nc localhost 4444
My 28GiB image took around 6 hours (!) to complete. Nandroid is probably the way to go.
Nandroid won't backup sdcard but you can use foldersync to back that up.
Yes it is just ext4
I've never done anything like this before with an encrypted device but my assumption was if you adb pull a file, it would decrypt it on the fly.. Does it not?? If it does, I'd just dd it to an img.
Sent from my Nexus 5 using Tapatalk
rootSU said:
Nandroid won't backup sdcard but you can use foldersync to back that up.
Yes it is just ext4
I've never done anything like this before with an encrypted device but my assumption was if you adb pull a file, it would decrypt it on the fly.. Does it not?? If it does, I'd just dd it to an img.
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Nope, in this case, userdata is the encrypted *device*; in any case TWRP knows nothing about the encryption. The pull was identical to using dd to copy the file. Of course, if you wanted to decrypt your device without wiping data, you could probably have TWRP decrypt the data partition, then dd or pull the resulting /dev/block/dm-0 file (which is equivalent to my /dev/mapper/nexus file I created). Haven't tried it though; ain't nobody got time for that.
I wonder why it wouldn't mount. Oh well. I'm just happy that my device is the way it was yesterday.
I'd love to have a play with this but I just don't have the time to start encrypting and decrypting stuff
Out of interest what about adb whilst in android?
Sent from my Nexus 5 using Tapatalk
rootSU said:
I'd love to have a play with this but I just don't have the time to start encrypting and decrypting stuff
Out of interest what about adb whilst in android?
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
You would have the exact same results, as the /dev/* files are the physical disks represented as a file. The crypto drivers read/write this block device file to present a decrypted /dev/block/dm-0 device. Then the kernel mounts dm-0 as an ext4 filesystem on /data. All the files I mentioned are pullable with adb, assuming you have sufficient privileges. You don't need fancy tools to read/write them, which is why the netcat hack worked. Thus is the power of Unix!
You can screw around with it if you want in regular desktop Linux with a "device" you make from a bunch of 0s. Do:
Code:
# dd if=/dev/zero of=disk.image count=100000
# losetup /dev/loop0 disk.image
Now you can do "mkfs.ext4 /dev/loop0" and "mount ..." or whatever, and the data will be written to the "device" disk.image.
some time ago I backed up /dev/block/sda from my android 12 phone.
I forgot it was encrypted..
and that it had 34 partitions.
userdata partition WAS sda34.
how can I momentarily mount the backup in android?
losetup is present...
Related
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
I get "/system/bin/sh: fdisk: not found" when trying to run the command. Tried running as su as well, it still said fdisk wasn't found.
SteveG12543 said:
I get "/system/bin/sh: fdisk: not found" when trying to run the command. Tried running as su as well, it still said fdisk wasn't found.
Click to expand...
Click to collapse
Hmm, would you mind trying from ADB in recovery?
MysticMgcn said:
Hmm, would you mind trying from ADB in recovery?
Click to expand...
Click to collapse
Sure, I can do that. It'll be a bit before I can get to a computer though.
Btw I'm on the stock recovery, if that matters at all.
Sent from my ADR6425LVW using XDA Premium.
I used adb to reboot the tablet into recovery and I got he fallen android with red triangle with no response to adb queries. I then powered the device off and then used power / vol down to get the mini EFI-like menu, then used Vol Up to pick RCK. Same thing.
Am I missing something?
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
The Transformer does not use a traditional partition table.
fdisk -l confirms: "Disk /dev/block/mmcblk0 does not contain a valid partition table" (run from a shell session root prompt directly on the device in ConnectBot)
AFAIK, it uses a GPT which is stored at a yet-unknown-to-me location (maybe at the end of the MMC). After booting, the kernel log (dmesg) always says "Primary GPT is invalid, using alternate GPT.". I assume this is by design because I've seen it also on the TF101.
Another thing is that some partitions are hidden from the OS (everything related to bootloader, recovery and kernel). While I could find the recovery and kernel images inside mmcblk0 (offsets 0x380000 and 0xB80000), the bootloader itself seems to be completely inaccessible from the OS.
_that said:
The Transformer does not use a traditional partition table.
fdisk -l confirms: "Disk /dev/block/mmcblk0 does not contain a valid partition table" (run from a shell session root prompt directly on the device in ConnectBot)
AFAIK, it uses a GPT which is stored at a yet-unknown-to-me location (maybe at the end of the MMC). After booting, the kernel log (dmesg) always says "Primary GPT is invalid, using alternate GPT.". I assume this is by design because I've seen it also on the TF101.
Another thing is that some partitions are hidden from the OS (everything related to bootloader, recovery and kernel). While I could find the recovery and kernel images inside mmcblk0 (offsets 0x380000 and 0xB80000), the bootloader itself seems to be completely inaccessible from the OS.
Click to expand...
Click to collapse
Boo Face!! Well thank you for the info. The offsets may still prove useful to get me out of this recovery bootloop I'm in.
Use parted not fdisk for emmc
MysticMgcn said:
Could someone please post their partition tables by running "fdisk -l /dev/block/mmcblk0" in ADB?
Click to expand...
Click to collapse
I know this is an old post but I think the command you are looking for is "parted /dev/block/mmcblk0" then type "print" and hit enter.
[SOLVED]
there may be other causes of this error, so there is no guarantee this will always be the fix.
"E: can't mount /sdcard"
in my case was "E: can't mount /sdcard" caused by some corrupted files in /data.
see here:
[email protected]:~$ adb shell
~ # mount /data
mount: mounting /dev/block/platform/msm_sdcc.1/by-name/userdata on /data failed: Invalid argument
i was able to fix this with instructions from this thread: http://forum.xda-developers.com/goo...o-repairing-corrupted-data-partition-t2577447
boot phone into recovery, and ensure you are able to to see your device with the command:
sudo adb devices
then use this command:
adb shell ‘e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata’
it should prompt you to hit enter to repair several times. simply hit enter each time you are prompted until it resolves.
after that you should be able to access your data through recovery or adb pull.
the "/data/media/0/0/" problem
i thought we were passed this bug, but somehow i caused it again.
it isn't particularly difficult to fix, provided you have proper access to your data.
i just used solid explorer to move the contents of to "/data/media/0/0" to "/data/media/0" and "/data/media/0/clockworkmod" to "/data/media/clockworkmod".
any sort of root file manager should be fine.
original thread:
current situation: nexus 5 has no system data. i can get into fastboot and CWM recovery, but CWM can't perform any functions due to "E: can't mount /sdcard"
[update/edit:
[email protected]:~$ fastboot devices
0370333c437f5965 fastboot
[email protected]:~$ adb devices
List of devices attached
0370333c437f5965 recovery
]
is there anything i can do from fastboot?
should i reflash the recovery or use a different recovery?
do i have to flash stock images?
anyway to back up my data to my pc first?
full story (in case something dumb i did is relevant):
ok, so i flashed the L preview from vomer's thread (http://forum.xda-developers.com/google-nexus-5/development/rom-n5-l-developer-preview-t2796003), and yes i made a nandroid backup (wish i'd copied it to my pc now...)
i dirty flashed because i'm dumb and thought i would format /data anyway. it didn't, but actually didn't cause too many problems (no force closes, but the home button didn't work.)
i went back to recovery and formatted /data, /cache, and dalvik, then reflashed the L zip and made a backup of this fresh install.
messed around with L for awhile, but wanted to go back to my previous setup. so i went back to recovery to restore my nandroid. there was only that most recent backup in the list.
i poked around and realized my files were now located inside "/sdcard/0/0/" so i formatted /data, /cache, and dalvik and flashed my rom (latest aokp, 4.4.4) and gapps. the phone booted up fine but got infinite play services force closes. i assume this is because flashing my rom hadn't actually cleared /system first.
so i go back into recovery once more, format /system, and try to flash the rom again.
E: can't mount /sdcard
i'm assuming my data (and my backup) is still there somewhere in /sdcard/0/0/ but i have no idea how i might access it.
any help would be appreciated. i can definitely return to stock and start over, but i'd much rather have my data.
Click to expand...
Click to collapse
Fastboot flash the stock userdata.img
You'll need to adb pull everything from /data/media first
Yes you should use another recovery but not for this reason
Sent from my Nexus 5 using Tapatalk
rootSU said:
Fastboot flash the stock userdata.img
You'll need to adb pull everything from /data/media first
Yes you should use another recovery but not for this reason
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
i'm not super familiar with this. i've only really used adb with guides for specific tasks.
do i just use "adb pull /data/media /where/i/want/it/to/go"
i'm using ubuntu if that matters.
Yep.
Boot into recovery
Open terminal
mkdir sd_backup
adb shell
mount /data
exit
adb pull /data/media/* /sd_backup
Sent from my Nexus 5 using Tapatalk
rootSU said:
Yep.
Boot into recovery
Open terminal
mkdir sd_backup
adb she'll
mount /data
exit
adb pull /data/media/* /sd_backup
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
ahh, the "/data/media/*" was the part i was looking for.
not sure i understand the
"adb shell
mount /data
exit"
part.
vonlupe said:
ahh, the "/data/media/*" was the part i was looking for.
not sure i understand the
"adb shell
mount /data
exit"
part.
Click to expand...
Click to collapse
In what respect?
They're commands. Type them in the terminal
Sent from my Nexus 5 using Tapatalk
rootSU said:
In what respect?
They're commands. Type them in the terminal
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
[email protected]:~$ adb devices
List of devices attached
0370333c437f5965 recovery
[email protected]:~$ adb shell
~ # mount /data
mount: mounting /dev/block/platform/msm_sdcc.1/by-name/userdata on /data failed: Invalid argument
~ # exit
Try and do "adb root" first..
Sent from my Nexus 5 using Tapatalk
rootSU said:
Try and do "adb root" first..
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
[email protected]:~$ adb root
adbd is already running as root
[email protected]:~$ adb shell
~ # mount /data
mount: mounting /dev/block/platform/msm_sdcc.1/by-name/userdata on /data failed: Invalid argument
~ #
not sure if this is relevant or weird or not, but "datadata"??
[email protected]:~$ adb shell
~ # ls
boot fstab.hammerhead sdcard
cache init seapp_contexts
charger init.rc sepolicy
data internal_sd storage
datadata mnt sys
default.prop proc system
dev property_contexts tmp
emmc recovery ueventd.goldfish.rc
etc res ueventd.hammerhead.rc
external_sd root ueventd.rc
file_contexts sbin
fstab.goldfish sd-ext
~ #
vonlupe said:
[email protected]:~$ adb root
adbd is already running as root
[email protected]:~$ adb shell
~ # mount /data
mount: mounting /dev/block/platform/msm_sdcc.1/by-name/userdata on /data failed: Invalid argument
~ #
Click to expand...
Click to collapse
[email protected]:~$ adb root
adbd is already running as root
[email protected]:~$ adb shell
~ # mount /data
~ # exit
[email protected]:~$
Click to expand...
Click to collapse
Could be your data partition is screwed too. Can you still boot into L? if not, I think your data is done for. Basically you have to format data going to and from L.
No idea what "datadata" is.
rootSU said:
Could be your data partition is screwed too. Can you still boot into L? if not, I think your data is done for. Basically you have to format data going to and from L.
No idea what "datadata" is.
Click to expand...
Click to collapse
no, i formatted /system, that's when everything broke.
thanks for all your help! i'm going to keep poking around, as i'd rather like to keep my data. i have the stock 4.4.4 images if i need to wipe though.
vonlupe said:
no, i formatted /system, that's when everything broke.
thanks for all your help! i'm going to keep poking around, as i'd rather like to keep my data. i have the stock 4.4.4 images if i need to wipe though.
Click to expand...
Click to collapse
Just fastboot flash the L system.img and boot.img
rootSU said:
Just fastboot flash the L system.img and boot.img
Click to expand...
Click to collapse
hmm, will that work?
will it boot without userdata.img?
it's just usuerdata that wipes everything, right?
vonlupe said:
hmm, will that work?
will it boot without userdata.img?
it's just usuerdata that wipes everything, right?
Click to expand...
Click to collapse
Userdata wipes data if flashed and no it is not a requirement. Will it work, not sure. Try it.
Also flash a cache.img just incase because dodgy cache can prevent mounting too
Sent from my Nexus 5 using Tapatalk
AHA!!
i found this thread: http://forum.xda-developers.com/goo...o-repairing-corrupted-data-partition-t2577447
which instructed me to run
‘e2fsck /dev/block/platform/msm_sdcc.1/by-name/userdata’ in adb shell.
and it worked!!!
i was able to mount /data and am currently running adb pull /data/media/ (no asterisk, btw)
and backing up all my data.
will update OP if this resolves everything.
Cool
Sent from my Nexus 5 using Tapatalk
Hello,
The question is pretty straightforward - is it possible to restore the data on the phone that had existed before the factory reset was made?
If I sell my phone on ebay can someone get any glimpse on what has been done with my phone?
e2com said:
The question is pretty straightforward - is it possible to restore the data on the phone that had existed before the factory reset was made?
Click to expand...
Click to collapse
It is still possible to recover much data after an factory reset. Unless you cleaned the drive properly. Fact is that there are user data still accessible on almost 40% of all phones bought at pawn shops.
To clean a drive you basically overwrite every single bit of the storage with an binary zero. This an very hard process to do manually therefore I would recommend using an data eraser tool such as:
Jihosoft Mobile Privacy Eraser - $49 /One-time
MobiKin Eraser for Android - $49 /One-time
Dr.Fone Data Eraser - $14.95 /Year or $19.95 /One-time
Or just use ADB to wipe all partitions you made changes to. As jwoegerbauer suggested.
e2com said:
If I sell my phone on ebay can someone get any glimpse on what has been done with my phone?
Click to expand...
Click to collapse
So short answer yes, it is very much likely that they can recover your data. Therefore I recommend wiping before selling it.
A sequence of 3 ADB commands is enough to unrecoverably wipe Android's user-data, provided the /data partition is mounted as RW
Code:
adb devices
adb shell "dd if=/dev/null of=/dev/block/bootdevice/by-name/userdata bs=4096"
adb shell "dd if=/dev/zero of=/dev/block/bootdevice/by-name/userdata bs=4096"
jwoegerbauer said:
A sequence of 3 ADB commands is enough to unrecoverably wipe Android's user-data, provided the /data partition is mounted as RW
Code:
adb devices
adb shell "dd if=/dev/null of=/dev/block/bootdevice/by-name/userdata bs=4096"
adb shell "dd if=/dev/zero of=/dev/block/bootdevice/by-name/userdata bs=4096"
Click to expand...
Click to collapse
I learned something new today.
jwoegerbauer said:
A sequence of 3 ADB commands is enough to unrecoverably wipe Android's user-data, provided the /data partition is mounted as RW
Code:
adb devices
adb shell "dd if=/dev/null of=/dev/block/bootdevice/by-name/userdata bs=4096"
adb shell "dd if=/dev/zero of=/dev/block/bootdevice/by-name/userdata bs=4096"
Click to expand...
Click to collapse
Hello,
when I run adb shell "dd if=/dev/null of=/dev/block/bootdevice/by-name/userdata bs=4096"
I get this:
dd: /dev/block/bootdevice/by-name/userdata: Permission denied
even though I run the command as sudo and enter my admin password. Any idea what I am doing wrong?
Are you sure that /data is mounted as RW?
TrulyPain said:
Are you sure that /data is mounted as RW?
Click to expand...
Click to collapse
no. How do I check it please?
e2com said:
no. How do I check it please?
Click to expand...
Click to collapse
It is quite different whether which device and android version you have. But usually, you write cat /proc/mounts in ADB. Then you shall see whether /data are mounted as RO or RW.
TrulyPain said:
It is quite different whether which device and android version you have. But usually, you write cat /proc/mounts in ADB. Then you shall see whether /data are mounted as RO or RW.
Click to expand...
Click to collapse
Okay, just ran your command and could not find /data at all.
I can see /proc /dev /sys /run but not /data
Maybe it has not been mounted at all?
Sorry, I am not very experienced with this but I am familiar with the terminal
How do I mount /data partition ?
android smartphones are encrypted by default. simply factory reset is enough nowadays to render userdata unrecoverable. on factory reset, the encryption key is securely deleted. there is no way to recover encryption key, therefore no way to decrypt data.
Hi,
Since a few days I'm unable to see any data in my phone via gallery or file manager or any application, and I'm unable to save any data to internal storage. (example: I'm able to use whatsapp for texting, but I can't receive/send any audio/picture and I can't access the old ones).
And I keep getting this error message:"com.android.providers.media.MediaApplication keeps stopping."
I don't know if that's what causing it or if that's just a consequence of not being able to access internal storage.
I can still see all the used storage from settings though.
Phone has unlocked bootloader, but no root/custom rom/recovery.
I saw other Oneplus users started getting the same error these days... (I have a Oneplus 6, but others have different models like Oneplus Nord).
Someone resolved by wiping system and they were able to retrieve storage content and functionality, but they lost apps data, I'm trying to find another way since I have an unlocked bootloader.
An user on stackoverflow suggested I should clean the com.android.providers.media.MediaApplication app data to regenerate the database, but I couldn't figure out how to do it
I tried cleaning media and media.module packages (not media.MediaApplication) from adb but no luck even if successful.
I tried removing "com.android.providers.media" (not media.MediaApplication, I couldn't find that one) folder from data/data with twrp file manager but no luck...
Is there a way to specifically clean "com.android.providers.media.MediaApplication"?
If anyone has any other suggestion on things to try, post it here please.
Thank you in advance
you wrote you already did successfully - obviously that is not the cause. my suspect is broken encryption (you will figure out from recovery.log)
encrypted files look like this +NiZZaTrs3RFzYegpkEk if encryption is not the reason, it could be symlinks messed up. in android enable usb-debugging and check from adb shell.
(repeat this for each result)
Code:
readlink /sdcard
readlink ...
in TWRP recovery check for files like /data/system/uiderrors.txt
/data/log
(don't know exact names) you can adb pull files to PC and inspect with wordpad or Notepad++
last but no least you can capture logcat during boot for further analysis
Code:
adb logcat > logcat.txt
if you're going to factory reset device, install Magisk from TWRP and backup apps to usb flash drive with Migrate-NG beforehand. copy all your pictures + backups to PC
Code:
adb pull -a /sdcard
if you can't install Migrate or can't get usb-otg to work, get a backup to PC at least, I can tell you how to restore single apps from it later (ignore the confirmation request "WARNING adb backup is deprecated... Now Unlock your device and confirm...")
Code:
adb backup --twrp --compress data
alecxs said:
encrypted files look like this +NiZZaTrs3RFzYegpkEk if encryption is not the reason, it could be symlinks messed up. in android enable usb-debugging and check from adb shell.
(repeat this for each result)
Code:
readlink /sdcard
readlink ...
in TWRP recovery check for files like /data/system/uiderrors.txt
/data/log
(don't know exact names) you can adb pull files to PC and inspect with wordpad or Notepad++
last but no least you can capture logcat during boot for further analysis
Code:
adb logcat > logcat.txt
if you're going to factory reset device, install Magisk from TWRP and backup apps to usb flash drive with Migrate-NG beforehand. copy all your pictures + backups to PC
Code:
adb pull -a /sdcard
if you can't install Migrate or can't get usb-otg to work, get a backup to PC at least, I can tell you how to restore single apps from it later (ignore the confirmation request "WARNING adb backup is deprecated... Now Unlock your device and confirm...")
Code:
adb backup --twrp --compress data
Click to expand...
Click to collapse
Hi @alecxs , I really hope you are still active on this forum...
Probably you won't remember this discussion from back in the days (This was the previous part of our exchange if you would like to refresh your memory).
In the end I ended up using my phone in that state for more than one year with the plan of changing phone soon and not have to deal with the wipe and restoration on the same device (if that's not procrastination.... ).
Well, last week I dropped the phone and the screen died. I bought a pixel 7 as a replacement but now I would like to try to save the data of just a few apps. Most important one being Whatsapp, I don't really care about the rest...
So basically:
-the screen is dead but touch is still working and I was able to get scrcpy to work so I can still use it as a "normal' phone from my computer, so that shouldn't be an impediment.
-as previously stated the phone is not able to access internal storage, but I'm able to access it in recovery mode through adb so pulling files should not be an issue.
-I'm able to install and update apks through adb install.
-whatsapp was not able to execute backups during this year since it could not access internal storage, so I have only old ones.
-bootloader is unlocked, I have twrp but no root.
I still need to try your suggestion above, but wanted to ask this before cause maybe you have a different suggestion to extract a single app. Also, I don't really know how migrate works but if it saves the backup on the internal storage I think that's not gonna work cause every app that needs to save something (that isn't data) doesn't work.
Isn't there a way to just copy the data folder of the app on the new phone to transfer data (like what happens for mac apps)?
Thank you in advance
0xCuter said:
-as previously stated the phone is not able to access internal storage, but I'm able to access it in recovery mode through adb so pulling files should not be an issue.
Click to expand...
Click to collapse
yes, if that is true all fine, you can run the Migrate_EMERGENCY_FLASHABLE.zip from recovery and restore app data on other device with Migrate
alecxs said:
yes, if that is true all fine, you can run the Migrate_EMERGENCY_FLASHABLE.zip from recovery and restore app data on other device with Migrate
Click to expand...
Click to collapse
Hey, it's me again... So, I rooted my new phone and I found the emergency_flashable.zip in the migrate thread, now I just need to flash it, but I cannot use scrcpy in recovery mode to see the screen. I guess there is a way to flash the zip from adb without the need to use the screen, but better to ask since I don't want to do stupid stuff...
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
alecxs said:
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
Click to expand...
Click to collapse
One thing I forgot to ask: do I need to root my old phone as well or is twrp sufficient?
And to root I would just need to flash Magisk the same way I would flash the emergency flashable.zip right? Or can I just "twrp install [magisk_package]" without going into the shell?
No need to root old phone, TWRP already provides root access for backup purposes. the new phone should be rooted by flashing magisk patched boot.img because the TWRP install method is deprecated. I know I gave only short hints, so don't hesitate to ask for more detailed instructions in case you don't know what to do for some specific step...
alecxs said:
No need to root old phone, TWRP already provides root access for backup purposes. the new phone should be rooted by flashing magisk patched boot.img because the TWRP install method is deprecated. I know I gave only short hints, so don't hesitate to ask for more detailed instructions in case you don't know what to do for some specific step...
Click to expand...
Click to collapse
Thank You... Yes, the new phone is rooted.
One thing that's not needed for the process but I wanted to understand is: Is there a specific reason why we "twrp install" from shell or could in theory be possible to flash the zip file directly from pc storage?
0xCuter said:
or could in theory be possible to flash the zip file directly from pc storage?
Click to expand...
Click to collapse
the reason is, the backup is created locally in the same directory where the zip file is. never tried sideload but I guess it would try to store in /tmp which is RAM.
alecxs said:
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
Click to expand...
Click to collapse
I'm trying and when I do "mount /system" from the shell I get this:
mount: '/system' not in fstab
Click to expand...
Click to collapse
Is it normal?
it's either /system_root or /system so one of it will fail. I just listed both.
alecxs said:
it's either /system_root or /system so one of it will fail. I just listed both.
Click to expand...
Click to collapse
I suspected that... is it the same for product and external_sd?
Only system_root and vendor went through
/external_sd is the mount point for MicroSD Card, it may have a different name like /sdcard1 or something. if you have enough disk space on /data, no need for external SD.
/product is maybe not needed, just running with /system_root + /vendor is fine.
alecxs said:
/external_sd is the mount point for MicroSD Card, it may have a different name like /sdcard1 or something. if you have enough disk space on /data, no need for external SD.
/product is maybe not needed, just running with /system_root + /vendor is fine.
Click to expand...
Click to collapse
There is no external MicroSD on Oneplus 6... can I put the migrate folder in /sdcard?
Also, I think I should delete some stuff from storage to make space, since I already pulled it on the pc
/sdcard = /data/media can be used. you can split the packages.list file into few parts so it fits in remaining disk space.
alecxs said:
/sdcard = /data/media can be used. you can split the packages.list file into few parts so it fits in remaining disk space.
Click to expand...
Click to collapse
I tried the install and I get this, even though the zip file is in the same folder I'm in (it even autocompletes from terminal)
OnePlus6:/sdcard/Migrate # ls
Migrate_EMERGENCY_FLASHABLE.zip
OnePlus6:/sdcard/Migrate # twrp install Migrate_EMERGENCY_FLASHABLE.zip
Unable to locate zip file 'Migrate_EMERGENCY_FLASHABLE.zip'.
Installing zip file 'Migrate_EMERGENCY_FLASHABLE.zip'
Error installing zip file 'Migrate_EMERGENCY_FLASHABLE.zip'
Done processing script file
Click to expand...
Click to collapse
make sure you give a path to zip file on install, like ./ or full path. it will fail on first execution. check if packages.list was created successfully.
alecxs said:
on the first trial it will fail because packages.list needed. but it will create one you can edit.
Click to expand...
Click to collapse
you can always pull recovery.log afterwards to see what's going on.
Code:
adb pull /tmp/recovery.log
alecxs said:
make sure you give a path to zip file on install, like ./ or full path. it will fail on first execution. check if packages.list was created successfully.
you can always pull recovery.log afterwards to see what's going on.
Code:
adb pull /tmp/recovery.log
[/cod
[/QUOTE]
Click to expand...
Click to collapse
It launched with the full path. I didn't edit the package.list file and I launched it again.
I got a lot of "migrate.sh: failed:..." and just a few "migrate.sh: finish:..." mostly for system apps, but honestly I really only need to backup whatsapp...
...
Click to expand...
Click to collapse
migrate.sh: failed: com.intsig.lic.camscanner
migrate.sh: failed: com.android.theme.icon_pack.ci
migrate.sh: failed: com.google.android.apps.restor
migrate.sh: 397x packages failed / 0x already exist
# MIGRATE_STATUS: backup finished (27/424)
# DONE.
#
# exiting script
#
# # # # # # # # # # # # # # # # # # # # # # # # # #
Updater process ended with ERROR: 1
I:Install took 69 second(s).
Error installing zip file 'sdcard/Migrate/Migrate_EMERGENCY_FLASHABLE.zip'
Done processing script file
Click to expand...
Click to collapse
These are the things that have been backed up:
OnePlus6:/sdcard/Migrate # ls
Backup_android Backup_com.google.android.networkstack
Backup_com.android.bluetooth Backup_com.google.android.packageinstaller
Backup_com.android.cellbroadcastreceiver Backup_com.oneplus.screenshot
Backup_com.android.emergency Backup_com.qualcomm.qti.cne
Backup_com.android.inputdevices Backup_com.qualcomm.qti.poweroffalarm
Backup_com.android.location.fused Backup_com.qualcomm.qti.smq
Backup_com.android.phone Backup_com.qualcomm.qti.uceShimService
Backup_com.android.providers.blockednumber Backup_org.ifaa.aidl.manager
Backup_com.android.providers.settings Backup_se.dirac.acs
Backup_com.android.providers.telephony Backup_vendor.qti.hardware.cacert.server
Backup_com.android.proxyhandler Migrate_EMERGENCY_FLASHABLE.zip
Backup_com.android.server.telecom backup_app_and_data.sh
Backup_com.android.settings busybox
Backup_com.android.shell migrate.log
Backup_com.android.stk migrate.sh
Backup_com.android.systemui packages.list
Backup_com.google.android.ext.shared readme.txt
Click to expand...
Click to collapse
After an Update of Two magisk modules, my Ulefone Armor 11 5G staied stucked on boot logo, I can only enter in recovery or fastboot.
I try to build a TWRP, but it is not able to mount userdata.
I was able to download with the help of mtkclient all the partition on my phone, even userdata , it took 7 hours.
I wanted to load the image in linux but using mount disk imag or using the command sudo mount -o loop userdata.img ~/Armor_11_5G doesn't do anything not even an error message.
I'm wondering if the filesystem was corrupted during the update.
Is it possible to repair the fylesystem like in Windows?
Thanks
did you previously disable encryption and factory reset long time before the modules updates failed?
what do you mean mount doesn't do anything not even an error message? either it give error message or it succeed.
I didn't disable encryption before updating the modules, I already updated this modules many times.
what do you mean mount doesn't do anything not even an error message? either it give error message or it succeed.
Click to expand...
Click to collapse
That is the problem, it doesn't succed and I don't have an error message. The file is 256 Gbyte big, I don't know if it plays a role. I'm using Ubuntu 22
if phone is encrypted that's just 256G garbage. post the output of
Code:
$ parted <file> unit B print
Here are the results of parted
Code:
Error: /home/*****/Public/userdata.bin.img: unrecognised disk label
Model: (file)
Disk /home/osboxes/Public/userdata.bin.img: 249208733696B
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
Thanks
You may try https://www.cgsecurity.org/wiki/TestDisk_Download
I'd be glad for your feedback.
sorry thought it's whole disk, but it's only 232G file therefore parted won't print partition table
does apply to FDE only
assuming this file is dump of single userdata partition, open with HxD editor. if the partition image is not encrypted, you will see lot zeros within first 1024 bytes.
in that case you can check for file system type is ext4 or f2fs.
Code:
$ xxd -l 1080 dump.img | grep 53ef
$ xxd -l 1024 dump.img | grep 1020.f5f2
But most likely the userdata partition is encrypted, therefore no way to recover data offline.
The easiest way not to load Magisk modules is, not to load Magisk. Flashing stock boot.img will solve it.
Beware, in case you disabled encryption beforehand, booting stock boot.img will force encryption. This may take long time without notice.
I never disabled encryption, I don't know if Magisk do it without informing. I used this phone for an year without a problem.
After the update I left the phone on for one night but nothing happens. I tried to reflash the stock boot image, and again a whole night wait, but again nothing happens.
Reading the fstab the file system should be ext4.
The file is the dump of the whole userdata partition of my Ulefone Armor 11 5G.
I did a backup of the whole system before doing any experiment so if the partition table is corrupted maybe if I reflash back the userdata partition with a working partition table I have again access to the datas.
there is no partition table in userdata partition, I just gave you wrong advise. because the phones total storage is 256G, I made wrong assumptions (you can view partition table from file pgpt.bin)
full 1:1 backup is impossible for FBE encryption because encryption keys are stored in TEE. once you factory reset device backup of userdata + metadata becomes useless.
fstab doesn't tell you what file you just have dumped. if you can't find ext4 super magic (#7) it's impossible to loop mount that file (and impossible to decrypt on linux PC)
if you can't fix boot-loop by stock boot.img then it's unrelated to magisk modules. you can however enable adb in default.prop and capture adb logcat during boot-loop for further analysis. you could also inject own script that deletes some files (only DE encrypted files, CE encrypted files requires lock screen credentials aka pin/pattern)
boot this TWRP and get log from adb
Code:
$ fastboot boot recovery.img
$ adb shell twrp decrypt '1234'
$ adb pull /tmp/recovery.log
https://twrp.me/faq/openrecoveryscript.html
full 1:1 backup is impossible for FBE encryption because encryption keys are stored in TEE. once you factory reset device backup of userdata + metadata becomes useless.
Click to expand...
Click to collapse
With mtk client I was able to do the backup of tee1 and tee2 and also of gpt_backup and gpt_main.
$ xxd -l 1080 dump.img | grep 53ef
$ xxd -l 1024 dump.img | grep 1020.f5f2
Click to expand...
Click to collapse
Doesn't produce any results.
I have immediately the command prompt.
you can however enable adb in default.prop
Click to expand...
Click to collapse
How can I do that? Which value should I change in default.prop?
so your "backup" is encrypted. please note Trustonic Kinibi is TEE OS running in secure memory one can't access or backup with mtkclient. the tee partitions in phone storage do not contain any encryption key (none of the partitions does, secure memory is not even a partition). the only crypto related partition is metadata used for keydirectory of metadata encryption (on top of FBE encryption) but it is useless for backup purposes.
yes you can modify default.prop in boot.img, ro.secure=0 should give root access.
https://forum.xda-developers.com/t/...hone-with-broken-screen.2965462/post-85905033
Code:
ro.secure=0
ro.debuggable=1
persist.service.adb.enable=1
in case the default.prop modification is not sufficient, you need additional command to be executed as root.
Code:
# settings put global adb_enabled 1
as you installed magisk, you could use magisk overlay.d/sbin/ for running startup script.
https://forum.xda-developers.com/t/...ithout-losing-your-data.4383255/post-86934375
aIecxs said:
boot this TWRP and get log from adb
Code:
$ fastboot boot recovery.img
$ adb shell twrp decrypt '1234'
$ adb pull /tmp/recovery.log
https://twrp.me/faq/openrecoveryscript.html
Click to expand...
Click to collapse
How about this TWRP? it should be able to decrypt userdata. if decryption failed, provide recovery.log
Until tomorrow I cannot do a logcat and I cannot find my view logcat on my laptop.
I unpacked boot.img with Carliv Image Kitchen and there is no default.prop, that is present in the recovery as prop.default.
Is there a way to backup secure memory of Trustonic?
How about this TWRP? it should be able to decrypt userdata. if decryption failed, provide recovery.log
Click to expand...
Click to collapse
I already tried that version but it cannot decrypt, that' why I'm trying to build my own version of TWRp with the help of the creator of that version of TWRP, but I'm stucked.
oh, you know how to build TWRP with proper FBE + metadata encryption support? have a look at other Oppo devices how they did... good luck.
regarding default.prop in boot.img (it's a symlink to system unfortunately) you can do it the other way
use magisk overlay.d/sbin/
create a boot script that does the thing with resetprop -n <prop_name> <prop_value>
don't use outdated Carliv Image Kitchen! use osm0sis AIK from link above.
oh, you know how to build TWRP with proper FBE + metadata encryption support? have a look at other Oppo devices how they did... good luck.
Click to expand...
Click to collapse
I'm learning.
I try to integrate the decryption service following the suggestion of ADeadTrouser on Github, but the service doesn't want to start and I don't understand why.
I never checked Oppo, I will take a look at them also, thanks for the suggestion.
I think I figured out now the adb logcat at least. hope that helps
https://forum.xda-developers.com/t/accessing-my-phone-with-a-dead-screen.4542763/post-88016019
I tried your script butr nothing happens, the telephone is not listed when I type
Code:
adb devices
and if I type
Code:
adb logcat
I receive the message waiting for device
you might follow the thread
wenyendev said:
You may try https://www.cgsecurity.org/wiki/TestDisk_Download
I'd be glad for your feedback.
Click to expand...
Click to collapse
I run the software on the image and it identify the contents and can read the encrypted and not encrypted part, that means that all the files are there, but I cannot mount in Linux or in TWRP
The fact that I cannot mount in Linux or TWRP the userdata image/partition can be that is corrupted the partition or the file index?
That would also explain why the script for Magisk provided by aIecxs is not able to copy the adb_key from the cache in the data partition.