mrrfv / open-android-backup

Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.
http://openandroidbackup.me/
GNU General Public License v3.0
751 stars 40 forks source link

Restore fails with remote secure_mkdirs failed: Operation not permitted while trying to write to storage/Android/data/ #30

Open iamdegenerat3 opened 1 year ago

iamdegenerat3 commented 1 year ago

Device info

Manufacturer: Google Android version: Android 13 Custom ROM/rooted? No Model: Pixel 6 Pro

System info

Available disk space: ~275 GB Operating system: Arch Linux 5.19.13-zen1-1-zen


Describe the issue below. Restore fails with remote secure_mkdirs failed: Operation not permitted while trying to write to storage/Android/data/

Full echo output:

./backup-tmp/Storage/Alarms/: 2 files pushed, 0 skipped. 10.6 MB/s (962366 bytes in 0.087s) adb: error: failed to copy './backup-tmp/Storage/Android/data/com.teamviewer.quicksupport.market/files/export/files.zip' to '/storage/emulated/0/Android/data/com.teamviewer.quicksupport.market/files/export/files.zip': remote secure_mkdirs failed: Operation not permitted adb: error: failed to read copy responsep/2021-11-16 23-29-39.zip: 4% adb: error: failed to read copy responsek-share.zip: 0% adb: error: failed to read copy responsesame.app.edge_2022-06-03.apk: 1% adb: error: failed to read copy response ./backup-tmp/Storage/Audiobooks/: 0 files pushed, 0 skipped. adb: error: failed to read copy response/2022-09-03-hyperion-config.backup: 0% adb: error: failed to read copy responseXL_20220901_113214755.jpg: 6% adb: error: failed to read copy responsefaver.txt: 100% adb: error: failed to read copy responsenced-YouTube-v17.36.37-arm64-v8a-cli_v2.11.1-patches_v2.66.2.apk: 90% adb: error: failed to read copy response ./backup-tmp/Storage/DSfile/: 0 files pushed, 0 skipped. adb: error: failed to read copy response-20220909-033737.mp4: 0% adb: error: failed to read copy responseails/.database_uuid: 100% adb: error: failed to read copy response/Cha-Ching.ogg: 100% adb: error: failed to read copy responsegram/IMG_20220811_110405_105.jpg: 51% adb: error: failed to read copy response ./backup-tmp/Storage/Podcasts/: 0 files pushed, 0 skipped. adb: error: failed to read copy response ./backup-tmp/Storage/Recordings/: 0 files pushed, 0 skipped. adb: error: failed to read copy responseRobot Theme.mp3: 13% adb: error: failed to read copy response 3901 files pushed, 0 skipped. 17.1 MB/s (2844152529 bytes in 159.008s)

mrrfv commented 1 year ago

Could you try using a different cable, or connecting the phone wirelessly (preferably both)?

iamdegenerat3 commented 1 year ago

Tried another USB cable with same result Wireless isnt possible as the script isn't properly connecting to the paired device on the same network. I can connect via adb connect IP:PORT but the script tries to connect which dsconnect the active adb connection, which in turn changes the port for the next connection in Android which now causes the script to assume the device is offline

mrrfv commented 1 year ago

I can connect via adb connect IP:PORT but the script tries to connect which dsconnect the active adb connection, which in turn changes the port for the next connection in Android which now causes the script to assume the device is offline

The script automatically finds the IP address of your phone and enables wireless debugging on a specific port, there's no need to do anything.

iamdegenerat3 commented 1 year ago

in my case it tries to but always fails sadly. Tried several combinations (paired, unpaired, with active adb connection, without active adb connection) script always behaves as described above

mrrfv commented 1 year ago

I just updated the wireless connection feature to fully support Android 11 and higher. Sorry for the wait.

iamdegenerat3 commented 1 year ago

Ok thanks, mate

On Sun, Jan 1, 2023, 12:27 mrrfv @.***> wrote:

I just updated the wireless connection feature to fully support Android 11 and higher. Sorry for the wait.

— Reply to this email directly, view it on GitHub https://github.com/mrrfv/linux-android-backup/issues/30#issuecomment-1368420546, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQMX6P2SSGESPVGESIHAECDWQFSZDANCNFSM6AAAAAAQ62BO4Y . You are receiving this because you authored the thread.Message ID: @.***>

mrrfv commented 1 year ago

Closing this for now due to inactivity. Let me know if you'd like to have this reopened.

jmon12 commented 1 month ago

Hi @mrrfv , First of all, thank you for your amazing work! I'm allowing myself to reactivate this thread because I get the exact same issue with Pixel 6, and I'd be happy to actively help you to solve it. The situation:

Here is the full error. It seems to copy the apps, and then fails trying to restore the internal storage and aborts (right?). I've tried with 2 different USB-C cables, and getting the exact same result.

Restoring internal storage.
./backup-tmp/Storage/Alarms/: 0 files pushed, 0 skipped.
adb: error: failed to copy './backup-tmp/Storage/Android/data/app.organicmaps/files/240613/Germany_Hesse_Regierungsbezirk Giessen.mwm' to '/storage/emulated/0/Android/data/app.organicmaps/files/240613/Germany_Hesse_Regierungsbezirk Giessen.mwm': remote couldn't create file: Permission denied
./backup-tmp/Storage/Aurora/: 0 files pushed, 0 skipped.
adb: error: failed to read copy responseils/1712429927291.jpg: 100%
adb: error: failed to read copy response3.gpx: 26%
adb: error: failed to read copy responseiko-v0.7.4(188).zip: 25%
adb: error: failed to read copy response
./backup-tmp/Storage/META-INF/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/Movies/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/Music/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/Notifications/: 0 files pushed, 0 skipped.
adb: error: failed to read copy responseContacts_23-10-22 18-48-18.vcf: 21%
adb: error: failed to read copy responseenshots/Screenshot_20240514-090244.jpg: 28%
adb: error: failed to read copy response
./backup-tmp/Storage/Podcasts/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/Ringtones/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/Signal/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response100%
adb: error: failed to read copy responsegram Documents/4_5827979245795676179.png: 77%
adb: error: failed to read copy responsebases/msgstore-2024-07-14.1.db.crypt14: 0%
adb: error: failed to read copy response20240717-001055.json
./backup-tmp/Storage/aegis-backup-20240717-001055...ushed, 0 skipped. 2.6 MB/s (2413 bytes in 0.001s)
adb: error: failed to read copy response20240717-001003.json
./backup-tmp/Storage/aegis-export-20240717-001003...ushed, 0 skipped. 4.0 MB/s (2417 bytes in 0.001s)
adb: error: failed to read copy response
./backup-tmp/Storage/assets/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/bluetooth/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response_02_07_21_41_15.vcf
./backup-tmp/Storage/contacts_2024_02_07_21_41_15...d, 0 skipped. 134.2 MB/s (283253 bytes in 0.002s)
adb: error: failed to read copy response_07_16_20_49_29.vcf
./backup-tmp/Storage/contacts_2024_07_16_20_49_29...d, 0 skipped. 118.1 MB/s (347241 bytes in 0.003s)
adb: error: failed to read copy response
./backup-tmp/Storage/lib/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/org/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
./backup-tmp/Storage/res/: 0 files pushed, 0 skipped.
adb: error: failed to read copy response
31 files pushed, 0 skipped. 113.1 MB/s (93066308 bytes in 0.785s)

After reading this thread, I tried using wireless, but I cannot make the Wireless restore work. It goes as follows:

  1. Successfully pair following your script
  2. It then somehow adds two devices instead of one, and the script therefore fails with adb: more than one device/emulator
mrrfv commented 1 month ago

It appears that many people having trouble with restoring backups using the script. I'm hoping that this isn't a showstopper thanks to the fact that the restore can be done manually by extracting the backup archive with 7-Zip and moving the files where they're supposed to be, but I'll make sure to debug this.

Looks like this particular problem is common (see https://github.com/Genymobile/scrcpy/issues/3241 for example), and solutions include using a different cable, connecting wirelessly or using a different PC.

It then somehow adds two devices instead of one, and the script therefore fails with adb: more than one device/emulator

You need to unplug your device after the pairing process is complete. Stop the adb server with adb kill-server and try again.

jmon12 commented 1 month ago

Hi! Thank you for your follow-up.

After having tried again with another cable, I tried with wireless and end up with exactly the same issue: the first file to be restored during Restoring internal storage fails with remote couldn't create file: Permission denied (exactly the same full error as above).

It doesn't seem to be due to the kind of connection (cables, wireless). I don't have access to another computer to test for now.

I'll dig around the issue you referred to. I'm at your disposal for any test you'd like me to perform.

jmon12 commented 1 month ago

After first having successfully run adb root, restoring the internal storage works. This implies that the phone must be rooted (right?), which is straightforward with LineageOS, but might be an issue with other OS's.

I don't know where you could add some adb root step when available.