How to fix a Bootloop ! Read this before posting !

30

itxtutor

Editor in Chief
Staff member
May 15, 2015
59,688
412
113
Hey guys,


Today i want to write a little "check" guide on what you should try when you encounter a Bootloop !


So what is a bootloop ?


When you have a bootloop, you will notice that the boot process of your phone keeps looping and looping. You will see the boot up animation and hear the sound for an unlimited time and never reach android.


What causes a bootloop ?


A bootloop can occur very easy. Mostly its because the system files are broken or they interfer with each other and cause a crash at booting. Then the system restarts and everything happens again.


A lot of things can cause a bootloop, a wrong recovery image, incorrect permissions , mixing roms.... So first of all you should think about what could have caused my bootloop ?


Read here if you got CWM on your phone :


Bootloop after flashing a wrong ROM


either


you flashed a wrong rom which isnt for your phone , if thats the case, you have to find a correct rom. there is no way around that, you cant flash for instance 6589 roms to an 6572 SoC and expect that it will work !


or you flashed a correct rom but you didnt automatically wipe your dalvik-cache. So your old cache will be used for a new rom. That can cause a bootloop. And thats also why you should wipe cache before installing a rom over CWM !


Now here is how to fix the "correct rom" issue :

1. Start your phone in CWM Recovery
2. Go to Advanced


3. Choose “Wipe dalvik-cache”


4. Now go to “Mounts & Storage”


5. Choose “Wipe /cache”


6. Reboot your phone
you need to wipe both cache partitions to be sure that everything is wiped. Now if the problem still exists, you should also do a factory reset ( wipe /data ). But please BACKUP before you do that ! It will wipe all your user data


to backup in cwm :

1. Start your phone in CWM Recovery
2. Now go to “Backup & Restore”


3. Choose “backup” (it may also be called “backup to internal/external sdcard)
to wipe data :


1. Now go to “Mounts & Storage”


2. Choose “Wipe /data”


3. Choose “Wipe /cache”


4. Reboot your phone


If you still cant boot. It looks like the wrong is broken or not for your phone. Sometimes you can even install wrong roms over CWM !


After you have restored with a Backup


Now if you just flash the system (android) you also need to flash cache.


When you got CWM you are good to go, just do a full cache wipe again as shown above.


After modding the OS (Themes,Font etc)


if you flashed an update zip and have the folder still on the pc. There might be something wrong with the mod you flashed. This happens if the baserom version is incorrect or the mod is just coded badly. Now wiping cache may wont resolve that issue. You need to edit the mod you flashed. So take a look at the system folder of the update zip you have flashed.


So here is what you should do :

1. Open the mod zip with Winrar ( you can download that from google)
2. Now look inside the “system” folder. There should be a framework folder.


3. The framework folder will contain: android.policy.jar & framework-.apk


4. Now you should replace them with the files of your base / stock rom. You can find them in the same folder. Just drag and drop them in in winrar.


5. Now it will ask for a compression level, choose “Store”.


6. Now put the zip on phone storage or external SD and install like you did before.


7. The bootloop should be fixed. if not reinstall the zip with a mounted /system (Mounts & Storage > Mount /system)
You can also try to wipe cache again as shown above.


wrong permissions


If your phone is rooted and you play around with the permissions in ES file explorer or on the pc , you could damage the permissions of important boot / system files.


Correct permissions for partitions :

- 644 (RW-R-R) – (this is best known system permission, it exists in /system/app, /system/framework, /system/etc, /system/lib and allot of separate files)
- 755 (RWX-RX-RX) – (mainly used for /system/bin, only files that have to be executed are 755 or higher.)


- 777 (RWX-RWX-RWX) – (used for scripts inside /system/etc/init.d and busybox files)
But if you got CWM , there is an easy fix for that :


So just use “Fix permissions” option in CWM under Advanced. be sure to mount the partitions before running the fix. Although this doesn’t cover all permissions. But give it a try !


If you are using the CWM zip fix method from above, read here


Now you may know, each zip in CWM requires an updater script. Basically the script tells CWM where it should place the mod files from the zip. Now if you want to get your stock files back, you just have to search them in your stock rom, replace the files with the modded files in winrar and then flash the CWM zip back.


If you got an system.img and not a system folder, you need to unpack the system.img using linux. On windows you will get archive damaged !


When you got the original files, just drag and drop them in the cwm zip (correct folder too), then choose “store” as compression level. Now install the zip !


Note that we are using here “edify scripting”, which the Android Kitchen you can convert it easily to “amend scripting” if needed ( errors )


Commands for updater-scrip


Now you may need to recode the updater script.


it should be under YourZIP.zip/META-INF/com/google/android/


Mount & Install

package_extract_file(“busybox”, “/tmp/busybox”);
set_perm(0, 0, 0777, “/tmp/busybox”);


run_program(“/tmp/busybox”, “mount”, “/system”);
that extracts busybox to /tmp/busybox and sets correct permissions.


Now the system folder of your zip needs to be extracted :

package_extract_dir(“system”, “/system”);
Setting Permissions

To set permissions of an individual file:
set_perm(0, 0, Mod, “File here”);


A working example:


set_perm(0, 0, 0644, “/system/build.prop”);


To set permissions of a directory:


set_perm(0, 0, Mod, “Dir here without a trailing slash”);


A working example:


set_perm(0, 0, 0755, “/system/etc”);
Setting Permissions Recursively

To set permissions to all files inside a directory (resursive):
set_perm_recursive(0, 0, 0755, Mod, “Dir here without a trailing slash”);


A working example:


set_perm_recursive(0, 0, 0755, 0777, “/system/etc/init.d”);
Solve the Bootloop with ADB and CWM fix zip :


You need this when you cant put your CWM fix on the phone because you got no sd slot or card or problems with mounting.


ADB can only be used during the boot (so while its booting ) but some bootloops interrupt the adb handshake and make it impossible to use.


And you can use ADB in CWM (only newer versions).


the problem is when you use ADB without CWM, the bootloop will interrupt connection. So you just got a limited time to fix it. Now this guy from XDA is using a really nice script which monitors the state of the device and freezes the phone , then it pushes your created CWMZip to the phone.


he uses a script called ondemand.bat which requires adb.exe and 2 dll´s


on windows :


open a text editor and paste in these lines :

@echo off


cd /d %~dp0


echo.


echo Waiting for device…


adb wait-for-device


echo.


adb -d shell stop


adb push mycwmfix.zip /sdcard/mycwmfix.zip


adb reboot recovery
now save as "all files" and rename to ondemand.bat - dont save as text. Now put it in a folder with adb.exe and the dll´s


the CWMfix zip has also to be in


Linux Version (ondemand.sh):





here is also the code for linux :

#!/system/bin/sh
echo " "


echo "Wating for device..."


./adb wait-for-device


echo " "


./adb -d shell stop


./adb push mycwmfix.zip /sdcard/mycwmfix.zip


./adb reboot recovery
This script freezes your device in the loop and you are able to push the fixing zip to your phone. Then it will automatically reboot in recovery and you can apply the update zip.


Now if the zip is not working, you can use this script to directly push the broken files to your phone.

@echo off


cd /d %~dp0


echo.


echo Waiting for device...


adb wait-for-device


echo.


adb -d shell stop


adb -d shell su -c "mount -o remount rw /system"


adb push framework-res.apk /system/framework/framework-res.apk


adb -d shell chmod 644 /system/framework/framework-res.apk


adb push SystemUI.apk /system/app/SystemUI.apk


adb -d shell chmod 644 /system/app/SystemUI.apk


adb reboot
you see this script freezes the phone again, pushes the files directly to /system and reboots. The bootloop should be fixed.


here is the code for linux :

#!/system/bin/sh


echo " "


echo "Waiting for device..."


./adb wait-for-device


echo " "


./adb -d shell stop


./adb -d shell su -c "mount -o remount rw /system"


./adb push framework-res.apk /system/framework/framework-res.apk


./adb -d shell chmod 644 /system/framework/framework-res.apk


./adb push SystemUI.apk /system/app/SystemUI.apk


./adb -d shell chmod 644 /system/app/SystemUI.apk


./adb reboot
Please note that on some devices the command “su -c” cannot be used after using the “stop” command, it gives an error then (Segmentation Fault).


What you can do to prevent this is adding “adb remount” just under the “adb wait-for-device” line, and remove the “adb -d shell su -c “mount -o remount rw /system” line.


Save the script and run it again.


Now if none of those methods above has worked , please read the next chapter on flashing a stock rom with SP-flashtools.


Read here if you dont have CWM :


Now when you dont got CWM, and you got a bootloop, you basically got 2 options:


1) Find a CWM zip online and flash it with SP-flashtool


2) Find a stock ROM or Custom ROM for SP-flashtool and flash it with it.



3) Readback the ROM and create CWM and follow the tutorials above.



Find a CWM zip online and flash it with SP-flashtool


You can find a CWM zip on www.needrom.com or on google. Mostly some crazy nerd on XDA compiled one for your phone.


so check out all those sources :


http://www.china-devices.com/Thread-Finding-ROM%C2%B4s-for-unknown-phones


maybe also gsm-hosting.net is a good website to check out.


When you got an CWM image, just flash it as recovery only. (tick only recovery ) in Sp-flashtools by following this guide :


http://www.china-devices.com/Thread-SPFlash-Tool-Guide


Find a stock ROM or Custom ROM for SP-flashtool and flash it with it.


Here once again, this can solve your bootloop in a few minutes.


Find a stock rom for your phone and flash it with sp-flashtools.


Sources :


http://www.china-devices.com/Thread-Finding-ROM%C2%B4s-for-unknown-phones


and once again follow this guide :


http://www.china-devices.com/Thread-SPFlash-Tool-Guide


and if you get a bootloop again after flashing the stock rom, be sure to read this .


http://www.china-devices.com/Thread-IMPORTANT-READ-THIS-IF-YOU-GOT-BOOTLOOP-AFTER-FLASHING


dont flash preloader !


Readback the ROM and create CWM and follow the tutorials above.


now you can also readback the rom, if your bootloop only occured by modding the os or you didnt do anything. That means your boot.img is still functional and CWM can be created.


so check this out on how to readback and flash CWM :


http://www.china-devices.com/Thread-ROOT-CWM-Readback-your-ROM-with-SP-Flash-Tools


after you have got CWM follow the tutorials above



Now this guide should help you to fix all kind of bootloops. Read this atleast 2-3 times until you understand every single step ! If you still got problems, feel free to post a thread in software and hardware support !


Thanks to XDA- University for providing a good base knowlede : http://xda-university.com/as-a-user/how-to-recover-from-a-bootloop
 
Last edited by a moderator:
  • Like
Reactions: mrsim
30

itxtutor

Editor in Chief
Staff member
May 15, 2015
59,688
412
113
Please keep this thread clean and if you got problems post a new thread in software and hardware support. Just write here if you want to add something
 
  • Like
Reactions: mrsim
1

joswebi

New Member
Dec 24, 2014
1
0
1
36
Hello,


i do not get this: Where do we get 2 dll's and will the file to be flashed be a zip file that contains pda.exe and CWM recovery? My phone keeps rebooting and disconnecting from SP flash tool.

@echo off


cd /d %~dp0



echo.



echo Waiting for device…



adb wait-for-device



echo.



adb -d shell stop



adb push mycwmfix.zip /sdcard/mycwmfix.zip



adb reboot recovery
now save as "all files" and rename to ondemand.bat - dont save as text. Now put it in a folder with adb.exe and the dll´s


the CWMfix zip has also to be in