Lanchon / REPIT

A Device-Only Data-Sparing Repartitioning Tool For Android
162 stars 26 forks source link

Force unmounting of partitions #35

Open tavernatrev opened 8 years ago

tavernatrev commented 8 years ago

Hi Lanchon,

Thanks for your hard work - it's very much appreciated.

I've been attempting to flash 'lanchon-repit-20160415-system=1-data=6-sdcard=max++ext4-preload=min+wipe-i9100.zip' using TWRP 3.0.2-1 (for CM13), booted afresh, but I receive an error that sdcard0 can't be unmounted. The same happens when flashing a second time from /tmp, and my phone is not encrypted according to my Security settings. I've also tried TWRP 2.8.7.0 (recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab)), and the error I receive then is that /emmc can't be unmounted.

If it's of any relevance, my i9100 has previously been repartitioned (twice) using Odin (currently 1GB /system and 4GB /data, with /preload still present), and my sdcard0 has been reformatted as ext4 using the terminal, with permissions set correctly.

Possibly also of note: I've been trying to use the 'EFS Professional' tool from XDA recently to make an EFS backup, and that wouldn't display any partitions to back up (although it said that the partition table was read correctly). I have been able to make an EFS backup using the Partitions Backup Application from the Play Store, however.

Thanks for any assistance!

twrp log.txt

tavernatrev commented 8 years ago

I've worked around this issue by running a couple of commands from TWRP's terminal: I flashed the zip to insert a copy of itself into /tmp, then typed fuser -km /sdcard0 followed by umount /sdcard0 (and then repeated for /sdcard1, which also couldn't be unmounted).

I wouldn't recommend anybody else tries this until Lanchon has commented in case there's a risk of data loss from the above commands.

Successful log: recovery.txt

Lanchon commented 8 years ago

hi,

thank you very much, i'm sure it will help some people. so far the unmountable cases were caused by MTP being enabled or USB mass storage having been enabled at some point after booting up TWRP.

i wonder what fuser -m /sdcard0 would have said in your case. there should be no risk of data loss, i'm just surprised that the killed process was not TWRP itself. maybe it was; it might restart after dying.

anyway, thank you a lot for writing!

Lanchon commented 8 years ago

i'm gonna leave it open for the time being, maybe other people will find this that way.

tavernatrev commented 8 years ago

Thanks Lanchon. I think, to be honest (having read your response), the problem was MTP being left enabled in TWRP's Mount menu from a previous recovery session. I hadn't, of course, entered the Mount menu and enabled USB storage or MTP before flashing, but the MTP enable/disable state had persisted from before. I disabled it, then ran a simple umount /sdcard0 and it returned no errors. This also explains why /sdcard1 had to be forced off as well, as that was ticked in the list of partitions in the Mount menu.

Perhaps update the readme to mention checking the MTP status as well as not mounting USB? Maybe this is something new with TWRP 3.0.2-1?

Lanchon commented 8 years ago

MTP being enabled is not the problem. the problem is that your probably actually mounted via MTP, by connecting to the PC at some point after booting TWRP. my linux box is configured not to automount anything so i dont have that problem. i think REPIT docs say somewhere not to connect to the PC at all. if not, yes, it should be added. :)

pvagner commented 7 years ago

Hello, Just to add to all the use cases / experiences. I'm blind, I'm always using TWRP with cable connected to my laptop so I can use twrp command over ADB. This is the only way I can use TWRP because I can't see what it's displaying on a touch screen. In such a case either preventing software on my laptop automagically mounting MTP devices as their appear as @Lanchon recommended is one option. Another option is setting MTP to stay disabled at TWRP side. twrp script has a set command and calling twrp set tw_mtp_enabled 0 reboot recovery in an ADB TWRP session does the trick also.

Lanchon commented 7 years ago

hi,

thanks for your contribution. btw, i'm very glad that i implemented support for adb sideloading in REPIT, hope it helped with accessibility.

early boot in phones is really very non-accessible, and hope that changes soon. not only to be inclusive of everyone, but also to help the millions of people with broken screens who want to recover the data locked in their dying phones.

thanks!