Remove All Ads from XDA

 View Poll Results: Did you tried and it worked?

YES! It worked without problems.
110 Vote(s)
Yes, but not easy, required further editing.
12 Vote(s)
NO, unfortunately that did not helped.
24 Vote(s)
I don't understand what it is about....
25 Vote(s)

[WORKAROUND] Bootloops due leaking handles with Xposed in Lollipop

1,517 posts
Thanks Meter: 1,161
By ondrejvaroscak, Senior Member on 22nd April 2015, 12:39 AM
Thread Closed Email Thread
Fix found and released:

Downloads & instructions:

Discussion & Q&A:

I asked moderator to close this thread as issue was fixed by releasing new version of Xposed framework. Please send your further questions and post to respective thread.

This thread is about workaround found for bootloops of Xposed in XPERIA family Lollipop. Because of development progress, I have decided to remove historical development, you can see it here:

LATEST VERSION will be always posted at the END of this post

PLEASE READ INSTRUCTIONS .... The attachment IS NOT flashable!!! For flashables see EDIT 5 and bellow...

I hope I can present some good news for users with locked bootloaders who are getting bootloops with Xposed and Lollipop.

This is still continuous WIP. Know what you do, this is a development thread.

For time being, most complete solution by my opinion was made by @mionica, see EDIT 6 and hist post and for latest development at

As you may already know, we have find out, that some undetected error is causing system to bootloop, if too many applications are installed.
Exact numbers are varying between different ROMs and devices, generally the maximum number of apps is about 320-330.
Debloating (uninstalling unnecessary apps) helps, but remains limiting and for many frustrating. After a research, we have found out,
that there is probably a bug, that is causing many files being left open when booting Lollipop with Xposed.

Users on unlocked bootloader may modify certain kernel parameters to raise number of open files. This can not be done on Locked Bootloader.
After some research and hours of experiments, I found a way, how to change the filelimit for Zygote and subsequent processes. Therefore every child of zygote (hence every app etc.) will inherit raised open files limit from 1024 to 4096.

This change should work on all 5.0 compatible system, not only XPERIAs, however I only tested it on Z3 D6603 fw 690. But the modification
is done on Linux system level, therefore it should teoretically work just everywhere... It should work also on Locked bootloaders as well.

The principle is easy, however implementation was a tricky, because of lack of native linux utils support on Android and fact that we can not
easily modify booting behaviour. But gladly enough we have XZDualRecovery (gret thanks @[NUT])....

XZDualRecovery enables to call init scripts on startup. I have created a startup script that waits for zygote process to come up, and calls
external program that changes open file limits for that process. This external program is compiled by me from source provided by

Prerequisities: Functional XZDualRecovery or other form of init.d support.


Extract downloaded ZIP file, it contains:
flimit-binary executable for changing open file limits
01_flimit - shell script called by init
flimit.c - source code of binary executable

Enable init.d support in XZDualRecovery by editing XZDR.prop and change
Dont forget to have enabled byeselinux (dr.keep.byeselinux=true)
copy flimit and 01_flimit to /data/local/tmp (or push adb)
remount /system rw (mount -o remount,rw /system)
create directory /data/flimit
copy flimit to /data/flimit and make executable (chmod 777)
create directory /system/etc/init.d with and chmod 777 /system/etc/init.d
copy 01_flimit to /system/etc/init.d and chmod 777 /system/etc/init.d/01_flimit

test run installation:
/data/flimit/flimit $(pgrep zygote)
output should be:
[email protected]:/data # /data/flimit/flimit $(pgrep zygote)                       
Previous limits: soft=1024; hard=4096
New limits: soft=4096; hard=4096
If not, check permissions etc.

Check script by running:
sh /system/etc/init.d/01_flimit
it should now give output (if you succesfully ran /data/flimit/flimit....):
[email protected]:/data # /data/flimit/flimit $(pgrep zygote)                       
Previous limits: soft=4096; hard=4096
New limits: soft=4096; hard=4096

Thats all. Now you can install and update lot more applications. Now I have about 455 packages reported by pm list packages and no bootloop.
But as soon as I disable the init.d support, it bootloops. So re-enable by edititng XZDR.prop and it again boots.

EDIT:Please let me know, if you had to modify the script or instructions to work on your device, so I can perhaps make better or more universal version. Thank you guys.

EDIT 2:While this workaround makes it possible to run Xposed on untouched vanilla Stock ROM, you may still consider debloating it, as debloating will make run your device more smoothly and saves battery. Guys who made debloating scripts made significant efforts in identifying which apps can be safely removed without harming any significant functionality.

EDIT 3:The ZIP is NOT flashable, follow instructions ^^^^ --- buddy @McBane87 is developing flashable version.

EDIT 4:Buddy @nurps found a bug causing Opera browser to quit upon starting. @mionica proposed lowering softlimits for open files to 2048 from 4096 in first version of script. Version 1.1 is released.

EDIT 5:Buddy @McBane87 created customized flashable version of this workaround, so you can flash it from recovery if you struggle with bootloops, dont like to wait fro 300apps to optimize after Dalvik wipe and mess with adb/terminal..

EDIT 6:Buddy @mionica published another flashable zip. It is complete installer for the workaround, so far most sofisticated workaround from system point of view. The uninstaller completely removes Xposed if you are too tired of it and forgot to make backup Files are bellow, for instructions etc. check it out on and for latest development at


v1: Initial release
v1.1: Changed limits to 2048 from 4096 as high limits caused Opera Webbrowsers to crash
v2.0 Reference script - for production please flash @mionica version of flashable, my script is published for educational purposes. added mionicas mod to detect only changed limits and subsequently remove only those that are child of zygote

I would like to thank mainly to @[NUT] and to guys who made significant effort with debloating, made other discoveries or were an inspiration
for me, including but not limited to @serajr @moly82 @AndroPlus (for his work on file limits in kernel) @redincali and of course to @rovo89
for his Xposed framework. My apologies if I forgot someone, PM me, its 2 o'clock in morning

or in this post

While I have developed initial version (see history), other guys (mainly @mionica and @McBane87) greatly enhanced and redeveloped whole thing.

Current development version and downloadable files you can always find in @mionica post

@mionica managed to analyze boot process on both ROMs with and without Xposed and came to conclusion that leaks are caused by Xposed process leaking open file handles, see here

There is a current version of the workaround fix (see above), that seems to be the last possible, before Xposed will be released with patch addressing that issue. Good news is that thanks to @mionica precise analysis, @rovo89 - developer of Xposed is already aware of the problem nad it´s cause.

[B] Recommended installation steps:


by @mionica
Anybody who is still having any kind of issues, for whatever reason, please do the following:

  • get into TWRP;
  • install, in this order, without rebooting:
      • If you don't have an sd card, you'll need to reboot once after the uninstall .zip, boot the system normally, then get back in the recovery and install the other 3. This only applies to people who don't use an SD card
  • copy the logs to the PC, over USB:
    • uninstall_xposed.log
    • install_busybox.log
    • install_leakplug.log
    each of the 3 zip's will tell you where it saved the log (it's usually the external sdcard)
  • reboot to system

Thanks in advance for not asking any questions about whether you have to do any of these steps; yes, you have to.

If you follow other instructions than provided by @mionica please get then support from someone else than him.

The basic idea behind is that Xposed bootloops because of it exhausted resources available due to probably internal bug. The workaround basically provides higher limits for open files during boot and restores previous limits after device has booted. The latest flashable installer is very advanced and automates the installation, including necessary checks for proper XZDR configuration, busybox etc.

When you experience bootloops after installing Xposed, or you had Xposed working and it started to bootloop after you have installed new app or upgraded a system app, simply reboot to recovery and flash the zip. No need to wipe anything.

When installing new, I recommend flashing this zip first, then install Xposed usual way (flash, wipe, reboot, install Xposed apk, install modules).

Be aware that while the workaround works for about 80% of cases, there are people who have lots of applications or heavily modified system, experiencing random reboots. Cause is under investiogation, but most probably is in Xposed itself.
The Following 164 Users Say Thank You to ondrejvaroscak For This Useful Post: [ View ] Gift ondrejvaroscak Ad-Free
22nd April 2015, 01:33 AM |#2  
ogunja's Avatar
Senior Member
Flag São Paulo
Thanks Meter: 655
Donate to Me
Excellent work friend @ondrejvaroscak. Congrats! Awesome
The Following 3 Users Say Thank You to ogunja For This Useful Post: [ View ] Gift ogunja Ad-Free
22nd April 2015, 03:24 AM |#3  
Advali's Avatar
Senior Member
Flag Makati City
Thanks Meter: 19
Was waiting a long time for this! Thanks man! working perfectly.
22nd April 2015, 04:13 AM |#4  
Thanks Meter: 3
Working perfectly on D6603, thanks
22nd April 2015, 04:33 AM |#5  
NetSkill's Avatar
Senior Member
Flag Slovakia
Thanks Meter: 233
I am gonig to try this asap! Awesome job!
One more thing, if i understand right, now we can install as many apps as we want or the limit is just higher but still there?

Can we now use regular reboot button from power menu withouth getting bootloop?

--Guys lets go ahead and rape the thanks button
The Following 2 Users Say Thank You to NetSkill For This Useful Post: [ View ] Gift NetSkill Ad-Free
22nd April 2015, 04:43 AM |#6  
norti's Avatar
Senior Member
Flag Budapest
Thanks Meter: 491
Thank you @ondrejvaroscak for this solution!

@rovo89 any chance this could be integrated in the xposed installer?
22nd April 2015, 04:47 AM |#7  
xtremepredador's Avatar
Senior Member
Flag Brasil
Thanks Meter: 322
Thanks Bro , Very Nice !!

Perfect Work !!
22nd April 2015, 05:36 AM |#8  
Senior Member
Flag Seongju
Thanks Meter: 41
Thumbs up Z1, C6903
Thank you for this great solution, works on Z1.
22nd April 2015, 05:55 AM |#9  
ondrejvaroscak's Avatar
OP Senior Member
Flag Aachen
Thanks Meter: 1,161
Originally Posted by NetSkill

I am gonig to try this asap! Awesome job!
One more thing, if i understand right, now we can install as many apps as we want or the limit is just higher but still there?

Can we now use regular reboot button from power menu withouth getting bootloop?

--Guys lets go ahead and rape the thanks button

Unless I will be blessed with some debugging skills, I have no clue... I think limit is just much higher. Once you reach limit you can simply edit script and change two numbers...

Yes, now regular reboot works.

Sent from my D6603 using XDA Free mobile app
The Following User Says Thank You to ondrejvaroscak For This Useful Post: [ View ] Gift ondrejvaroscak Ad-Free
22nd April 2015, 06:16 AM |#10  
ondrejvaroscak's Avatar
OP Senior Member
Flag Aachen
Thanks Meter: 1,161
Originally Posted by norti

Thank you @ondrejvaroscak for this solution!

@rovo89 any chance this could be integrated in the xposed installer?

I think it will take time, because first @rovo89 would probably want to investigate, how much is it a bug, a constellation of coincidences and so on. I am not sure, if the same bootloops appear only on XPERIAs or it is a phenomenon on other brands as well... And given the fact, that big number of Samsungs can not run Xposed at all, maybe he will try to solve that Samsung puzzle as priority. But that is only guess..
22nd April 2015, 07:42 AM |#11  
Senior Member
Thanks Meter: 63
Working on fully setup 5.02 on Z2 thanks.
Thread Closed Subscribe to Thread

bootloop, solution, workaround, xperia, xposed
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes