Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using termux-setup-storage wipes internal memory #735

Closed
mmkiir opened this issue Jun 25, 2018 · 9 comments · Fixed by #737
Closed

Using termux-setup-storage wipes internal memory #735

mmkiir opened this issue Jun 25, 2018 · 9 comments · Fixed by #737

Comments

@mmkiir
Copy link

mmkiir commented Jun 25, 2018

Android: 7.1.2 (Nougat)
Termux version: 0.62

I've had my device's internal memory wiped when I updated to the latest release and ran "termux-setup-storage" in the terminal. To confirm, I created a few files and ran the command again which again wiped the phone's internal memory.

I've encountered this on my OnePlus 3t and a friend's Redmi Note 5, both running android 7.1.2 (Nougat).

@ghost
Copy link

ghost commented Jun 25, 2018

@porasjeet Just run termux-setup-storage twice and got wiped aswell.
@fornwall This is a serious issue and perhaps it is introduced in bbd46a7. Maybe we should revert this temporarily ?

@rjt-rockx
Copy link

Not sure if the storage has been completely wiped or just unmounted though.
Also theoretically there should've been a confirmation dialog of sorts before files get deleted.

@ghost
Copy link

ghost commented Jun 25, 2018

@rjt-rockx It is probably a bug. Only ~/storage with symlinks should be deleted but not entire /sdcard.

@fornwall
Copy link
Member

That was bad. I'm so sorry for this critical issue!

This has been fixed in version 0.63, which has been submitted to the Play store as an update. The release has been tagged so should be available also on F-Droid soon.

@fornwall
Copy link
Member

Thanks to everyone involved who reported and helped with understanding and fixing the problem!

@jisan0010
Copy link

@fornwall
Android: 7.1.2 (Nougat)
Termux version: 0.62

i ran termux-setup-storage on my android device for access my internal memory.
But when i ran the command the phone storage wiped.
Now what i do?
if latest version of termux(.063) fixed the problem,then what i do now for my delleted data?
Is there any way to recover my all data?

Thanks

@Grimler91
Copy link
Member

@jisan0010 Check out one of the numerous guides online, for example https://forum.xda-developers.com/showthread.php?t=2462426. Note that I haven't tried it.

It might be possible to restore some of the data. Don't use your phone before you try restoring it as new files will overwrite the deleted data.

@ghost
Copy link

ghost commented Nov 16, 2018

to get back some files?

To get back some files, make sure that the following conditions are met:

  1. Your phone is rooted.
  2. Your phone has custom recovery installed, e.g. TWRP.
  3. Data partition encryption is disabled.
  4. Phone was turned off immediately after files were wiped.

If all these conditions are met, then you can dump data partition somewhere, e.g. external sdcard, and perform recovery on PC (there plenty of free/paid software to do this).

dump data partition:
Can be done using dd over ADB. Example: adb shell dd if=/dev/block/mmcblk0p8 of=/ext_sdcard/mydata.img.

File recovery from unencrypted partition dump is the only reliable way. For other (easier) ways see https://forum.xda-developers.com/showthread.php?t=2462426.


If you don't have root and data encryption enabled (on Android 6.0+ it enabled by default), you are out of luck, unfortunately. Modern Android devices designed in way that prevents (or makes it very hard) access to data bypassing Android OS.

Also, you should know that deleted files continue exist as unallocated space. Shortly: the longer you use your device the less probability of successfull data recovery.


In addition to everything I wrote above - it is better to ask such questions somewhere on XDA in threads related to your device. Here is a Termux Application issue/bug tracker and not a data recovery center...

@ghost
Copy link

ghost commented Nov 16, 2018

It is fixed in official Termux 0.65. Proof:

screenshot_1542389060

If you still want to use old Termux versions - expect to have all bugs that they contain.


If you managed to place your files to directory ~/storage - then no one will help you. This directory completely managed by Termux, and to prevent file clashes it completely wipes it (note that your sdcard is untouched) - expected behaviour.

The purpose of directory ~/storage is to provide a symlinks to shared and external storage, like /mnt directory.

The bug was device's internal memory wiped and it was fixed. But wiping of ~/storage is intentional.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants