Heimdall Galaxy S4 I337 Full Recovery

Search This thread

tom_callahan

Member
Jul 22, 2013
18
17
I ran into a corrupted or unaccessible /data partition several times this week, and after searching, couldn't find any tutorials on using heimdall to completely reset the phone back to stock. So... below is my version. Please provide any input on this method, it's worked a couple times with no issues for me.

FILENAMES BELOW ARE FOR ATT PHONE, if you are not ATT, use the relevant files for your carrier.

Instructions here were done on a Mac, but the programs and commands are the same on any Operating System.

1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

5) You will have several files now, some ext4.img, some .mbn, etc.

6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

7) On your Mac, open up Terminal, and navigate to the location you extracted the tar.md5 files to

8) In Terminal, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
8a) sudo heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
8b) sudo heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
8c) sudo heimdall flash --CACHE cache.img.ext4

9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware

Hope this helps, any questions don't hesitate to PM me.


===================WINDOWS VERSION, by popular request================================
Instructions here were done on a Windows 7 PC

1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

5) You will have several files now, some ext4.img, some .mbn, etc.

6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

7) On your PC, open up a Command Prompt (Click the "start" button, and type in cmd and hit enter), and navigate to the location you extracted the tar.md5 files to

8) In the command prompt, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
8a) heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
8b) heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
8c) heimdall flash --CACHE cache.img.ext4

9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware
 
Last edited:

oak

Senior Member
Aug 31, 2006
547
376
Colorado
Thanks for taking the time to do this. Provides an Odin - like option for Linux users like myself, and of course, Mac users too.

Sent from my GT-I9505G using xda premium
 

InstigatorX

Senior Member
Oct 11, 2011
632
739
I'm getting...

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
100%
ERROR: Failed to confirm end of file transfer sequence!
ERROR: RECOVERY upload failed!

Ending session...
Rebooting device...
Releasing device interface...

...Any advice? It looks like its uploading, fails, and reboots phone back to download mode.
 
G

GuestX0019

Guest
Interested in any solutions you guys found for your listed issues, as I have an iMac also--:)
 

Monkz

Senior Member
Dec 27, 2012
278
91
Toronto
I ran into a corrupted or unaccessible /data partition several times this week, and after searching, couldn't find any tutorials on using heimdall to completely reset the phone back to stock. So... below is my version. Please provide any input on this method, it's worked a couple times with no issues for me.

FILENAMES BELOW ARE FOR ATT PHONE, if you are not ATT, use the relevant files for your carrier.

Instructions here were done on a Mac, but the programs and commands are the same on any Operating System.

1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

5) You will have several files now, some ext4.img, some .mbn, etc.

6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

7) On your Mac, open up Terminal, and navigate to the location you extracted the tar.md5 files to

8) In Terminal, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
8a) sudo heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
8b) sudo heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
8c) sudo heimdall flash --CACHE cache.img.ext4

9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware

Hope this helps, any questions don't hesitate to PM me.

Im having that inaccessible /data partition and ODIN is not working for me. It flashes successfuly in ODIN, but upon boot it just hangs on the Samsung Galaxy S4 logo. When i go into the stock recovery, it shows the broken android and the cannot mount/data error. Its starting to become a real headache for me. I don't have a Mac tho, so i don't think your tool would work for me.
 

mg2195

Senior Member
Dec 5, 2011
2,983
2,572
29
RSM
Im having that inaccessible /data partition and ODIN is not working for me. It flashes successfuly in ODIN, but upon boot it just hangs on the Samsung Galaxy S4 logo. When i go into the stock recovery, it shows the broken android and the cannot mount/data error. Its starting to become a real headache for me. I don't have a Mac tho, so i don't think your tool would work for me.

Heimdall works on any platfork, mac/linux/windows...you just need java installed and your good to go, just use the command prompt instead of terminal. this was also stated in the op

You know...im surprised nobody has made a one click heimdal package yet...heimdal is so much better than odin imho

Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
 

Monkz

Senior Member
Dec 27, 2012
278
91
Toronto
Heimdall works on any platfork, mac/linux/windows...you just need java installed and your good to go, just use the command prompt instead of terminal. this was also stated in the op

You know...im surprised nobody has made a one click heimdal package yet...heimdal is so much better than odin imho

Sent from my SAMSUNG-SGH-I337 using Tapatalk 2

I'm going to try this when i get home then. I just want my phone to come to life again. Crossing my fingers that this will work! Things were perfect, i don't know why restoring a nandroid and updating my kernel has caused this to become such a terrible issue.
 

housry23

Senior Member
Sep 23, 2009
2,939
746
Springfield, OH
Seems to have worked. It's hung on the AT&T logo for a couple minutes though. How long after you did this did it take to boot up the first time? I'm afraid to pull the battery and screw something up.

---------- Post added at 01:19 PM ---------- Previous post was at 01:09 PM ----------

Never mind, I rebooted to recovery and factory reset just like you said in OP and now it's booted up to the setup screen. Thanks for this man. I really needed to return to stock and didn't want to have to install Windows just to run Odin. Much appreciated!
 

tom_callahan

Member
Jul 22, 2013
18
17
Try doing just hidden or system, and see if those flash correctly. If they do then come back after those and flash recovery

Sent from my SAMSUNG-SGH-I337 using xda app-developers app
 

tom_callahan

Member
Jul 22, 2013
18
17
Seems to have worked. It's hung on the AT&T logo for a couple minutes though. How long after you did this did it take to boot up the first time? I'm afraid to pull the battery and screw something up.

---------- Post added at 01:19 PM ---------- Previous post was at 01:09 PM ----------

Never mind, I rebooted to recovery and factory reset just like you said in OP and now it's booted up to the setup screen. Thanks for this man. I really needed to return to stock and didn't want to have to install Windows just to run Odin. Much appreciated!

Glad this worked for you, I was struggling to find a clear method to use heimdall to repair, which is exactly why I wanted to post help for any others.
 

housry23

Senior Member
Sep 23, 2009
2,939
746
Springfield, OH
Glad this worked for you, I was struggling to find a clear method to use heimdall to repair, which is exactly why I wanted to post help for any others.

Ugh...I returned to stock so that I could trade this S4 to someone on CL for a HTC One. He had no idea what CM10.1 was and so I figured it'd be best to trade him for a stock unrooted. So, I used your instructions to return to MDL. The guy flaked. Never showed up. GRRR! I kept getting bugged about the OTA, but never took it. I figured I'd just rerun CASUAL when I wake up in the morning and root it then. Well, apparently the update ran without me pressing the continue button. I'm so angry!

I wonder if this would work to roll back? Has anyone successfully rolled back to a previous firmware using Heimdall? I'd try, but I want to be sure I won't brick or mess anything up. Anyone?
 

mg2195

Senior Member
Dec 5, 2011
2,983
2,572
29
RSM
I'm getting...

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
100%
ERROR: Failed to confirm end of file transfer sequence!
ERROR: RECOVERY upload failed!

Ending session...
Rebooting device...
Releasing device interface...

...Any advice? It looks like its uploading, fails, and reboots phone back to download mode.

well ive been trying to make a one click package for heimdall however i too am facing this error, ive narrowed it down to the system.img.ext4 anyone have any ideas whats going wrong?
 

g_grey

Senior Member
Nov 6, 2010
125
4
I am also getting an issue when trying to flash hidden or system, both files claim that the computer cannot open them not sure what the problem is as i have redownloaded and checked the files to make sure all is well and can't seem to figure it out.
 

Gandalf

Inactive Recognized Developer / Retired Forum Mod
Mar 29, 2011
3,523
6,659
Philadelphia
works great flashing the UCUAMDL firmware downloaded from Adam's thread, and using Heimdall 1.40 on Mac OS X 10.8.4
 

white.noise

Senior Member
Oct 6, 2010
73
22
Is there a video on how to do this step by step? Im confused on how to execute commands. Or even better is there a way to do this in the front end/ using the gui of heimdall to get back to factory from a custom ROM?
PS using a Mac
 
Last edited:

Gandalf

Inactive Recognized Developer / Retired Forum Mod
Mar 29, 2011
3,523
6,659
Philadelphia
Is there a video on how to do this step by step? Im confused on how to execute commands. Or even better is there a way to do this in the front end/ using the gui of heimdall to get back to factory from a custom ROM?
PS using a Mac

I did this on a MacBook Pro running OS X 10.8.4, it was very simple and straightforward. PM if you need help after reading the instructions in the OP
 

mofoahh

Senior Member
Apr 17, 2006
118
6
well ive been trying to make a one click package for heimdall however i too am facing this error, ive narrowed it down to the system.img.ext4 anyone have any ideas whats going wrong?

I am also having this problem, but it is with the second line of commands ;modem.bin/NON-HLOS.bin/Aboot.mbn/tz.mbn.

It might be a bug with this release.

By the way I am running windows 7 64 bit.
 

svs57

Senior Member
Sep 4, 2012
445
52
I ran into a corrupted or unaccessible /data partition several times this week, and after searching, couldn't find any tutorials on using heimdall to completely reset the phone back to stock. So... below is my version. Please provide any input on this method, it's worked a couple times with no issues for me.

FILENAMES BELOW ARE FOR ATT PHONE, if you are not ATT, use the relevant files for your carrier.

Instructions here were done on a Mac, but the programs and commands are the same on any Operating System.

1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

5) You will have several files now, some ext4.img, some .mbn, etc.

6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

7) On your Mac, open up Terminal, and navigate to the location you extracted the tar.md5 files to

8) In Terminal, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
8a) sudo heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
8b) sudo heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
8c) sudo heimdall flash --CACHE cache.img.ext4

9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware

Hope this helps, any questions don't hesitate to PM me.


===================WINDOWS VERSION, by popular request================================
Instructions here were done on a Windows 7 PC

1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

5) You will have several files now, some ext4.img, some .mbn, etc.

6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

7) On your PC, open up a Command Prompt (Click the "start" button, and type in cmd and hit enter), and navigate to the location you extracted the tar.md5 files to

8) In the command prompt, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
8a) heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
8b) heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
8c) heimdall flash --CACHE cache.img.ext4

9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware
i need help. heidmall can't open large files for example my system.img (2367450528 byte)
I recompile heidmail with -D_FILE_OFFSET_BITS=64
now it can open my system.img
but i got new error:
ERROR: Failed to confirm end of file transfer sequence!
I know that there is patch for this error.
do anybody have this patch?
I downloaded latest sources but still have this error
I don't have 64 bit pc to flash...
please help me
debug
[201.975789] [00000c5b] libusbx: debug [usbi_handle_transfer_completion] transfer 0x8395014 has callback 0xb7763480
[201.975840] [00000c5b] libusbx: debug [bulk_transfer_cb] actual_length=1024
[201.975900] [00000c5b] libusbx: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 8
[201.975985] [00000c5b] libusbx: debug [libusb_submit_transfer] arm timerfd for timeout in 120000ms (first in line)
[201.976044] [00000c5b] libusbx: debug [libusb_handle_events_timeout_completed] doing our own event handling
[201.976097] [00000c5b] libusbx: debug [handle_events] poll() 3 fds with timeout in 60000ms
[201.984117] [00000c5b] libusbx: debug [handle_events] poll() returned 1
[201.984242] [00000c5b] libusbx: debug [reap_for_handle] urb type=3 status=0 transferred=8
[201.984307] [00000c5b] libusbx: debug [handle_bulk_completion] handling completion status 0 of bulk urb 1/1
[201.984374] [00000c5b] libusbx: debug [handle_bulk_completion] last URB in transfer --> complete!
[201.984434] [00000c5b] libusbx: debug [disarm_timerfd]
[201.984480] [00000c5b] libusbx: debug [usbi_handle_transfer_completion] transfer 0x8394c0c has callback 0xb7763480
[201.984539] [00000c5b] libusbx: debug [bulk_transfer_cb] actual_length=8
ERROR: Failed to unpack received packet.
SYSTEM upload successful

Ending session...
 
Last edited:

petelg

New member
Dec 1, 2013
2
0
Same problem

I'm getting...

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
100%
ERROR: Failed to confirm end of file transfer sequence!
ERROR: RECOVERY upload failed!

Ending session...
Rebooting device...
Releasing device interface...

...Any advice? It looks like its uploading, fails, and reboots phone back to download mode.


Did you ever figure this out? I am having the same exact problem. Not sure what to do next. Any help will be appreciated!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 14
    I ran into a corrupted or unaccessible /data partition several times this week, and after searching, couldn't find any tutorials on using heimdall to completely reset the phone back to stock. So... below is my version. Please provide any input on this method, it's worked a couple times with no issues for me.

    FILENAMES BELOW ARE FOR ATT PHONE, if you are not ATT, use the relevant files for your carrier.

    Instructions here were done on a Mac, but the programs and commands are the same on any Operating System.

    1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

    2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

    3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

    4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

    5) You will have several files now, some ext4.img, some .mbn, etc.

    6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

    7) On your Mac, open up Terminal, and navigate to the location you extracted the tar.md5 files to

    8) In Terminal, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
    8a) sudo heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
    8b) sudo heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
    8c) sudo heimdall flash --CACHE cache.img.ext4

    9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

    10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware

    Hope this helps, any questions don't hesitate to PM me.


    ===================WINDOWS VERSION, by popular request================================
    Instructions here were done on a Windows 7 PC

    1) Download the tar.md5 firmware files from galaxys4root DOT com or any other site which has them. I used the I337UCUAMDL_I337ATTAMDL_ATT.zip file

    2) Download and install heimdall latest. I can't post links yet, google heimdall and you should find the site to download it.

    3) Unzip the I337UCUAMDL_I337ATTAMDL_ATT.zip file, and you should get a folder with a tar.md5 file in it.

    4) Using 7zip or similar, extract the tar.md5 file. You have have to rename it to just .tar instead of .tar.md5 for this to work.

    5) You will have several files now, some ext4.img, some .mbn, etc.

    6) You will now reboot your phone into "ODIN" mode, by holding Volume Down when booting, just after the vibration. When prompted, hit Volume Up to begin download mode.

    7) On your PC, open up a Command Prompt (Click the "start" button, and type in cmd and hit enter), and navigate to the location you extracted the tar.md5 files to

    8) In the command prompt, type the following in the below order. The phone will reboot between each, you will need to repeat step 6 for each reboot.
    8a) heimdall flash --RECOVERY recovery.img --SYSTEM system.img.ext4 --HIDDEN hidden.img.ext4 --BOOT boot.img
    8b) heimdall flash --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --BOOT boot.img --TZ tz.mbn
    8c) heimdall flash --CACHE cache.img.ext4

    9) When your phone reboots the last time, it may just sit on the Samsung screen and not do anything. If this happens, reboot the phone (hold down the side power button) and hold Volume Up to reboot into Recovery mode. Use volume up and down to navigate to factory reset, and the power button to select. This will reformat and clean up your data partition.

    10) Reboot the phone and wait patiently. You will see all the familiar factory logos and boot into a fresh working factory firmware