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

TWRP 3.2.1-0 fails to map file #1136

Open
Unkn0wnM3m3 opened this Issue Dec 31, 2017 · 17 comments

Comments

Projects
None yet
9 participants
@Unkn0wnM3m3
Copy link

Unkn0wnM3m3 commented Dec 31, 2017

I got a Samsung Galaxy Note 4 T-Mobile. I Tried to flash a ROM on my phone and it simply said,

Failed to map file '/externel_sd/1-HAX/RaceRom_N7_Port_V13_Aroma_by_LocDog_and_keki7.zip Error installing zip file '/externel_sd/1-HAX/RaceRom_N7_Port_V13_Aroma_by_LocDog_and_keki7.zip'

I am new to this stuff, can someone explain to me what I did wrong and how I can solve it?

@Unkn0wnM3m3

This comment has been minimized.

Copy link

Unkn0wnM3m3 commented Dec 31, 2017

Also, in updater-script, it does not identify a specific model. So, I don't think that it has to do with that.

@Unkn0wnM3m3

This comment has been minimized.

Copy link

Unkn0wnM3m3 commented Jan 3, 2018

If it helps it's an aroma Rom

@Unkn0wnM3m3

This comment has been minimized.

Copy link

Unkn0wnM3m3 commented Jan 3, 2018

But I can't flash gapps either

@pgonin

This comment has been minimized.

Copy link

pgonin commented Feb 9, 2018

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/)

@pgonin

This comment has been minimized.

Copy link

pgonin commented Feb 9, 2018

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);
@pgonin

This comment has been minimized.

Copy link

pgonin commented Feb 9, 2018

and I am actually using twrp-3.2.1-1-i9305
but I don't think it makes a big difference

@Atexor

This comment has been minimized.

Copy link

Atexor commented Feb 11, 2018

I encountered the same problem with LOS and AICP on my gt-i9305.

edit: flashed older version of TWRP - 3.0.2.1 - flashing works. Latest version is broken for S3.

@pgonin

This comment has been minimized.

Copy link

pgonin commented Feb 12, 2018

Same for me flashing works with older version of TWRP - 3.0.2.1

@Atexor thanks for sharing !

@rojanor

This comment has been minimized.

Copy link

rojanor commented Feb 18, 2018

Same here, twrp 3.0.2.1 works fine, the newer versions give the failed to map error when installing lieageos

@ripee

This comment has been minimized.

Copy link

ripee commented Feb 28, 2018

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.

@pgonin

This comment has been minimized.

Copy link

pgonin commented Feb 28, 2018

@ripee no problem regarding feedback, especially since we had a workaround.
I can give build 3.2.1-2 a shot but sorry for the dumb question, what do you call your 'thread' ?

@ripee

This comment has been minimized.

Copy link

ripee commented Mar 8, 2018

@pgonin, this is my thread: https://forum.xda-developers.com/galaxy-s3/development-i9305/recovery-twrp-3-2-1-0-t3741413

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?

@ripee

This comment has been minimized.

Copy link

ripee commented Jun 8, 2018

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.

@DaGeRe

This comment has been minimized.

Copy link

DaGeRe commented Jul 6, 2018

I had a stock Galaxy S2, installed TWRP and boot using
sudo 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.

A workaround is to download twrp 3.1.0, to execute
sudo heimdall flash --repartition --pit Part-i9100-sys2gb-apps4gb-data8gb.pit --KERNEL boot.img --RECOVERY twrp-3.1.0-0-i9100.img in download mode and to install everything from there.

It would be realy nice if this would be working with newest twrp again.

@hopfenzapfen hopfenzapfen referenced this issue Sep 23, 2018

Closed

TWRP 3.2.3-0 fails to map file on whyred #1321

4 of 4 tasks complete
@kwah-gh

This comment has been minimized.

Copy link

kwah-gh commented Sep 26, 2018

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!

So, here is the winning sequence (in my case):
heimdall flash --repartition --pit I9100_1.5GB-System_6GB-Data_512MB-Preload_by-the.gangster.pit --KERNEL boot.img --RECOVERY twrp-3.0.2-1-i9100.img
followed by
adb sideload lineage-14.1-20180920-nightly-i9100-signed.zip

@ripee: Could you please mention in your [RECOVERY][OFFICIAL] TWRP 3.2.3-0 [I9100] that this specific version not always works? If you need help with testing recovery fixes on i9100 - just ping ;)

@montvid

This comment has been minimized.

Copy link

montvid commented Dec 18, 2018

Faced the same issue with Galaxy S2 i9100 and twrp-3.2.3-0-i9100.img. Solved by twrp-3.0.2-1-i9100.img. Any fix down the pipe?

@TheJJ

This comment has been minimized.

Copy link

TheJJ commented Dec 27, 2018

My solution for this was to repackage the zip file.....

# downloaded zip file that fails to map
$ file firmware_5.1.7_oneplus5t.zip
firmware_5.1.7_oneplus5t.zip: Zip archive data, at least v2.0 to extract

# extract it
$ unzip firmware_5.1.7_oneplus5t.zip
$ ls
firmware_5.1.7_oneplus5t.zip  firmware-update  META-INF  RADIO
# remove old zip
$ rm firmware_5.1.7_oneplus5t.zip
# repack new zip
$ zip -r firmware_5.1.7_oneplus5t_repackaged.zip *
[...]
$ file firmware_5.1.7_oneplus5t_repackaged.zip
firmware_5.1.7_oneplus5t_repackaged.zip: Zip archive data, at least v1.0 to extract

The latter file succeeds to map and install.

The actual problem seemed to be that my adb push somehow didn't upload the original file:

-rw-rw----  1 root sdcard_rw  63795954 2018-12-27 19:13 firmware_5.1.7_oneplus5t_repackaged.zip
-rw-rw----  1 root sdcard_rw         0 2018-12-27 18:32 firmware_5.1.7_oneplus5t.zip

=> make sure the file was properly sent to your device!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment