This comment has been minimized.

This comment has been minimized.

I have a Galaxy S3 (i9305) and I also get this error message when trying to install a ROM
I had the issue with LineageOS and Resurrection Remix OS ROMs
I tried on both external SD and internal stroage (/sdcard/)

This comment has been minimized.

edited

I can track the error in the code to minzip/SysUtil.h

Apparently the zip file cannot be mapped into memory

/*
* Map a file into a private, read-only memory segment. If 'fn'
* begins with an '@' character, it is a map of blocks to be mapped,
* otherwise it is treated as an ordinary file.
*
* On success, "pMap" is filled in, and zero is returned.
*/
int sysMapFile(const char* fn, MemMapping* pMap);

This comment has been minimized.

I apologize for not seeing the existing feedback sooner. If you haven't already, please direct your attention to build 3.2.1-2 linked in my thread, and give any feedback. I came across this issue thread here entirely by accident, so please leave feedback on XDA.

This comment has been minimized.

I set out to build an officially supported twrp so that new versions would be built automatically with minimal changes to the source code in the long term. This mapping problem is also plaguing my Galaxy S2 i9100 twrp, I'm mentioning it here because both the i9305 and i9100 use the same kernel.

I suspect this has something to do with either the partition sizes or the way my build handle the external SD card.

For those of you experiencing problems with my builds, are you able to flash anything from internal storage or is it impossible to flash from either internal or your SD card?

This comment has been minimized.

I've just completed work on the Galaxy S2 GT-I9100, which uses the same kernel as the GT-I9305. I managed to overcome the "Failed to map" error by first extracting the boot.img file from the zip of the rom I intend to flash, flashing it in 3.2.1-1, then flashing the rom zip as usual.

The reason this is necessary is that twrp 3.2.1 is ahead of its time lol. Unless and until Oreo comes to the S3 and I can update my twrp device tree accordingly, this is the best way to migrating to 3.2.1 to ensure Oreo compatibility in the future.

This comment has been minimized.

I had a stock Galaxy S2, installed TWRP and boot usingsudo heimdall flash --repartition --pit Part-i9100-sys2gb-apps4gb-data8gb.pit --KERNEL boot.img --RECOVERY twrp-3.2.2-0-i9100.img
and afterwards tried to install LineageOS by first swiping cache, system and data and then installed lineage-14.1-20180329-nightly-i9100-signed.zip from an SD-Card, and I also got the error.

This comment has been minimized.

Faced the same issue with Galaxy S2 i9100 and twrp-3.2.3-0-i9100.img
Initial attempt was to follow official LineageOs guide, which failed (don't remember exactly all the reasons already, but one of them - I had hard time replacing ClockworkMod recovery with TWRP)... Then found this detailed explanation on reddit and started experimenting with repartitioning.

Well... After some failed attempts faced with "failed to map" file errors and found this issue.

In the end followed suggestion of @rojanor and went all the way to 3.0.2-1, which did work!