Project

General

Profile

Issue #969

Factory reset doesn't function on encrypted devices.

Added by Richard "Cylus" Palmer almost 5 years ago. Updated over 3 years ago.

Status:
Rejected
Priority:
Normal
Category:
Framework
Target version:
Start date:
09/19/2014
Due date:
% Done:

0%

Resolution:
invalid
Device:
Galaxy S 3 (I9300)

Description

When attempting to perform a factory reset from the version of ClockworkMod distributed on the Replicant site, the reset will fail on encrypted devices, saying that /data cannot be mounted (as ClockworkMod doesn't have the decryption key). When trying to perform a factory reset from Replicant, Replicant reboots into ClockworkMod, which still can't preform the reset. However, when sent over from Replicant, the reset silently fails.

In either of these cases, the correct behavior would be to format the partition instead of trying to mount it and delete its files, but that does not happen.

I don't know if all GT-I9300s have the same partition sizes and layout, but for my device's drive setup, running this was necessary to perform the actual reset:

adb shell mke2fs -t ext4 /dev/block/mmcblk0p12 3022844

History

#1 Updated by Paul Kocialkowski almost 5 years ago

  • Status changed from New to In Progress

You probably selected the wrong option in ClockWorkMod. The one to use in order to format the partition (instead of mounting it and wiping some of the data) is: format /data and /data/media (/sdcard) from mounts and storage.

Please let me know whether that is the case so that I can close this issue.

#2 Updated by Richard "Cylus" Palmer almost 5 years ago

I tried formatting the partition in these ways:
  • The method you mentioned: (ClockworkMod) > Mounts and Storage > format /data and /media (/sdcard)
  • (ClockworkMod) > Mounts and Storage > format /data
  • (ClockworkMod) > wipe data/factory reset
  • (Replicant) > Settings > Backup & reset > Factory data reset > Reset phone

None of them worked. The three in ClockworkMod tell me that they cannot format the partition because they cannot mount it (which is odd, as you would want the partition UNmounted before formatting it. The one in Replicant silently fails.

#3 Updated by Paul Kocialkowski almost 5 years ago

That's odd, the method I mentioned did work in my case. Could you retry and double-check? If it still fails, I'll go through the process again on my device.

Note that running mke2fs may be a bad idea because some chunks of the partition have to be left free to allow for encrypting.

#4 Updated by Richard "Cylus" Palmer almost 5 years ago

I was worried you'd have me do that. I need to find a reliable way to back up my data. My backup this time was a bust again.

Anyway, I tried again, and this time, that option worked. I don't know if I had a damaged copy of Replicant at the time (I had to reinstall not too long ago due to some sort of break, meaning that any damaged components were replaced) or I was mistaken that that was one of the options I tried.

An issue remains though. The intuitive way to wipe the device is from in Replicant itself ((Replicant) > Settings > Backup & reset > Factory data reset > Reset phone). When trying to perform a wipe, it will fail if the device is encrypted (yes, I checked that method again too, while I was at it). My guess is that Replicant is trying to use the "(ClockworkMod) > wipe data/factory reset" method, when it should be trying to use the working "(ClockworkMod) > Mounts and Storage > format /data and /media (/sdcard) method.

#5 Updated by Paul Kocialkowski almost 5 years ago

  • Status changed from In Progress to Rejected
  • Resolution set to invalid

I was worried you'd have me do that. I need to find a reliable way to back up my data. My backup this time was a bust again.

Sorry about that, but that's how it is with debugging such issues. I have lost my data countless times in the process of developing Replicant!

Anyway, I tried again, and this time, that option worked. I don't know if I had a damaged copy of Replicant at the time (I had to reinstall not too long ago due to some sort of break, meaning that any damaged components were replaced) or I was mistaken that that was one of the options I tried.

That makes sense, thanks for the confirmation.

An issue remains though. The intuitive way to wipe the device is from in Replicant itself ((Replicant) > Settings > Backup & reset > Factory data reset > Reset phone). When trying to perform a wipe, it will fail if the device is encrypted (yes, I checked that method again too, while I was at it). My guess is that Replicant is trying to use the "(ClockworkMod) > wipe data/factory reset" method, when it should be trying to use the working "(ClockworkMod) > Mounts and Storage > format /data and /media (/sdcard) method.

I haven't looked so much in that direction but on first approach, it seems to make sense. The Factory data reset thing is not supposed to wipe the internal storage data, while the recovery format does. It makes sense to me that this fails as wiping the internal storage along with data doesn't seem like expected behavior. So there is a trade-off to do here, and I think the current one is the right thing to do.

I'll mark this issue as closed, but feel free to continue the discussion if you disagree with my approach.

#6 Updated by Denis 'GNUtoo' Carikli over 3 years ago

  • Category changed from 117 to Framework
  • Device set to Galaxy S 3 (I9300)

Also available in: Atom PDF