OTA Update without loosing root and wiping data possible?

midiwidi

Member
May 25, 2008
15
2
0
While thinking about what went wrong, I remember and was wondering why flashing the system.img was so quick. The fastboot output states that only 16384 KB of the 4.01 GB were sent to the device. I'll have to find out why. 16384 is a power of two and therefore sounds like a size restriction of at least the version of fastboot I've used.
 

midiwidi

Member
May 25, 2008
15
2
0
I've tried to flash the system.img with the newest version of fastboot I found on the internet. It showed the following message if I did that in download mode

C:\Users\midiwidi\Downloads\HTC_U11+\Original_HTC_Firmware_Europe\OUT_2Q4D_1.10.401.23\system>fastboot flash system system.img
target reported max download size of 2399200000 bytes
Invalid sparse file format at header magic

... and in fastboot mode

C:\Users\midiwidi\Downloads\HTC_U11+\Original_HTC_Firmware_Europe\OUT_2Q4D_1.10.401.23\system>fastboot flash system system.img
target reported max download size of 536870912 bytes
Invalid sparse file format at header magic

So if the maximum download file size is only 2.23 GB in download mode and 512 MB in fastboot mode, how can I get the 4.01 GB big system.img onto my phone?
 

midiwidi

Member
May 25, 2008
15
2
0
As I wasn't able to flash the system.img, I had another look for a TWRP with decryption enabled. I found a new version (TWRP 3.2.1) and flashed it. After booting into recovery, I was asked for my lock pattern and after entering it, TWRP was able to decrypt my data. With the TWRP file manager I can access /data and modify files there. I was very happy about that and rebooted to download and apply the OTA.
Unfortunaltely, the pattern check at the beginning of the booting process repoorts now that the pattern I've entered is wrong and it decreases a tries counter.
No I have an even bigger problem, because I can't use my phone. I know I enter the correct pattern because I had it for a long time and TWRP is accepting it and is able to decrypt /data.

Is there a way to fix that?
I already renamed gatekeeper.pattern.key, gatekeeper.password.key, locksettings.db, locksettings.db-shm and locksettings.db-wal in order to remove the encryption, but it didn't work. It only reset the retry counter.
 

midiwidi

Member
May 25, 2008
15
2
0
You can use this command for flash system.img
>fastboot -S 512M flash system system.img
flashing the system.img still isn't working

C:\Users\midiwidi\Downloads\HTC_U11+\Original_HTC_Firmware_Europe\OUT_2Q4D_1.10.401.23\system>fastboot.exe -S 512M flash system system.img
Invalid sparse file format at header magic
 

midiwidi

Member
May 25, 2008
15
2
0
Thanks. I know this installer already.
It seems that the max size reported by the phone is just smaller than the system.img
I managed to flash the system.img using TWRP. I mounted /system using the TWRP menu. Then I used adb shell to look at the output of the "mount" command. It showed that /dev/block/sda5 was mounted to /system. Then I umounted /system using the TWRP menu and pushed my system.img onto the sdcard with

adb push c:\Users\midiwidi\Downloads\HTC_U11+\Original_HTC_Firmware_Europe\OUT_2Q4D_1.10.401.23\system\system.img /sdcard

Then I flashed it with

dd if=/sdcard/system.img of=/dev/block/sda5

But I still got the problem that my decryption pattern is not accepted during the normal boot process. That is so strange because TWRP uses the same pattern to sucessfully decrypt my /data partition.
Does nobody have an idea why that happens?