yashsingh1/xdaforums huggingface dataset:
[General Questions and Answers] alecxs:
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.

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
[General Questions and Answers] 0xCuter:
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?
[General Questions and Answers] alecxs:
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...
[General Questions and Answers] 0xCuter:
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?
[General Questions and Answers] alecxs:
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.
[General Questions and Answers] 0xCuter:
I'm trying and when I do "mount /system" from the shell I get this:

Is it normal?
[General Questions and Answers] alecxs:
it's either /system_root or /system so one of it will fail. I just listed both.
[General Questions and Answers] 0xCuter:
I suspected that... is it the same for product and external_sd?

Only system_root and vendor went through
[General Questions and Answers] alecxs:
/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.
[General Questions and Answers] 0xCuter:
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
[General Questions and Answers] alecxs:
/sdcard = /data/media can be used. you can split the packages.list file into few parts so it fits in remaining disk space.
[General Questions and Answers] 0xCuter:
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)
[General Questions and Answers] alecxs:
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.

adb pull /tmp/recovery.log
[General Questions and Answers] 0xCuter:
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...

These are the things that have been backed up:
[General Questions and Answers] alecxs:
are you sure you can access data at all? to me it looks like TWRP cannot decrypt either. for example check /data/data/com.whatsapp
[General Questions and Answers] 0xCuter:
Yes, I can see all the folders inside and relative files
[General Questions and Answers] alecxs:
strange it only backup unimportant apps. what is your android version? however, for whatsapp try this.

https://android.stackexchange.com/questions/214065/backup-whatsapp-from-nandroid
[General Questions and Answers] 0xCuter:
It's Android 11.

I already tried to backup with "adb backup --twrp --compress data", but it asks for confirmation on the phone (swiping I guess) but since the screen is broken I can't see... touch still works but I tried swiping randomly and nothing happens
[General Questions and Answers] 0xCuter:
Btw in theory I could backup even when the phone is on I think, the only thing is that the method should save the files to pc/external otg memory since it's like there is no /sdcard storage... Do you think that's possible with some apps (like titanium or similar)?
[General Questions and Answers] 0xCuter:
In theory I could use Swift or AppDash and save the backup on a OTG usb key, the problem is that I need to keep the phone connected to the mac to be able to use the screen, so I would need to buy something like this https://www.amazon.it/splitter-Adattatore-maschio-Extender-prolunga/dp/B0928M1D1P , and I don't even know if that would work...

EDIT: or I could try with something like teamviewer
[General Questions and Answers] 0xCuter:
Wait, do I need a nandroid backup to try this or can I just directly use the folder?
[General Questions and Answers] 0xCuter:
Found this for the nandroid backup:
[General Questions and Answers] alecxs:
I think my script only works for Android 10. The reason it is looking for paths in packages.xml - this file is no longer xml format since Android 11.

I need to fix the script and use abx2xml to convert the packages.xml before processing. should not be a big deal, but I don't think TWRP comes with that binary so I need to know the path, probably /system_root/system/bin/abx2xml and if not a static standalone executable, also the path of the library.

I have another project currently so if you only want Whatsapp, you can get the files from adb.

adb shell
# tar -vzcpf /sdcard/whatsapp.tar.gz /data/user*/0/com.whatsapp /sdcard/Android/media/com.whatsapp
# exit
adb pull /sdcard/whatsapp.tar.gz

to restore files on other phone just extract the tar.gz into / rootdir.

to restore, you need to know the new uid/gid + secontext of target whatsapp directory beforehand, to set new uid/gid + secontext afterwards:

# chown -Rh 10123.10123 /data/user*/0/com.whatsapp
# chcon -Rh u:object_r:app_data_file:s0 /data/user*/0/com.whatsapp

(user* stands for user and user_de)

that's possible with scrcpy over tcpip (wifi) + Migrate. but I still don't understand why you have access to /data but not /sdcard. maybe it's easier to just symlink /storage/emulated/0 to /sdcard and solve that issue.
[General Questions and Answers] 0xCuter:
Whatsapp would be the only "vital" one, but it would be nice to have some other apps as well...

Btw I don't really know if using the backup apps from phone and not from recovery would work, it was just my supposition since I can use most apps normally except from functions where storage is involved... is there a way to check if I have access without trying directly to backup? (i don't have root atm)

Don't really understand this... one thing for sure is that I don't have access to storage/emulated/0
[General Questions and Answers] alecxs:
in TWRP, do the last line of post #3. then check your PC platform-tools directory for backup.ab - watch the file size growing. after ~ 1 hour it should be finished. now pull /tmp/recovery.log and look inside, you should see a list of files.
[General Questions and Answers] 0xCuter:
As I said a few posts above I already tried to backup with "adb backup --twrp --compress data", but it asks for confirmation on the phone (selecting partitions + swiping) but since the screen is broken I can't see... touch still works but I don't know which partitions are selected by default

I could try this maybe:

But what would having the list of files in tmp/recovery.log accomplish?
[General Questions and Answers] alecxs:
https://twrp.me/faq/openrecoveryscript.html

adb backup :
Use the adb backup command of the host computer to backup the device:
adb backup --twrp [compress] [PARTITION-LIST]
PARTITION-LIST: partition(s) name(s) without leading '/'. Only partition present into fstab can be backuped.

adb restore FILENAME :
Use the adb restore command of the host computer to restore FILENAME where FILENAME is a previously backup taken with adb backup.

this works without confirmation, no need to select partitions. the selection is done from cmd line. Did you check file size grow?

the recovery.log tells you if the backup went successful. But you can also make screenshots with Vol Down + Pwr and pull them. This way you know what is displayed.
[General Questions and Answers] 0xCuter:
1. Which partition/s should I choose?

2. Are you making me do the nandroid backup to try this? https://android.stackexchange.com/questions/214065/backup-whatsapp-from-nandroid

3. Wouldn't it be faster to do the "tar -vzcpf" thingy for every app instead?

(I guess the apps I would like to backup are like 5 or less from the top of my mind...)

4. If yes, is this command "precise" or do I need to look up something first to modify it? i didn't understand what you wrote before...

And btw, thank you a lot for what you are doing...
[General Questions and Answers] alecxs:
1. "data" is the only partition needed

2. yes, but it's a backup including secontext..

3. ..which simple tar is not capable of (no --selinux flag)

4. the backup cmd is exact. for restoring you need to replace the uid/gid with actual one (10123.10123 is just example)

you can view with ls -nd ...
[General Questions and Answers] 0xCuter:
So what's the problem if there is no secontext/--selinux flag? Is it gonna be the same when I do the chown+chcon command?
[General Questions and Answers] alecxs:
Hopefully. but u:object_r:app_data_file:s0 is maybe not the right secontext, so better check that with ls -Zd
[General Questions and Answers] 0xCuter:
Hello Alecxs, sorry to bother you again... So, I tried connecting a USB-key through OTG (using scrcpy over wifi) but it doesn't get reconized (yes, I activated OTG), so Swift Backup/AppDash is not an option.

I was able to backup through "adb backup --twrp --compress data" and it worked like you said... I now have a 5 GB backup.ab file.

What should I do now? Should I follow this? https://android.stackexchange.com/questions/214065/backup-whatsapp-from-nandroid

His backup was into folders though, how do I access the .ab file? And should I put my backup into the new phone for this?

Or should I follow this:

Or now that I have the .ab backup is there another option altogheter?
[General Questions and Answers] alecxs:
on linux you can convert the backup into win files with this script (the first line). win files can be extracted with tar (the last line).

so install WhatsApp on new phone and open the app once. then replace the files in its directory with the files from backup. update the uid and check WhatsApp again.

Alternative it should be possible to create a Migrate backup of WhatsApp on the new phone, replace the files inside the backup with the files from old WhatsApp and restore it, if that is easier for you.

I could write a script to automatize this, but I don't have time for scripting, so please do it manually like described in post #29.

Unfortunately I didn't had time to fix the other script to work with abx file, that would make it easier with migrate.

I will check XDA few times a day, tell me if you have trouble understanding things.

you could also try to restore the whole backup.ab from TWRP adb to new phone. it probably won't boot, but maybe you're lucky and it works. I have heared people doing this.
[General Questions and Answers] 0xCuter:
No worries... no need to write any script

I will try to do it directly on the new phone without going through Migrate

1. Regarding the .ab file conversion, should it work on macos as well? cause I try executing the script, it doesn't give any error but nothing happens...

2. In case I don't wanna go through Migrate I still haven't understood if I should do the "stackexchange link" method from the backup file or the post #29 method directly from the phone data folder... or a combination of the two
[General Questions and Answers] alecxs:
1) yes macos is fine. you need to pass file name as argument, or copy file into same directory of backup.ab

2) it's the same. I recommend to try with the extracted backup
[General Questions and Answers] 0xCuter:
Did that, but nothing changes
[General Questions and Answers] alecxs:
you can run with bash -x and see where it failes. you can open the script with editor and delete the checks, so the script will run regardless of any backup file found.

edit: wait... macos has different line encoding. try this script please

(attachment removed)
[General Questions and Answers] alecxs:
maybe BSD grep is different? try with gnu grep please

brew install grep
[General Questions and Answers] 0xCuter:
The previous bash -x output was with the linux version, I hadn't seen your edit...

I tried the mac version but it finishes instantly and doesn't produce any log even with bash -x... looks like something it's not right

(even installing grep through bash for both versions)

Will need to buy you a beer when I finish this ahah :)
[General Questions and Answers] alecxs:
yeah so obviously the linux version is the right one, forget about the other script where I replaced \n with \r.

can you run grep -abi twstreamheader backup.ab and tell me if there is any output? it should throw out a lot of garbage.
[General Questions and Answers] alecxs:
seems your backup.ab file is different from mine, I have four whitespaces between "TWRP" and "twdatablock". remove all dots in the script and try again.

TWRP....twdatablock -> TWRPtwdatablock
[General Questions and Answers] 0xCuter:
➜ oneplus bash -x twab.sh backup.ab

+ backup=backup.ab

+ '[' -e backup.ab ']'

+ '[' -e backup.ab ']'

+ head -c512 backup.ab

+ grep -boqa TWRPtwstreamheader

+ '[' 1 '!=' 0 ']'

+ echo -e 'error: file is not a valid TWRP backup'

error: file is not a valid TWRP backup

+ echo -e 'usage: adb backup --twrp compress data -f backup.ab'

usage: adb backup --twrp compress data -f backup.ab

+ exit 1
[General Questions and Answers] alecxs:
Lol I have no clue what's wrong with macos, now it's exit 1 which is error, so the previous version finished successful with exit 0. maybe dd is not working as expected. never mind.

you still have the app data on the broken phone right? so create a tar archive of that app data.

on the new phone, use the commands ls -n and ls -Z to get the required metadata of the new (blank) Whatsapp files. after you replaced the files, restore the metadata with chown and chcon.
[General Questions and Answers] 0xCuter:
So, I did the tar thing but I feel like something it's not right... When I tried to tar everything it crashed out of the shell, I figured it's cause it was too much data on the sdcard, so I removed that part since I think that I can just copy that manually since I already pulled it in the past, but now it backs up only what's in the user_de folder (even trying to be explicit with 'user' in the command) and when I pull the file it's only 122kb

EDIT: Shouldn't the data be in data/data?

EDIT2: also, (probably stupid question but) how do I extract the tar into rootdir/?

EDIT3: probably even more stupid, but where should I ls -n and -Z from? If I try with the phone on it says "permission denied" even if I have root... and I don't have a custom recovery yet. Is it required?
[General Questions and Answers] alecxs:
/data/user/0 is a symbolic link to /data/data. if you tar /data/user/0/com.whatsapp the source is a directory, so it should work. if you tar /data/user/0 the source is a symbolic link, tar requires additional flag -h to follow symlinks on cmd line.

/data/user/0 and /data/data are interchangeable

tar -vcf /sdcard/whatsapp.tar /data/user/0/com.whatsapp
tar -vcf /sdcard/whatsapp.tar /data/data/com.whatsapp

or

tar -vchf /sdcard/data.tar /data/user/0
tar -vcf /sdcard/data.tar /data/data

some apps don't have app data in /data/user/0 but in /data/user_de/0 instead. hence the wildcard /data/user*/0

tar removes leading / from member names. for restoring single apps you can extract the tar in / rootdir by specifying the target with the -C flag.

tar -vxf /sdcard/whatsapp.tar -C /
tar -vxf /sdcard/data.tar data/user/0/com.whatsapp -C /
tar -vxf /sdcard/data.tar data/data/com.whatsapp -C /

Note that data.ext4.win files are created with the -P flag for preserving the leading / therefore extracting target is always what is named in archive (it goes automatically in the right location)

for restoring all apps I recommend to restore the backup.ab from TWRP.

if you want to create a healthy tarball archive similar to TWRP backup, which can restored including all metadata, you must download gnu tar binary for arm and use the --selinux --xattrs flags. but still that only works on the same phone, so in your case it doesn't matter, as you're required to restore metadata of target manually anyway.

to get the secontext, uid/gid and permissions of the target files.

su
ls -rZ /data/user/0/com.whatsapp
ls -nd /data/user/0/com.whatsapp
ls -rn /data/user/0/com.whatsapp

note that the permissions can be written in octal.

drwxrwx--x -> 0755

with proper busybox (where the stat command supports the -Z flag) you can list all metadata in one line.

find -H /data/user/0/com.whatsapp -exec busybox stat -Zc $'%04a\t%u:%g\t%C\t%N' {} +
[General Questions and Answers] 0xCuter:
After all this time I was finally able to get my old chats back on the new phone! Thank you very much!

Would you mind sending me your paypal (or eth address if you are into crypto) so I can offer you a beer?

I was able to get it working only fixing secontext and uid/gid but not permissions... hope that's not gonna be a problem.

I think I will not keep root on the new pixel, so I'll just backup whatsapp from there and restore it after I re-lock the bootloader.

The only thing that's missing now are contacts but I can't export a .vcf file from the old phone since it cannot create it, should I proceed like I did for whatsapp or is there a different method? I saw online that contacts should be stored at /data/data/com.Android.providers.contacts/databases/contacts.db, if I only copy that folder will it be ok?

Nevermind, found these https://github.com/alejandrolopezparra/AndroidContactsDatabase-tools and https://gitlab.com/Arnaudv6/contacts2.db-2-vcard that should resolve my issue faster.
[Sony Xperia 10 III] ~JL~:
I plan on building AOSP following the Sony insctructions. If for some reason I flash a bad recovery can this phone still boot in fastboot mode with a broken recovery? I'm asking because recently I had a friend brick his Asus phone because you need to boot into recovery to be able to go to fastboot. I didn't expect that since on my Xiaomi you can go straight to fastboot without recovery..
[Sony Xperia 10 III] wirespot:
fastboot is separate from recovery on this phone, yes.

Also, you can test the recovery first without flashing by using fastboot boot recovery.img, it boots into the recovery image without flashing it.
[Apple iPhone 12 Questions & Answers] schaefer2004:
my daughter has now called 911 4 times in the last 2 days. is there a way to remove the SOS option if the power button is pressed 5 times fast. i did disable both options under the sos tab in settings but not fixing the issue. any help would be great. thanks!
[Tilt, TyTN II, MDA Vario III General] greggsauce:
I broke my phones screen so I can't accesss anything on my phone really, whats the best way to get contacts off a phone that are not saved on a SIM?

I was using a ROMeOS or however it was spelled and it was 6.1

I was thinking about trying to use outlook, do you think that would work when I sync them up? My phones not with me right now.
[Tilt, TyTN II, MDA Vario III General] DaveShaw:
Active Sync and Outlook would work.

Also, Try using MyMobiler to Remote Access you phone via your PC, and then use PIM Backup

Or (as a final option) Copy \PIM.vol from your device root.

Ta

Dave
[Google Pixel 6 Pro] stalls:
Hello I have been trying to look for the lockscreen.ogg file location. It has seemed to changed in Android 12 if I'm not mistaken. It was located in System/Media/UI but it seems that is no longer even there with Android 12. Does anyone have any idea where this is? Thank you!
[Google Pixel 6 Pro] Ronny220:
Try system/product/media
[Google Pixel 6 Pro] stalls:
That is exactly the spot I was looking for. For some reason I cant get root explorer to mount R/W to overwrite the old file. Root Explorer does have SU access as well. Any ideas?
[Google Pixel 6 Pro] roirraW "edor" ehT:
There are one or more Magisk Modules that will make it appear for all intents and purposes that you've overwritten or changed a file. It will do what you need. Because root is systemless, you can't (and shouldn't want to) actually change or delete any system files for real. I don't know the name(s) of the Magisk Modules that will do that, as I haven't had a need, but many users in this section have suggested others use such modules to do something similar to what you want to do.
[Google Pixel 6 Pro] DirtyPISTOLA:
running "settings list global" on adb shell gave me this location "lock_sound=/product/media/audio/ui/Lock.ogg" I was gonna check on root explorer but forgot im not rooted right now but hopefully that is it.
[Google Pixel 6 Pro] stalls:
I just am trying to change the sound when locking the phone.
[Google Pixel 6 Pro] Thebear j koss:
Can you rename the stock file to lock.oggbak and then paste the new sound in obviously with the name lock.ogg?
[Google Pixel 6 Pro] stalls:
You can not because root explorer is not able to switch to r/w. But I tried anyways and failed 😆
[Google Pixel 6 Pro] Freak07:
you have to create a magisk module yourself and replace the file, with the one you want.

google around for a template of a simple magisk module, recreate the directory inside the magisk module where the file you want to replace sits on the phone (system/product/media/audio/ui), drop the new sound file there, zip the magisk module template and flash via magisk manager and do a reboot.

dynamic partitions don´t allow for r/w mounting. replacing the file systemlessly via magisk during bootup is the only way.