Ramdisk Compression Exchanger - systemless SuperSU/root on non-gzipped ramdisks - SuperSU

Some of you might face the next error during systemless SuperSU install:
...
- Decompressing ramdisk
failed
--- Failure, aborting
*************************
IMPORTANT NOTICES
*************************
First reboot may take a
few minutes. It can also
...
This means that the ramdisk of your boot image was compressed in a non gzip format.
Unfortunately SuperSU can only decompress and tweak gzip compressed ramdisks up to now.
However i tried to make a little script that will uncompress your boot image/ramdisk and recompress it to gzip then after flashing SuperSU it recompresses the ramdisk to the original format.
This way one can achieve systemless root temporarily on such devices by installing SuperSU.
Idk maybe it can also be used for Magisk???
Download v1.1 (rce_univ.zip):
http://viid.me/qoESak
in case you face any proglems with the above version, try the old one v1.0 (rce_univ_1.0):
http://viid.me/qir1u5
How to:
Boot into TWRP 3.0.0 or above (never tested below) and install rce_univ.zip before and after SuperSU.zip!
Video: http://viid.me/quIbOi
Consider flashing Chainfire's Boot image signer (in case you get soft bricked after the above steps):
https://forum.xda-developers.com/an...signing-boot-images-android-verified-t3600606
Detailed description in comment nr.3 (https://forum.xda-developers.com/showpost.php?p=70428981&postcount=3)
Supported ramdisk compressions:
bzip2, lz4, lzo, lzma, xz
Requirements:
Unlocked bootloader on most newer (marshmallow and lollipop) devices
Don't expect it to be working on every device!
The script is basically fool proof. I mean if anything goes wrong it will promt you and quit.
Then you can simply restore your boot partition (if you didn't forget to back it up) and boot up normally and deal with the non rooted idea...
Also it's not supposed to mess up anything that would cost you a hard brick. Soft brick is only possible if you forget to make backup of your boot image or if you get SuperSU intalled and rec_univ.zip cannot recompress your ramdisk (this is pretty much impossible anyways)
Naturally there are those Samsung and Sony devices with some tricky boot images... idk. Never tested but most likely not gonna work.
Probably there will be many devices on which there are not enough space to decompress and recompress ramdisks/boot images in TWRP.
In comment nr. 2 i will collect the devices that are compatible with this script and the method itself.
If you can't find your device there as i said it's fool proof but you better be careful! You can simply test it by backing up your boot images between each install and with the mount mtp function you put it on PC (you can't quit TWRP during the whole process - i mean during step 2) and with carliv image kitchen (https://forum.xda-developers.com/android/development/tool-cika-carliv-image-kitchen-android-t3013658) you check if you can unpack them normally.
Or if you don't care so much you just try and the worst case you reflash your framework...
If you are about to post any errors or complains do it the right way:
- attach recovery.log
- describe your device (model name, firmware version, ...)
- attach your boot image you backed up (upload it somewhere and link it)
If you are about to post a succesful attempt of a not yet added device:
- describe your device (model name, firmware version, ...)
- maybe link to its thread
No promises... and no responsibility i take... !!!
Please don't upload it anywhere else just use link to this thread!
I have to say thanks jcadduono for LazyFlasher boot image patcher script i used for the ramdisk compression exchanger and also thanks goes to Chainfire for SuperSU (especially for the boot image finder srcipt which is took from the SuperSU installer).
The xz archiver was used from XZ Utility For Android by Tukaani http://tukaani.org/xz/ - i hope he doesn't mind. Let me know if he does!

Supported devices until now:
Lg K8 - https://forum.xda-developers.com/lg-k10/how-to/friendly-root-method-lg-k8-k10-t3531223
Lg K10 - https://forum.xda-developers.com/lg-k10/how-to/friendly-root-method-lg-k8-k10-t3531223
Note 4 n910v (7.1.1 rom) https://forum.xda-developers.com/showpost.php?p=72491391&postcount=18

Detailed description
Systemless root with SuperSU on devices with non gzip compressed ramdisk bootimage
0. Download rce_univ.zip from here: http://viid.me/qir1u5 and download SuperSU (latest or there are some cases that requires earlier versions): https://forum.xda-developers.com/apps/supersu/stable-2016-09-01supersu-v2-78-release-t3452703 and put them on your sd card (external sd card is usually necessary since sometimes TWRP cannot decrypt your data partition/internal sd).
1. Unlock your bootloader
1.1. Additional step for those who has no "...device corrupt..." message during every boot up after unlocking bootloader on Marshmallow and some Lollipop devices(*)
- Boot into TWRP
- on the keep system read only? screen of the TWRP let it allow modifications (swipe!)
- reboot to System
- from now on you should have the message at every boot up
2. Boot into TWRP
- cancel decrypt data
- keep system read only
- go to Backup -> Backup your boot image! Maybe it comes handy later.
- go back from backup to install and install rce_univ.zip right after install SuperSUxxx.zip and then rce_univ.zip again.
- do not wipe anything during and after this step, just reboot! (this might take a while and a few bootloops...)
Video guide: http://viid.me/quIbOi
(3.) Verified boot?
In case of soft brick (or if you're sure you need the proper signature in the end of your boot partition - cos your device has verified boot) try flashing Chainfire's Boot image signer as a very last step before rebooting from TWRP:
https://forum.xda-developers.com/an...signing-boot-images-android-verified-t3600606
(*) on some devices if there is no "device corrupt" message at every boot up after bootloader unlock then anything you do or change in your boot image or system partition your device will not boot up anymore but turning off right after showing you that device corrupt message.
but if you do that trick as written in step 1.1 and that message appears at every boot up then most likely you're goot to go...
You can find some video guides on my thread for the above steps: https://forum.xda-developers.com/lg-k10/how-to/friendly-root-method-lg-k8-k10-t3531223
Pricniple of the installer - rce_univ.zip
What the script does:
Install rce_univ.zip before SuperSU:
1. Finds the boot partition (same way as SuperSU)
2. Dumps the boot image and unpacks it
3. Determines the format the ramdisk was compressed in
4. Uncomresses it then recompresses to gzip (so SuperSU can handle it).
5. Repacks the boot image and flashes it back on boot partition
Here is where you install SuperSU
Install rce_univ.zip after SuperSU:
1. Finds the boot partition
2. Dumps the boot image and unpacks it
3. Reads back the original format of the ramdisk compression
4. Uncomresses it then recompresses the ramdisk with the original compression method(so now the device can handle it).
5. Repacks the boot image and flashes it back on boot partition
As about me:
I was not a complete noob when i started it however it took a lot of effort and time. If you care to understand a bit more what it's about and you want to follow my struggling this is where it started (you can click through the threads):
https://forum.xda-developers.com/apps/supersu/supersu-v2-66-installed-lz4-compressed-t3296508

didn't work at samsung galaxy S2, it only have 8Mb space at boot partition. any solution ?
edit i use LineageOS 14.1 (cm 14.1) android 7.1.1

haris1976 said:
didn't work at samsung galaxy S2, it only have 8Mb space at boot partition. any solution ?
edit i use LineageOS 14.1 (cm 14.1) android 7.1.1
Click to expand...
Click to collapse
Can attach recovery log? And maybe boot image that you backed up in TWRP

this recovery log

haris1976 said:
this recovery log
Click to expand...
Click to collapse
I can not fully open it (no editor can fully load it). Could you zip it and attach compressed or just attach again?

gottlasz said:
Can attach recovery log? And maybe boot image that you backed up in TWRP
Click to expand...
Click to collapse
back up boot from twrp
---------- Post added at 03:23 PM ---------- Previous post was at 03:05 PM ----------
gottlasz said:
I can not fully open it (no editor can fully load it). Could you zip it and attach compressed or just attach again?
Click to expand...
Click to collapse
maybe tommorow i have bad connection when upload recovery & boot with the zip

haris1976 said:
back up boot from twrp
---------- Post added at 03:23 PM ---------- Previous post was at 03:05 PM ----------
maybe tommorow i have bad connection when upload recovery & boot with the zip
Click to expand...
Click to collapse
Okay, you can send it in PM if you want...

gottlasz said:
Okay, you can send it in PM if you want...
Click to expand...
Click to collapse
recovery & boot

haris1976 said:
this recovery log
Click to expand...
Click to collapse
Now i could open the recovery log.
Unfortunately this part means that even if it's a 3.0.2 TWRP something is missing:
"- Found boot partition at: /dev/block/mmcblk0p5- Dumping & unpacking original boot image...WARNING: linker: /tmp/boot_repack/tools/armv7/unpackbootimg: unused DT entry: type 0x6ffffef5 arg 0x560"
Maybe you should try with a newer version of TWRP if there is one.
Or if you follow my older guide which was a manual unpacking and repaking with carliv image kitchen, that could work.
Check my old guide: https://forum.xda-developers.com/lg-k10/how-to/twrp-root-lg-k8-k350n-t3475807
Anyways give me until tomorrow, ill take a look at the script maybe i can avoid this error.

gottlasz said:
Now i could open the recovery log.
Unfortunately this part means that even if it's a 3.0.2 TWRP something is missing:
"- Found boot partition at: /dev/block/mmcblk0p5- Dumping & unpacking original boot image...WARNING: linker: /tmp/boot_repack/tools/armv7/unpackbootimg: unused DT entry: type 0x6ffffef5 arg 0x560"
Maybe you should try with a newer version of TWRP if there is one.
Or if you follow my older guide which was a manual unpacking and repaking with carliv image kitchen, that could work.
Check my old guide: https://forum.xda-developers.com/lg-k10/how-to/twrp-root-lg-k8-k350n-t3475807
Anyways give me until tomorrow, ill take a look at the script maybe i can avoid this error.
Click to expand...
Click to collapse
Same error for me on LG K8 4G Vodafone Spain (LGK350n, build MRA58K, MT6735, Android 6.0), i fix it change booting the TWRP image to k350n10f (k8_10f_twrp.img, https://forum.xda-developers.com/lg-k10/development/recovery-twrp-3-0-2-lg-k8-k350-mtk-t3517894). It avoid for me" Error: Unpacking boot image failed!- Aborting..."
Works like a charm!!! thanks to gottlasz and XDA group!
sorry for my english

You should recompile all the used binaries as static, that should avoid a lot of issues.
Also, don't bother with older Samsung (everything before S3) and older Sony devices (not really sure until when). These use non-standard boot images that are very tricky to patch without outright recompiling. It can be done - I have done it in the past - but it is a major hassle and very errorprone.

Chainfire said:
You should recompile all the used binaries as static, that should avoid a lot of issues.
Also, don't bother with older Samsung (everything before S3) and older Sony devices (not really sure until when). These use non-standard boot images that are very tricky to patch without outright recompiling. It can be done - I have done it in the past - but it is a major hassle and very errorprone.
Click to expand...
Click to collapse
Thank you Master!
I know about the compiling situation, however the problem is that i did not compile anything since the whole stuff is based on jcadduono's LazyFlasher. He compiled the binaries I only tweaked the script and added some stuff... i don't have the resources to compile. Now i'm collecting static binaries to exchange them in the installer in order to solve these compatibility issues.
Basically i just wanted to help some of those unfortunate as me who has lz4 or other compressed ramdisks and unable to intall SuperSU. Well..., at least a handful of them.

New version is up. A few TWRP related compatibility issues are solved.

gottlasz said:
New version is up. A few TWRP related compatibility issues are solved.
Click to expand...
Click to collapse
i test the new version but no luck
this is the recovery log

haris1976 said:
i test the new version but no luck
this is the recovery log
Click to expand...
Click to collapse
How far does supersu intaller goes?
I mean can it unpack your boot image?
Install only supersu and make a recovery log please.
I tried to unpack your boot image with carliv image kitchen and no luck...
I think supersu can't even unpack your boot image and then there is no chance to install it. Even if we could change the ramdisk compression...
Are you sure supersu intaller gives you the same error message as it is stated in the OP?
I believe you have a non standard boot image as chainfire talked about.

It works great on 7.1.1 roms on Note 4 n910v. Thanks!

Related

[RECOVERY][TWRP&CWM][Updated: 6-Feb-2013]Stock Kernel on Official Jellybean

Note: This has been deprecated in favour of LK for Xperia T
This kernel image is based on stock using the FreeXperia ramdisk method of loading stock and recovery. It also includes the new FOTA partition trick by Dees_Troy for easy updates in the future to TWRP.
Dees_Troy and I worked on figuring out the reason recovery binaries would not load on the stock kernel without patches, fixed this up in bionic, and rebuilt recovery linked against the fixed bionic.
F.A.Q
Q. The title says TWRP and CWM but when I boot recovery I only see TWRP. How do I get CWM?
A. TWRP is the default recovery, if you want CWM you should download the CWM update.zip in the second post and flash it with twrp.
Technical Info​
In 3.4 Qualcomm have changed the fb_var_screeninfo struct slightly. They have added an extra field called colorspace which increases the size of the stuct by __u32. When a binary linked against bionic tries to pass a struct the size of the old fb_var_screeninfo to kernelspace the application breaks as the kernel is expecting more data than it was given.
The patch to fix this in kernel solves the problem by removing one of the reserved fields, bringing the struct back to the same size it was prior to the new field being added. While this keeps compatibility with older recovery binaries, it does introduce the problem of needing a custom kernel to run recovery. Sony have not yet released source for 9.1.A.0.489 which means the kernel cannot be rebuilt without issues such as WiFi not working. The patch that Dees_Troy applied to the build system was to add the new colorspace field into the header for bionic which means the new recovery binary can run on an unmodified stock Sony kernel.
Flashing​
Boot device in fastboot mode:
Code:
adb reboot bootloader
Flash image with fastboot:
Code:
fastboot flash boot mint489stock.img
Source for TWRP available from here.​
Updates:
1. Updated image in first post to fix bug where creating a backup would fail and crash twrp.
2. Updated first post to show CWM in title and answer questions about how to get CWM.
Flashable zips:
In the first post it is mentioned about using the FOTAKernel trick by Dees_Troy to offer easy updates. The 2 zips attached to this post are examples of the ease of use.
flashCWM.zip - This will flash CWM to the FOTAKernel and replace TWRP as your recovery.
flashTWRP.zip - This will flash TWRP to the FOTAKernel and replace TWRP that is built into the image that was flashed to your device by fastboot, or to replace CWM with TWRP again if you used the flashCWM.zip
This also makes updates easier as you do not need to replace the kernel image you currently have flashed to your device.
Re: [RECOVERY][TWRP]Stock Kernel on Official Jellybean
Many thanks, can you just clear up one thing please, does Wi-Fi work on this image?
Sent from my LT30p xda premium app.
How do I customise the signature on xda premium app?
gregbradley said:
Many thanks, can you just clear up one thing please, does Wi-Fi work on this image?
Sent from my LT30p xda premium app.
How do I customise the signature on xda premium app?
Click to expand...
Click to collapse
Yes, wifi does work because it is just the stock kernel with TWRP added. I am running it right now with no problems.
I thought so, but I just wanted to make it obvious to all users as it was not 100% clear from the OP. I didnt have time to flash myself and check as I was just abbout to leave for work, now I am at work I will also flash it....
lilstevie said:
This kernel image is based on stock using the FreeXperia ramdisk method of loading stock and recovery. It also includes the new FOTA partition trick by Dees_Troy for easy updates in the future to TWRP.
Dees_Troy and I worked on figuring out the reason recovery binaries would not load on the stock kernel without patches, fixed this up in bionic, and rebuilt recovery linked against the fixed bionic.
Technical Info​
In 3.4 Qualcomm have changed the fb_var_screeninfo struct slightly. They have added an extra field called colorspace which increases the size of the stuct by __u32. When a binary linked against bionic tries to pass a struct the size of the old fb_var_screeninfo to kernelspace the application breaks as the kernel is expecting more data than it was given.
The patch to fix this in kernel solves the problem by removing one of the reserved fields, bringing the struct back to the same size it was prior to the new field being added. While this keeps compatibility with older recovery binaries, it does introduce the problem of needing a custom kernel to run recovery. Sony have not yet released source for 9.1.A.0.489 which means the kernel cannot be rebuilt without issues such as WiFi not working. The patch that Dees_Troy applied to the build system was to add the new colorspace field into the header for bionic which means the new recovery binary can run on an unmodified stock Sony kernel.
Flashing​
Boot device in fastboot mode:
Code:
adb reboot bootloader
Flash image with fastboot:
Code:
fastboot flash boot mint489stock.img
Source for TWRP available from here.​
Click to expand...
Click to collapse
Such a good news!I will port it to TX JellyBean firmware if you don' mind
gregbradley said:
I thought so, but I just wanted to make it obvious to all users as it was not 100% clear from the OP. I didnt have time to flash myself and check as I was just abbout to leave for work, now I am at work I will also flash it....
Click to expand...
Click to collapse
only for unlocked bl, correct?
hi,
i wanted to create with this version a backup, but it doesn't work.
it was just created the folder system,
the other folders such as data and boot not.
the created folder system, that was created after backup, is empty.
the 'backup' also takes only a few seconds, then the 'backup' is done.
what have i done?
installed the .img with instructions above.
boot xt into recovery, push backup, select system, data & boot, choose destination folder and start backup.
where is my failure?
hkjr said:
only for unlocked bl, correct?
Click to expand...
Click to collapse
Yes
MysticEnforcer said:
hi,
i wanted to create with this version a backup, but it doesn't work.
it was just created the folder system,
the other folders such as data and boot not.
the created folder system, that was created after backup, is empty.
the 'backup' also takes only a few seconds, then the 'backup' is done.
what have i done?
installed the .img with instructions above.
boot xt into recovery, push backup, select system, data & boot, choose destination folder and start backup.
where is my failure?
Click to expand...
Click to collapse
Same here....seems backup is not working
MysticEnforcer said:
the 'backup' also takes only a few seconds, then the 'backup' is done.
Click to expand...
Click to collapse
Updated first post with a fixed image.
Thank you very much, this is the best message of day.
Just flashed new image
Doing a backup and it seems to work...will update in few minutes when it is finished
EDIT:
It works
Backup complete in 385 seconds
FYI,
both times on rebooting system from recovery I initially got the grey triangle, both times it was only for 10-15 seconds before the phone rebooted...
Testing it now ....
Edit:
[Backup completed in 461 seconds] External SD card with compression on. No Grey triangle for me.
[Restore completed in 192 seconds] Restored backup without any problems. No grey triangle on second reboot either.
Seems to work great for me.
(only clock seems to be incorrect. 7 hours and 16 minutes behind)
Edit 2: thirth boot up seems to get stuck on grey triangle for about 15 seconds
Edit 3: Seems only the first time reboot after using the recovery the grey triangle is there. Rebooted the phone 4 times and only got the triangle 1 time.
Updated first and second post
USB storage does not work at all both on TWRP and CWM
tested 2nd version, works fine for me & no grey triangle :good:
romcio47 said:
USB storage does not work at all both on TWRP and CWM
Click to expand...
Click to collapse
Noticed that to
romcio47 said:
USB storage does not work at all both on TWRP and CWM
Click to expand...
Click to collapse
This appears to be more of a technical limitation.
The internal storage space is formatted ext4, so only linux would be able to mount that by default so it doesn't offer that.
With the MicroSD the issue seems to be a little more complex and may possibly need a custom kernel.
lilstevie said:
This appears to be more of a technical limitation.
The internal storage space is formatted ext4, so only linux would be able to mount that by default so it doesn't offer that.
With the MicroSD the issue seems to be a little more complex and may possibly need a custom kernel.
Click to expand...
Click to collapse
Thanks for the reply I guess we just have to wait for the kernel sources to be published
Besides another issue - in CWM wiping dalvik-cache does not work.
romcio47 said:
Besides another issue - in CWM wiping dalvik-cache does not work.
Click to expand...
Click to collapse
I can't reproduce this, if I wipe dalvik-cache in CWM it removes /data/dalvik-cache as it should.

[ROOT][Kernel][TWRP] repack of the stock kernel with dm-verity and SONY RIC off

Changelog:
V5.23 Fix for Android 6 (Freeze on boot logo)
Installation of kcal kernel module for supported kernels. Get the app from https://forum.xda-developers.com/android/software-hacking/dev-kcal-advanced-color-control-t3032080
V5.22 Bug in the vendor overlay creation. Existing directories (like /vendor/bin) have not been replicated correctly
V5.21 Fix issue when running on Linux (some CR/LF)
Patch libsepol in bootimg for backwards compatibility with Android 6
V5.20 Support for superuser as an alternative to SuperSU (https://github.com/phhusson/Superuser)
Fix for the missing internal storage link in TWRP
V5.11 Support for Android 7.0
Fix in the overlay layout which could prevent some libraries from loading and cause battery drain
V5.1 Support for Android 7.0
Updated bootimg to deal with Android 7.0 policies
New tool inside bootimg for adding new contexts to binary file contexts
New system overlay layout due to a more restrictive linker in Android 7
V5.0 New system overlay method using the /vendor directory. As this directory is also in the library search path even libraries can be easily replaced without modifying the system partition
System-less SuperSU integration improved (Version 2.76 or higher recommended)
System-less xposed integration (using the standard distribution)
Support for 32.A.0.253
V4.51 Fix for awk script for Linux kernel version detection when running on Linux
V4.5 Fixed adb and mtp file access in TWRP for 32.2.A.0.224
V4.42 Added support for Z2 (Sirius) and TWRP fstab fix for leo and aries (thanks to waleedsq81)
V4.41 Fixed issue with Y/N choice on non-english Windows. Added support for Z3 (leo)
V4.4 Support for Z3+/Z4, Tablet Z2, Tablet Z3 and Tablet Z4 added (Z4 still has an issue with TWRP, but DRM fix works)
SuperSU integration reworked in order to need less SELinux exceptions and to be more secure
All tasks can now be individually selected. Therefore there is no separate DRM only script required
V4.31 Renabled Z5P (satsuki) and Z5C (suzuran) for TWRP and drmfix
V4.3 Support for older Lollipop added
Script execution for Linux fixed
V4.24 Fix for for a bug in SuperSU integration in V4.23
V4.23 Fix for repacking 3rd party kernel (Some permissions were on custom directories were lost)
V4.22 Bugfix for readta (flash_dk reported unit not)
V4.21 Fix for the Linux binary of bootimg
V4.2 Updated TWRP to 3.0.2
V4.1
Fix for WideWine (if you have your device key) Thanks a lot to goofnorf101 for testing
unpackinitfs and makeinitfs in my bootimg tool now maintain date/time of files correctly
Automatic SuperSU installation
V4.0
Fix for older kernels (Lollipop)
Binary for Linux (The older version had the ARM version packaged)
Device is not stored in the kernel image anymore
TWRP updated to version 3.0.1
FAQ - Please read
Is is possible to have root with locked bootloader?
Short answer: no
Long answer: The locked bootloader only boots unmodified kernel packages signed by Sony. The stock kernel only mounts unmodified /system partitions (dm-veritiy) -> No modification without unlocking
So any change to the kernel (like this script) or system partition requires unlocked bootloader
What is dm-verity?
A hash checksum on all blocks of a filesystem in order to verify the integrity
What is Sony RIC?
A protection to avoid mounting the root filesystem or system read/write
What happens if I unlock my bootloader
The device key (TA unit 0x1046b) will be wiped, which deactives everything DRM related. In addition a full wipe of your phone will be perfomed.
So extract your TA partition before with this great tool http://forum.xda-developers.com/crossdevice-dev/sony/iovyroot-temp-root-tool-t3349597 from zxz0O0
If you already unlocked the bootloader before, then at least the credentials will be restored, which will reactivate stuff like x-reality and camera de-noise
Why do I need to flash my device key?
Without your device only some functions can be reactivated, like x-reality. Other functions like widevine do not work with out your device key.
How do I enter TWRP recovery?
Restart your phone and press the volume key up as soon as the LED switches to yellow
I want to use a custom kernel with the DRM fix
Just say "N" to all other options. Nevertheless be prepared for problems if the custom kernel does not match your Android version.
What should I do if there is an update to this script?
First check if you really need to run this update by checking the changelog. E.g. if it says binary for Linux fixed and you are using Windows then probably you don't care. If you did not change your Android version then all you have to do is to update the kernel package with fastboot flash boot. If you do not use the automatic SuperSU integration then you have to reinstall SuperSU in TWRP.
This tool repacks an existing kernel package (usually the stock kernel) in order to make it rootable and adds TWRP recovery as well. Version 4 has been succesfully tested with LP and MM.
In particular it adresses the following issues:
DM-Verity: Android is now using dm-verity to verfy the integrity of the system partition. Until you switch it off your phone won't boot after modifying /system
SONY RIC: RIC is blocking the write access to the system partition
DRM Keys: After unlocking the bootloader your device key is wiped, which deactivates some functionaliy. E.g. x-reality, denoise in camera aso.
Recompiling the kernel is not required as only the init ramdisk needs to be modified. You can run these scripts either in Windows or Linux.
Thanks to the excellent work of zxz0O0 you can now backup the TA partition before unlocking the bootloader with this tool http://forum.xda-developers.com/crossdevice-dev/sony/iovyroot-temp-root-tool-t3349597
If you managed to backup your TA partition before you unlocked the bootloader then this version will fully reactivate your keys as well. (many thanks to addicted1900 for helping me with the testing)
As there has been some confusion I would like to point out one more time that you cannot run any kernel package which is not signed by Sony without unlocking the bootloader. So this works only with unlocked bootloader.
As it seems that it is not clear to everyone I also want to mention that <...> is a placeholder. E.g. <extracted kernel> means that you should replace it with then name of your extracted kernel, which could be kernel.elf
There was a report that having SuperSU in the system partition installed may lead to a bootloop. Therfore you shoud first install the bootimage created by this script and then install SuperSU afterwards, as it will then use the system-less strategy.
In order to use these scripts you need the kernel boot image of your current version. There two different ways to obtain it:
Method1:
If you have a .ftf image then open it with zip application (7Zip, WinZip, Windows Compressed Folder) and extract kernel.sin. Afterwards use Flashtool -> Tools -> SIN Editor to extract the kernel. You should end up with the boot image with extension .elf.
Method2:
Run your favourite recovery and connect via
Code:
adb -d shell
Now run
Code:
find /dev -name boot
dd if=<output of the find command before> of=/sdcard/kernel.img
Once you have the kernel image you are ready to use the script.
The newest version support superuser as an alternative to SuperSU. This is available open source and can be verified. In order to integrated you need the current superuser.zip from http://superuser.phh.me/superuser.zip and to be install the app afterwards from Google Play (look for superuser phh) or build it yourself from github.
To integrate the kernel part just place superuser.zip in the rootkernel directory.
You can also still use SuperSU, although it is causing a huge battery draining on my Z5 with Android 7.0 If you place SuperSU in the same directory (SuperSU*.zip, case sensitive) then it will be also installed automatically . It did all the tests with 2.76, but newer versions should work as well. Please be aware that you can not update SuperSU within the application. For a newer SuperSU version you need to rerun the script.
If you want to integrate xposed as well just place the distribution for you device and Android version in the same directory. (e.g. xposed-v86-sdk23-arm64.zip). Only support with Android 6.0 (sdk 23) and higher.
xPosed for Android 7.0+ is still not available.
Code:
rootkernel <extracted kernel> boot.img
You are prompted for several choices:
Sony RIC is enabled. Disable?
I prefer not to disable it in order to keep my phone more secure. Unfortunately there are a lot of bad guys in this world and SELinux and RIC still can save us if someone discovers a new kernel exploit.
Sony RIC basically prevents mounting the /system partition for write. You can still modify it in recovery of of course, but if you require write access to /system without entering recovery then you need to disable it.
Install TWRP recovery? Here you should say yes unless you are trying to patch a non-stock kernel, which comes already with a recovery
Install busybox? For security reasons I prefer not to install. In recovery you have it anyway. This choice is only available if you chose install TWRP
Found SuperSU-v....zip. Install? Integrates SuperSU. For this option to show up you have to place the SuperSU package into the same directory with the name SuperSU*.zip (case sensitive)
Found superuser.zip. Install? Integrates superuser. For this option to show up you have to place superuser.zip into the same directory (case sensitive)
# Make su permissive (Permits any action as su)? This only appears if you install superuser. Permissive means you can anything as root, without it is restricted mainly to file operations (sufficient for e.g. Titanium Backup)
Found xposed-v....zip. Install? Integrates xposed system-less. For this option to show up you have to place the xposed for your device and Android version into the same directory. (e.g. xposed-v86-sdk23-arm64.zip)
Install DRM fix? Installs the DRM fix. First it tries to use the device key which you flashed with flash_dk. If it does not exist it uses an alternative method which cannot fix everything (e.g. Widevine will not work, but X-reality, Camera denoise etc. will work)
Now put your phone into fastboot mode (Volume Up + connect USB) and then run:
To test it without actually flashing it:
Code:
fastboot boot boot.img
For flashing it:
Code:
fastboot flash boot boot.img
If you managed to backup for TA partition before then you can reactivate your original device key as follows:
Code:
flash_dk <ta backup image> DK.ftf
Flashing this file with flashtool will write your device key to an alternative unit, from where the drmfix library will pick it up.
This is a one-time task. It will survive a complete reset of the phone or Android system upgrade. The device key has a length of just 16 bytes, so it is correct that the resulting DK.ftf has a size of only aprox. 500 bytes.
If you like my work you can buy me a coffee
Some background information:
There are two main tools involved (for both Android and Windows)
- busybox
Probably everyone knows it
- bootimg
A multicall binary with several tools for unpacking and packing the boot image as well as adapting the SELinux policy. Part of the code is written by me from scratch, some other parts are cherry picked from other projects. I will also provide the source for it. As Windows doesn't have softlinks I modified the tools for unpacking and packing the init ramdisk to write text files with __lnk__ at the end instead.
Would be great if someone shared E6653 stock .200 kernel boot.img or flashable zip so we can try this out
Funkmasterchilla said:
Would be great if someone shared E6653 stock .200 kernel boot.img or flashable zip so we can try this out
Click to expand...
Click to collapse
Do you want the kernel.sin of stock . 200?
lordriguez said:
Do you want the kernel.sin of stock . 200?
Click to expand...
Click to collapse
I am downloading the whole firmware again from xperifirm. Thank you mate !
Edit: Working great! I'll stick to stock kernel now since Androplus' consumes more battery while asleep !
Edit2: I successfully flashed recoveries in command window from my PC but can't access TWRP at boot though, no LED flashing.
Edit3: Ok that's cuz there's no recovery boot script obviously, my bad. That's above my pay grade, if somebody is kind enough to create a stock. 200 with recoveries it'd be much appreciated PM me if so
Edit!: I flashed monx new stock based kernel
Thank you Tobias !
tobias.waldvogel said:
Hi everyone,
as most of you know, even after unlocking the bootloader there are a few more requirements before you can modify the system partition, i.e. install SuperSU, xposed etc.
- Android is now using dm-verity to verfy the integrity of the system partition. Until you switch it off your phone won't boot after modifying /system
- SONY RIC is blocking the write access to the system partition
The good news is, that it is not required to recompile the kernel. It is sufficent to modify the init scripts inside the init ram disk. So you can just stick to the stock kernel.
I created a package which precisely does this job for you. Just run it from TRWP after installing a new Android version
With this you don't have to wait anymore until someone creates the right kernel package for your phone
PS: It leaves a copy of the new boot image in the internal sdcard if you want to save it somewhere. (boot.img) It can be flashed with fastboot if required.
Click to expand...
Click to collapse
Hmm... I don't understand what this zip file do with phone.... Can you explain more primitive for me?!
Is that for recover stock kernel with stock drm keys?! I understand correct?!
zavpasha said:
Hmm... I don't understand what this zip file do with phone.... Can you explain more primitive for me?!
Is that for recover stock kernel with stock drm keys?! I understand correct?!
Click to expand...
Click to collapse
Before you can start to install thing like SuperSU and xposed you have to change the kernel, otherwise your phone won't boot anymore. In the past you had to wait for someone to come up with a compatible kernel for your phone, now this package just converts your existing kernel.
Regarding the DRM please install the package from the DRM restore thread.
Funkmasterchilla said:
I am downloading the whole firmware again from xperifirm. Thank you mate !
Edit: Working great! I'll stick to stock kernel now since Androplus' consumes more battery while asleep !
Edit2: I successfully flashed recoveries in command window from my PC but can't access TWRP at boot though, no LED flashing.
Edit3: Ok that's cuz there's no recovery boot script obviously, my bad. That's above my pay grade, if somebody is kind enough to create a stock. 200 with recoveries it'd be much appreciated PM me if so
Edit!: I flashed monx new stock based kernel
Thank you Tobias !
Click to expand...
Click to collapse
Thanks for the feedback. Future versions of this package will add TRWP as well. I am currently working on it.
tobias.waldvogel said:
Thanks for the feedback. Future versions of this package will add TRWP as well. I am currently working on it.
Click to expand...
Click to collapse
As promised the new package with TWRP is out
tobias.waldvogel said:
As promised the new package with TWRP is out
Click to expand...
Click to collapse
Great work thanks ,
How would I go about disabling the vibration for recovery?
Sent from my E6653 using Tapatalk
Well, the script which checks if recovery should be started is bin/init inside the zip. If you don't like the vibrate then just remove the line and run the package again
Gesendet von meinem E6683 mit Tapatalk
huh, so it is possible to have 2 recoveries at the same time? (and why would anyone want 2 recoveries? )
Three Recoveries are als possible
CWM, Phils Touch & TWRP
Sent from my E6653 @ XDA Portal
Sorry for being noob.
I miss my Oneplus one where things were so easy.
After unlocking BL what do i do with this zip.
Is it going to Root my phone and Install TWRP?
Thanks for help.
I flash the v2 and i got bootloop. 4 time red LED and the phone reboot and all over again. What's the problem?
Hi Tobias,
can you please build a v2 for the z5 compact too?
thx
stiffmeister
FakeSmile said:
I flash the v2 and i got bootloop. 4 time red LED and the phone reboot and all over again. What's the problem?
Click to expand...
Click to collapse
On which model did you use it and with which firmware version?
If you used flashtool before then you can just flash the kernel one more time (i.e. deselect everything else).
stiffmeister75 said:
Hi Tobias,
can you please build a v2 for the z5 compact too?
thx
stiffmeister
Click to expand...
Click to collapse
This should work on Z5 compact with stock kernel as well, without any change.
In case of any issues you can flash the kernel again via flashtool
If it did not work you can pass me the generated boot.img from your interal sdcard for further analysis
hi tobias,
i didn't try the v2, because i thought, that the twrp recovery wouldn't be compatible.
but when you say it's ok, than i'll try it
br
stiffmeister
stiffmeister75 said:
hi tobias,
i didn't try the v2, because i thought, that the twrp recovery wouldn't be compatible.
but when you say it's ok, than i'll try it
br
stiffmeister
Click to expand...
Click to collapse
I flashed zombie kernel without making backup of stock kernel, can you share it with me so I can try this method (I doubt it will work on zombie)
ps : I have .200 fw
tobias.waldvogel said:
On which model did you use it and with which firmware version?
If you used flashtool before then you can just flash the kernel one more time (i.e. deselect everything else).
Click to expand...
Click to collapse
E6653 on .200 firmware

Install systemless SuperSU / patch lz4 compressed boot images

It seems to be quite problematic to implant compression formats into SuperSU systemless install other than gzip.
Here is a method i used for lz4 compression on my lg k8 (mt6753) http://www.chinaphonearena.com/forum/Thread-root-lg-k8 and https://forum.xda-developers.com/lg-k10/how-to/twrp-root-lg-k8-k350n-t3475807.
I guess it must work on other devices and also with other compression methods.
1. Unlock your bootloader
2. Boot to TWRP
3. Backup your boot image
4. Tweak your boot image with Carliv Image Kitchen (http://forum.xda-developers.com/and...-cika-carliv-image-kitchen-android-t3013658):
-Unpack it, open "boot.img-ramdisk-compress" file with a text editor (notepad++) and change the first (and only) line from "lz4" (or whatever you have here) to "gz"
-Repack image
5. Flash the tweaked boot image in TWRP - from now on you must not leave TWRP but use a microsd card to put files from phone to PC and back. You have to stay in TWRP until last step otherwise you might get bricked...!
6. Install SuperSU - do not restart or boot up your phone!
7. Backup boot image again
8. Tweak boot image in Carliv
-Unpack it, open "boot.img-ramdisk-compress" file and change the first line from "gz" to "lz4" (or whatever you had there)
-Repack image
9. Flash boot image in TWRP
10. Restart (this will take a bit longer and also expect bootloop a few times)
Before you proceed you have to check if your boot partition has enough space to accept a bit bigger boot image than the stock one.
In my case the boot partition is 16Mb and my boot image is only 12Mb so after the patching it's still safe to flash it. (After you backed up the boot image try unpack and repack first to see its reel size - sometimes backup takes the whole partition not only the boot.img)
Lz4 is about 1Mb bigger (in my case) than gzip, however other compression methods might differ...
No promises... and no responsibility i take...
Working devices so far:
LG K8 k350n
LG K10 k430Y
The whole story got developed a bit farther by now:
https://forum.xda-developers.com/apps/supersu/ramdisk-compression-exchanger-t3533327
Why can you upload the two boot.imgs
rickwyatt said:
Why can you upload the two boot.imgs
Click to expand...
Click to collapse
What do you mean?
How do you install twrp on the lg k8?
ahmdaini said:
How do you install twrp on the lg k8?
Click to expand...
Click to collapse
You cant install it but you can boot into it. Read the related threads in the k8 and the k10 sections regarding the 2016 models. However there is no twrp for the 2017 models yet.

Android 4.2 and 4.4 Mediatek bootloop after installing Magisk 18.1

Hello everybody.
I've read that 18.1 supports 4.2+ so I've tried to install in two MTK6589T devices I've. One running 4.2, the other running 4.4
CMW/TWRP gave an error mounting system, so I mounted system manually and it started flashing. Firstly it detected old root installed and disabled the old root. But when it tried to find the boot, installation was aborted because installator claims cannot find the boot on both phones.
Then I though, okay, lets reboot back to android, I will try to install a few days later, maybe its buggy now, but both phones cannot boot.
I can easily fix them by flashing rom again I guess, but I would like to know where's the issue and also post it for more people could face the same problem.
Any idea where's the problem/how to fix without rom reflashing? I've tried magisk uninstaller but after mounting system in recovery it is also giving error.
Thanks
UPDATE: For now, if no other solution is found, bootloop can be bypassed by dirty installing the rom again. But it has to be an easier workaround...
We know now that the problem is caused because of two factors merging:
1- Using Magisk.zip installer through custom recovery
2-In the case that the custom recovery CMW/TWRP installed in the phone is very old (for instance, CMW automade for MTK6589X or TWRP 2.5.0).
While installing, Magisk tries to send commands to the custom recovery that cant be understood by it, leaving the installation incomplete after some modifications in /system (read below recovery log).
Acording to the recovery, it seems that Magisk did some modifications without running correctly survival script - Adding addon.d survival script ("Unrecognized option '-Xnodex2oat'") and .zip installer is not designed to revert actions in this case.
Also, Magisk couldn't reach the boot modification step, so boot is not damaged, therefore workarounds for restoring boot won't work.
Using Magisk Unistaller.zip is also not possible as the uninstaller is mainly designed for boot backup restoration, and again, this is not the case.
Currently needed: Find what's wrong in system due to the incomplete Magisk installation to revert it back to the original state (before faulty magisk.zip installation).
Recovery log:
************************
* Magisk v18.1 Installer
************************
- Mounting /system, /vendor
- Target image: /dev/bootimg
- Device platform: arm
- Removing system installed root
- Constructing environment
- Adding addon.d survival script
Unrecognized option '-Xnodex2oat'
up!
I' also having the same problem. My Samsung J2 Prime stuck at logo after updating to 18.1. Any tips on how to fix it without resetting my phone? Thanks.
Update: Bootloop fixed. I used TWRP to restore boot image. I then update Magisk by flashing zip file from TWRP. Everything went back to normal. Hope this help.
trol_sg said:
Hello everybody.
I've read that 18.1 supports 4.2+ so I've tried to install in two MTK6589T devices I've. One running 4.2, the other running 4.4
CMW/TWRP gave an error mounting system, so I mounted system manually and it started flashing. Firstly it detected old root installed and disabled the old root. But when it tried to find the boot, installation was aborted because installator claims cannot find the boot on both phones.
Then I though, okay, lets reboot back to android, I will try to install a few days later, maybe its buggy now, but both phones cannot boot.
I can easily fix them by flashing rom again I guess, but I would like to know where's the issue and also post it for more people could face the same problem.
Any idea where's the problem/how to fix without rom reflashing? I've tried magisk uninstaller but after mounting system in recovery it is also giving error.
Thanks
Click to expand...
Click to collapse
If you have a backup of your boot image, you can just restore it using TWRP. But in case that you have no backup of boot image, you can try to get boot image from the internet and restoring using it. In my case, this is what I did.
1. Go to TWRP and then make backup of boot image of the faulty phone*. (Folder 1)
2. I used another J2 prime to create a boot image backup. (Folder 2)
3. Once that is done, copy and replace the files inside the Folder 2 into Folder 1.
4. Reboot to TWRP again then use that to restore the boot image on my stuck J2.
Tips: make backup in SD card so you can easily swap it in between the bad and good phone.
*This is to create a folder of the backup file. I did tried to directly copy and paste the backup boot image file from another good phone but TWRP didn't detect it. So this is the workaround that I come with. And it worked for me.
Thanks for your answer but I doubt your case is mine. Your device is much newer than mine and according to your comment, you've sucesfully installed previous version of Magisk without issues. This is not a problem while updating, as Magisk v. earlier than 18.1 was not compatible with android 4.2+. I think Magisk is not compatible with MT6589T even if they run 4.2 or 4.4.
I think that it cannot be a boot problem as TWRP/CWM displayed msg 'Boot cannot be found' while installing Magisk, so that I don't think boot was replaced or modified in any ways. Moreover, the bootloop is not in the boot loading, as phone can pass boot image without any problem, but it is stuck in android loading image. I'm thinking in some script or root modification that Magisk did before trying to unpack the boot, however I'm not that deep into the Magisk install to find the proper workaround.
I can restore boot backup and also I can take boot file from the original rom and flash, because in Mediatek-based devices, boot.img is inside de zip, but I dont think it will solve the problem. Anyhow I'll get back ASAP with the answer.
Any more ideas??
Nothing, boot/uboot restoration or flashing again just the boot won't fix the problem, so it's something that Magisk installator touch in /system or /data I guess, but what?
trol_sg said:
Nothing, boot/uboot restoration or flashing again just the boot won't fix the problem, so it's something that Magisk installator touch in /system or /data I guess, but what?
Click to expand...
Click to collapse
Have you read/tried this?
didgeridoohan(dot)com/magisk/MagiskIssues
Ato09 said:
Have you read/tried this?
didgeridoohan(dot)com/magisk/MagiskIssues
Click to expand...
Click to collapse
Yes, I've read them before I made the post. I've also looked for a solution in some of the threads and using search, but couldn't find a way.
Here I attach recovery.log if someone is interested to see the detailed problem.
Also, here below I attach the lines concerning the installation. All other is uninstallation tries and so on:
************************
* Magisk v18.1 Installer
************************
- Mounting /system, /vendor
- Target image: /dev/bootimg
- Device platform: arm
- Removing system installed root
- Constructing environment
- Adding addon.d survival script
Unrecognized option '-Xnodex2oat'
dalvikvm: [options] class [argument ...]
dalvikvm: [options] -jar file.jar [argument ...]
The following standard options are recognized:
-classpath classpath
-Dproperty=value
-verbose:tag ('gc', 'jni', or 'class')
-ea[:<package name>... |:<class name>]
-da[:<package name>... |:<class name>]
(-enableassertions, -disableassertions)
-esa
-dsa
(-enablesystemassertions, -disablesystemassertions)
-showversion
-help
The following extended options are recognized:
-Xrunjdwp:<options>
-Xbootclasspath:bootclasspath
-Xcheck:tag (e.g. 'jni')
-XmsN (min heap, must be multiple of 1K, >= 1MB)
-XmxN (max heap, must be multiple of 1K, >= 2MB)
-XssN (stack size, >= 1KB, <= 256KB)
-Xverify:{none,remote,all}
-Xrs
-Xint (extended to accept 'ortable', ':fast' and ':jit')
These are unique to Dalvik:
-Xzygote
-Xdexopt:{none,verified,all,full}
-Xnoquithandler
-Xjniopts:{warnonly,forcecopy}
-Xjnitrace:substring (eg NativeClass or nativeMethod)
-Xstacktracefile:<filename>
-Xgc:[no]precise
-Xgc:[no]preverify
-Xgc:[no]postverify
-Xgc:[no]concurrent
-Xgc:[no]verifycardtable
-XX:+DisableExplicitGC
-X[no]genregmap
-Xverifyopt:[no]checkmon
-Xcheckdexsum
-Xincludeselectedop
-Xjitop:hexopvalue[-endvalue][,hexopvalue[-endvalue]]*
-Xincludeselectedmethod
-Xjitthreshold:decimalvalue
-Xjitcodecachesize:decimalvalueofkbytes
-Xjitblocking
-Xjitmethod:signature[,signature]* (eg Ljava/lang/String\;replace)
-Xjitclass:classname[,classname]*
-Xjitoffsetffset[,offset]
-Xjitconfig:filename
-Xjitcheckcg
-Xjitverbose
-Xjitprofile
-Xjitdisableopt
-Xjitsuspendpoll
Configured with: debugger profiler hprof jit(armv7-a-neon) smp show_exception=1
Failed to initialize runtime (check log for details)
- Unpacking boot image
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Parsing boot image: [/dev/bootimg]
No boot image magic found!
! Unable to unpack boot image
- Unmounting partitions
E:Error executing updater binary in zip '/sdcard/Magisk-v18.1.zip'
Error flashing zip '/sdcard/Magisk-v18.1.zip'
@trol_sg I'm gonna guess it's got to do with the absolutely ancient TWRP you're using. It just can't handle everything that the Magisk installation script is trying to do...
Your best bet (if Magisk will work at all on your device) is to patch the boot image with the Magisk Manager and then flash the patched image manually. There are new and shiny installation instructions available here: https://topjohnwu.github.io/Magisk/
Didgeridoohan said:
@trol_sg I'm gonna guess it's got to do with the absolutely ancient TWRP you're using. It just can't handle everything that the Magisk installation script is trying to do...
Your best bet (if Magisk will work at all on your device) is to patch the boot image with the Magisk Manager and then flash the patched image manually. There are new and shiny installation instructions available here: https://topjohnwu.github.io/Magisk/
Click to expand...
Click to collapse
Thank you so much for your answer. So it's the recovery, but can't find newer ones, sadly. Too old phones I know, but just curious if I could make Magisk working on them, lol.
I was going into the boot modification manually right now, but in order to patch the boot I need manager installed first, and phone couldn't boot so I did dirty flash of the rom to be able to boot into it again.
Lets see what happens then. I'll be right back.
Anyhow, this is not a solution to fix the problem of bootloop that I am requesting help in case someone could face the same and did not make a backup of the phone and didn't want to make dirty re-flash. Any idea?
Update: After I did dirty flash of the rom, and now Jiayu g3s android 4.4 booted.
UPDATE: So, after patching manually boot and installing (using restore in TWRP 2.5 as image flash is not yet implemented AFAIK), phone booted and yes Magisk is working.
Magisk installation .zip through a very old recovery is making the bootloop. So that, a thing learnt now.
But, for other people facing this bootloop, can we do a research to find what magisk.zip did to the phones to leave them in bootloop? Maybe we can revert without rom flashing easily if we knew what's the issue...
Thanks in advance!
Doing a bit more tests I found that magisk.zip did something in /system so that it is left in bootloop, but still no idea why/whats causing that...
There are delay complete boot like 4 5 second in j7 prime. I didn't love this version
any more help?? up!!
trol_sg said:
Yes, I've read them before I made the post. I've also looked for a solution in some of the threads and using search, but couldn't find a way.
Click to expand...
Click to collapse
Try this.
Quote:
Originally Posted by void74
I faced this problem too this morning.
I have a Redmi Note 5 with AOSiP ROM, I don't know if it's the right way to do it, but I solved the bootloop problem this way:
- volume up and then boot to TWRP
- copied magisk uninstall to phone memory
- installed magisk uninstall
- rebooted in fastboot/bootloader mode
- flashed original boot.img extracted from stock image zip file ("fastboot flash boot boot.img")
- rebooted to TWRP
- installed magisk 17.0 zip file
- rebooted to system, all OK!
Only problem is that I lost previous magisk configuration, but it's a snap to reconfigure it!
Quote:
Originally Posted by Mangraviti
Here is what to do, if you HAVE NOT installed the new version:
1) Do not update via Magisk Manager.
2) Do not update via TWRP using the zip you can download via Magisk Manager.
3) Uninstall Magisk using Magisk uninstaller (ZIP).
4) Boot to Android.
5) Reboot to TWRP
6) Install V17 ZIP via TWRP and boot to Android.
If you HAVE INSTALLED and got a bootloop:
1) Download the uninstaller ZIP.
2) Enter TWRP during the bootloop.
3) Uninstall using the uninstaller ZIP.
4) Boot to Android.
5) Download V17.
6) Reboot to TWRP and flash the V17.
7) Boot to Android it it should be working.
-------------
Original post. https://forum.xda-developers.com/apps/magisk/bootloop-magisk-update-t3836904
Hope it help.
Ato09 said:
Try this.
Quote:
Originally Posted by void74
I faced this problem too this morning.
I have a Redmi Note 5 with AOSiP ROM, I don't know if it's the right way to do it, but I solved the bootloop problem this way:
- volume up and then boot to TWRP
- copied magisk uninstall to phone memory
- installed magisk uninstall
- rebooted in fastboot/bootloader mode
- flashed original boot.img extracted from stock image zip file ("fastboot flash boot boot.img")
- rebooted to TWRP
- installed magisk 17.0 zip file
- rebooted to system, all OK!
Only problem is that I lost previous magisk configuration, but it's a snap to reconfigure it!
Quote:
Originally Posted by Mangraviti
Here is what to do, if you HAVE NOT installed the new version:
1) Do not update via Magisk Manager.
2) Do not update via TWRP using the zip you can download via Magisk Manager.
3) Uninstall Magisk using Magisk uninstaller (ZIP).
4) Boot to Android.
5) Reboot to TWRP
6) Install V17 ZIP via TWRP and boot to Android.
If you HAVE INSTALLED and got a bootloop:
1) Download the uninstaller ZIP.
2) Enter TWRP during the bootloop.
3) Uninstall using the uninstaller ZIP.
4) Boot to Android.
5) Download V17.
6) Reboot to TWRP and flash the V17.
7) Boot to Android it it should be working.
-------------
Original post. https://forum.xda-developers.com/apps/magisk/bootloop-magisk-update-t3836904
Hope it help.
Click to expand...
Click to collapse
Hello, thanks
This method won't work in my case as in the step:
- installed magisk uninstall = gives error
Note 5 is much newer phone with a recent recovery TWRP that allows all Magisk.zips commands, but unluckyly not this case.
Also, this method is for wrong boot installation/damaged boot. In my case what Magisk damage is /system, not boot.
I wish it could be boot, because that is very easy to fix (flashing through fastboot/SP Flash tools in the case of MTK, recovering boot twrp "backup" even if you didn't make backup...) as you mentioned.
Hope someone have a great idea to revert system to origin, then we could post the solution for those who would like to install Magisk in 4.2+ old phones, and instead of doing boot flash manually, they try to flash magisk.zip and they got bootloop.
Main post updated with all thread information. Up!
Nothing?? Up!!
trol_sg said:
Hope someone have a great idea to revert system to origin, then we could post the solution for those who would like to install Magisk in 4.2+ old phones, and instead of doing boot flash manually, they try to flash magisk.zip and they got bootloop.
Click to expand...
Click to collapse
The only part of the Magisk installation that actually touches /system is if it installs the addon.d survival script. The log you posted earlier shows that it's trying to do this, for some reason, and failiing. I'd start looking there...

Flashing TWRP as Image - Possible?

TWRP 3.3 is out but only the IMG version is available in the TWRP site. Flashable ZIP file isn't available yet. I can fastboot boot into TWRP.img but since this is an A/B phone i guess i can't flash the image to any partition? Is there a way i can do that or do i have to wait until TWRP releases ZIP files for the update?
Thanks!
Helhound0 said:
TWRP 3.3 is out but only the IMG version is available in the TWRP site. Flashable ZIP file isn't available yet. I can fastboot boot into TWRP.img but since this is an A/B phone i guess i can't flash the image to any partition? Is there a way i can do that or do i have to wait until TWRP releases ZIP files for the update?
Thanks!
Click to expand...
Click to collapse
In order to flash the recovery as an image, you need to pack it inside a boot.img and then flash the boot partition.
The recovery itself is just the ramdisk from the boot.img. when you boot to recovery, the ramdisk gets unpacked and used as the root file system. When you boot to the os, the ramdisk is skipped and the system partition is mounted as the root partition.
There are some ROM kitchens that should be able to do this. I think there is a binary in the twrp installer that well let you do all this from your phone.
From the command line, you would use the unpackbootimage binary to dump your boot.img, gunzip and cpio to dump and repack the ramdisk, then mkbootimg to pack it all back up.
There might be an extra step to sign the boot.img, but you can take a look at the twrp installer to see if it does any extra magic at the end.
So yes it's possible, but certainly not a "flash it and forget it" kind of thing.
Lastly, isn't there an option to install twrp from inside twrp? I thought I read that in the change log. Maybe I should have lead with this?:good:
---------- Post added at 01:42 PM ---------- Previous post was at 01:36 PM ----------
Yup, it's in the XDA post.
Going forward, users will be presented with a new “install recovery ramdisk” option in recovery. This means that users can boot TWRP and then install it without downloading a separate ZIP file.
Click to expand...
Click to collapse
https://www.xda-developers.com/twrp-3-3-0-release/
I haven't flashed it yet, so I can't say if this is implemented in our version yet.
gee one said:
In order to flash the recovery as an image, you need to pack it inside a boot.img and then flash the boot partition.
The recovery itself is just the ramdisk from the boot.img. when you boot to recovery, the ramdisk gets unpacked and used as the root file system. When you boot to the os, the ramdisk is skipped and the system partition is mounted as the root partition.
There are some ROM kitchens that should be able to do this. I think there is a binary in the twrp installer that well let you do all this from your phone.
From the command line, you would use the unpackbootimage binary to dump your boot.img, gunzip and cpio to dump and repack the ramdisk, then mkbootimg to pack it all back up.
There might be an extra step to sign the boot.img, but you can take a look at the twrp installer to see if it does any extra magic at the end.
So yes it's possible, but certainly not a "flash it and forget it" kind of thing.
Lastly, isn't there an option to install twrp from inside twrp? I thought I read that in the change log. Maybe I should have lead with this?:good:
---------- Post added at 01:42 PM ---------- Previous post was at 01:36 PM ----------
Yup, it's in the XDA post.
https://www.xda-developers.com/twrp-3-3-0-release/
I haven't flashed it yet, so I can't say if this is implemented in our version yet.
Click to expand...
Click to collapse
Yes i got to know about the update with this Article, But I don't get a “install recovery ramdisk” option anywhere in my recovery when i boot into 3.3. Besides the article says this:
the team will offer installer ZIPs this time around to give people a chance to update from older versions, but future TWRP releases won’t have separate installer scripts.
Click to expand...
Click to collapse
Helhound0 said:
Yes i got to know about the update with this Article, But I don't get a “install recovery ramdisk” option anywhere in my recovery when i boot into 3.3. Besides the article says this:
Click to expand...
Click to collapse
I just spoke with the device TWRP device maintainer for the OnePlus 6T and he instructed me to make this change in the device tree.
Add
TW_INCLUDE_REPACKTOOLS := true
Into
boardconfig.mk
I'll try this out when i get back home later and post an update.
I've made a zip for it and attached it. What I did was download the zip for another device (fajita I believe), download the image for this device, extract the ramdisk from the image using magiskboot, replace the ramdisk inside the zip with the one from the image, and sign it using the default testkey. Steps to install the zip:
1. Update LineageOS so that I have a boot image with no older TWRP (may not be necessary, but better safe than sorry). I DID NOT REBOOT YET! (Although I don't think rebooting would've caused problems, I just didn't want to deal with rebooting twice)
2. Install the modded TWRP zip from Magisk Manager (not from TWRP itself). DO NOT REBOOT, THE ZIP REMOVES MAGISK, WE NEED TO REINSTALL IT FIRST.
3. Go to the main page of Magisk Manager, and install Magisk to the inactive slot
4. Reboot, everything should be fine
Note: this uses the TWRP image from the website, so it does not have the Install to Ramdisk or whatever option. It does however have the rest of the TWRP 3.3 features like being able to decrypt data for Android Pie.
Obviously, full credit goes to the TWRP team, all I did was replace the ramdisk in the zip with the one from the image.
Turns out an official build was released not long after I posted that, oops. There's a zip on the website now.
BeeWall said:
Turns out an official build was released not long after I posted that, oops. There's a zip on the website now.
Click to expand...
Click to collapse
Yeah i came to post about that in the thread. Thanks for your work tho
To anyone interested, they've uploaded a flashable ZIP file for Payton in their website.
You can download it here : https://dl.twrp.me/payton/

Categories

Resources