[G4 Android Development] steadfasterX:
TWRP on locked devices is impossible right?

Oh no wait there are hacks up to KK which work but I couldn't find anything for LL (sorry if I missed something) and so nothing for the G4

Here is where the FIsH steps in ;)

FIsH: [F]luffy [i]ncredible [s]teadfasterX [H]ijack​

FIsH is different from Safestrap or other hijacks because it should be understood as a kind of framework for any boot image you want to boot.

FIsH will not harm the Android boot chain!

It is NOT multirom

It is NOT efidroid

It is NOT Safestrap

It is NOT twrp.

.... but FIsH can boot any of the above. U got it? FIsH is the hack to boot whatever you want.

Will FIsH void your warranty? Not more or less then rooting your device.

Will FIsH unlock your bootloader? No read again.

Is there a risk with FIsH? For example could it soft-brick my device? Well.. absolutely! Safe is the death only. There are always risks especially for untested devices. I do all I can to keep this risk as low as possible and I provided a way to get out of bootloops but again you will get no guarantees here and elsewhere.

.. and it is more then just a hack for the G4 (any model) it is a hack for

ALL devices of ANY

vendor! wtf? yes.

Sure you have to met the pre-requirements and there has to be done some things to get it ported but those are straight forward.

Go to IRC channel #androidfish if u can't wait but I will publish a public porting guide when it is ready.

Are there plans to make more out of it for the G4? Absolutely. I'm currently working on an "efidroid in FIsH" version which will let you flash & boot (hopefully) any custom ROM u like.

ALL DETAILS ABOUT HOW FIsH WORKS HAVE BEEN RELEASED IN ANOTHER THREAD (check my signature).

So going back to topic. This is:

TWRP in FIsH for the LG G4 (any model) - Bootloader LOCKED

Do you have a bootloader unlocked device?

If the answer is

YES

: you

don't need it

Do you have a bootloader locked device and want TWRP?

If the answer to BOTH is

YES

. you need it. you can't install TWRP on a locked device.. up to now.

FIsH allows you to do so.

If your question is: Can this ENABLE root for my device?

NO! you actually NEED root to activate TWRP for your device with this method.

Important: Here are the pre-requirements

you have to met

!

If you can't get them:

Close this page and FORGET it (until the day you may met those reqs)!

Requirements!

root by

SuperSU >=v2.76 (greater or equal v2.76)

(atm this means you have to downgrade/install LL. It also means that you have to upgrade your SuperSU to this version by e.g. FlashFire if you have a lower version installed!)

you have to be able to

disable SELinux

in your booted Android (which should be the case when you have a full rooted device)

Those above are

hard facts

so it may never work with MM. That also means if MM can get fully rooted by SuperSU and you can use "setenforce 0" the method should work there as well!

Before you think about downgrading to LL read about ANTI-ROLLBACK protection some LG devices and MM versions may have!

Anti-Rollback means you CAN NOT downgrade - it would brick your device.

I will NOT provide downgrading guides there are plenty of them so search and read.

If you can not meet ALL of the above 2 requirements lay down and cry. For the others: calm down and read on!

You can test requirement 2 (disable SELinux) by:

adb shell

su

setenforce 0

getenforce

-> you should see "Permissive" as a result. If you see "Enforcing" or error messages you may doing something wrong or it just do not work for you.

Limitations!

Keep in mind what I said above:

FIsH does NOT unlock your bootloader.

That means with TWRPinFIsH you can

NOT

:

Install a custom ROM like CM/Lineage (this will modify boot

= soft brick

. for this u need "efidroid in FIsH" - coming soon)

Install a custom Kernel (this will modify boot

= soft brick

)

Install a custom recovery (this will modify recovery

= may soft brick

)

In short: nothing which modifies boot or recovery partitions.

You can of course flash everything which is modifying /system /data only (e.g. xposed,...)

That means you could install even a custom ROM which works with the stock kernel so with unmodified boot image. Let's say the creator of imperium or genisys provide a release without the containing boot image. You could flash it..

State / Roadmap

FULL takeover/hijack of boot -> DONE (the modifications required are

not

voiding the Android boot signing chain!)

replace RAM disk -> DONE

boot own RAM disk (TWRP!) -> DONE (atm TWRP 2.8.7-0) <-- TWRP-in-FIsH v1.0 private BETA

Upgrade bundled TWRP to latest version -> DONE (TWRP 3.1.0-0) <-- TWRP-in-FIsH v1.0 final release

Download

READ THE

REQUIREMENTS

above before proceeding!

Then

UNDERSTAND

the requirements before proceeding! <-- omg this is crucial important!!!! Ensure that you really do not skip this step!

READ THE

LIMITATIONS

above before proceeding!

Then

UNDERSTAND

the limitations before proceeding! <-- omg this is crucial important!!!! Ensure that you really do not skip this step!

... and

NEVER

ask for ETA's! ;)

if you can say:

Yes! I have read and

totally

understood the

limitations

AND the

requirements

!

then proceed. Otherwise read again until you got it.

Keep in mind that this is a HACK. It may soft-brick your device. you have been warned!

The concept is the same for all models but again no guarantees here for anything.

There is

ALWAYS

a risk and you should better

backup

what you do not want to loose before starting downloading this.

Go to the DOWNLOADS tab in this thread.

TWRP-in-FIsH is now integrated into my TWRP build server and so whenever a new change happens in TWRP you will get the same automatically on next build. This way it is much easier to release new TWRP versions made for FIsH.

From now on you will find nightlies (untested automatic builds) here:

Jenkins build status

Nightlies download server

Installation (Linux)

You can just install any newer version over an old one.

boot Android and connect USB cable

download the newest version to your PC and open a terminal in that directory

tar xzf TWRPinFIsH*.tgz (tar xzf TWRP-in-FIsH*.tgz since v2.0)

cd openFIsH (cd android_FIsH since v2.0)

./install.sh

check the output of that script. you should not see any errors there (hopefully)

Installation (Android / no PC)

Requirements:

TWRP-in-FIsH v4.2 or higher!

BusyBox pre-installed (e.g.: with this app )

You can just install any newer version over an old one.

Thanks to @ReeS86 starting from v4.2 on TWRP-in-FIsH has an enhanced installer which can run without any PC - directly on your Android device!

It would be nice if you could give him a thx click (here) for his contribution :) !

Bring TWRP-in-FIsH to your Android device

Example-1

with any PC (windows, linux, ...): adb push TWRP-in-FIsH.tgz /sdcard (replace TWRP-in-FIsH.tgz this with the real file name)

Example-2

within an Android Terminal:

cd /sdcard

wget http://full-URL-to-file (replace full-URL-to-file with the real direct download link)

Example-3

with just a browser: well just download it.. ;) but remember where it gets saved!

extract it

Example from within Android Terminal:

cd /sdcard (or the folder where you have downloaded TWRP-in-FIsH)

tar xzf TWRP-in-FIsH.tgz (replace TWRP-in-FIsH.tgz this with the real file name)

run the installer (but do it correctly)

Example from within Android Terminal:

su

cd /sdcard/android_FIsH

sh ./install.sh (using

sh

is absolutely important otherwise it will fail)

done

Installation (Windows)

If none of the above methods is working for you: use FWUL

First run (no PC required)

This FIsH gets installed PERMANENTLY! That means:

You can boot up TWRP the same way as described here again without re-installing.

If you re-install your STOCK image you have to re-install TWRPinFIsH as well.

reboot Android

you should now see: LED goes from blue to

GREEN

NOW directly when u see this

GREEN

LED press VOLUME DOWN and do NOT release

wait until the device vibrates and the LED changed to

RED

. Then release the Volume Down button.

Wait until FIsH completed and TWRP should be shown --> This means FIsH has done it's job well!

This is a good time to do a full backup isn't it ? ;) Manually mount the SYSTEM partition as it gets not auto mounted atm and do a full backup

reboot from here (safely ignore the msg "no OS installed" and reboot anyways) and you should see Android booting (hopefully ... if not see bottom)

Daily Usage (no PC required)

reboot Android

you should now see: LED goes from blue to

GREEN

NOW directly when u see this

GREEN

LED press VOLUME DOWN and do NOT release

wait until the device vibrates and the LED changed to

RED

. Then release the Volume Down button.

Wait until FIsH completed and TWRP should be shown --> This means FIsH is doing it's job still very well :)

AGAIN

: keep your mind up! You HAVE to ensure that whatever you do and whatever you flash ->

NEVER TOUCH BOOT/RECOVERY

! If you flash a ZIP ensure first that it do not modify them! Otherwise you WILL

softbrick

. You have been warned (several times now)

FIsH helpers

If you just want to reboot directly from within Android check out these:

Thanks to @sdembiske who has onboarded the developer @AntaresOne we have an option to reboot into FIsH very comfortable now!

Check it out here: QuickReboot App

Trouble / Bootloop fix

if you encounter a bootloop (should never happen but who knows) you have 3 choices at least:

Option 1a: (TWRP-Bootloop) Within TWRP open Advanced -> File Manager -> Goto: /system/su.d and click "select" button -> Delete

Option 1b: (TWRP-Bootloop) From your PC: adb shell rm -rf /system/su.d/

Important

: Catch the fish log (see next topic)

Option 2 (this works also for a bootloop without twrp): boot into download mode and use LGLaf to get a shell

then:

setenforce 0 <-- if that doesn't work you may have to do a FULL restore to stock

mount -oremount,rw /system

rm -rf /system/su.d/

reboot. You are out of the bootloop.

Important

: Catch the fish log (see next topic)

Option 3: Last resort: Reflash STOCK. sorry.. there is always a risk..

Catch the FIsH logs

reboot back to Android and catch the fish log (IMPORTANT!):

adb shell "su -c cat /cache/fish/fish.log"

adb shell "su -c cat /cache/fish/fish.log.old"

Upload it to https://paste.omnirom.org and paste the link in the IRC channel (see next topic)

Support / IRC Channel

IRC means Internet Relay Chat and you will get best support there only.

Choose how to get in:

PC (HexChat and Pidgin are only 2 of them! This list is not complete!)

Android (Yaaic, AndChat, HoloIRC, AndroIRC are only a few of them! This list is not complete!)

Web (KiwiIRC-Web,FreenodeWebchat])

When you have to choose a channel it is: #Carbon-user

When you be asked for a server network choose: freenode

Known issues (may never get fixed)

Due to the fact that TWRPinFIsH is a brutal hijack of the booting process several things may not work as expected.

This will normally not harm anything but you have to know about.

System IMAGE backup:

Using this new option is a bulletproof method to backup and restore in TWRP-in-FIsH because you have to keep in mind that FIsH is a giant and brutal hack and even when a usual backup & restore is proven to work fine I would recommend to use both backup methods - if you can.

HINT: This method requires an ext4 or exfat partition on your external SD card otherwise image backups will fail due to the file size.

@sdembiske reports success using the internal storage as target for the backup but if you do this keep in mind that you have to move that backup to your PC manually to ensure you have it by hand for the worst case.

ZIP / ROM flashing:

omg really you wanna hear that again? OK: DON'T TOUCH BOOT / RECOVERY. And you be safe.

When you try to install a ROM it will modify at least BOOT. That means soft-brick!

When you try to install a custom Kernel.. omg really? It will definitively SOFT-BRICK! Maybe you should read the limitations again?? :p

When you try to install a ZIP like xposed, supersu, Vipermod and others ensure that those are not modifying BOOT or RECOVERY partitions. For those mentioned it would be very unlikely but who knows.

When you find a stock based ROM which is not modifying boot you can flash it. But ensure that it does not modify anything on boot!!! You could ask the devs of imperium etc if they can provide such a zip..

SYSTEM partition (since v2.0: may be not a restriction on your device model!):

when you boot into TWRPinFIsH you may see an error message regarding the fact that /system cannot be mounted.

you can mount /system manually without a problem - BUT - it will work only if you do NOT select "mount system read-only". It has to be unchecked to work.

after you have mounted /system manually and you want to take a backup you may see "0 bytes". Just press refresh and the size will be updated. If not: Do you have mounted it correctly (see above).

FIRMWARE partition (since v2.0: may be not a restriction on your device model!):

cannot be mounted - even not manually. You have to live with it.

Double Tap to wakeup (in TWRP):

You may heave seen/heard that this works in the official / usual TWRP for the G4 for unlocked devices. Unfortunately this cannot work in TWRP-in-FIsH due to the nature of this hijack. You have to live with it.

Installing more than 1 ZIP at a time (may be not a restriction on your device model!):

It is not possible to install more than 1 ZIP at the same time. TWRP gives you the option to install multiple ZIP files but the problem is you have to re-mount /system after each ZIP flashing. This is due to a problem with mounting /system readonly and most ZIPs will exactly try to do this when they finished their work - leaving you with an unmounted /system.

This will be not the case for every ZIP combination - so it is possible that you can flash some ZIPs at the same time while others not.

atm I believe you have to live with it.

Credits (without them - no TWRP-in-FIsH!!!)

If you feel that someone / you is missing on this list lemme know!

Chainfire for SuperSU! This is the main part of FIsH!

TeamWin for TWRP of course!

@cray_Doze, @dssmex and @KeiranFTW for their hijack implementations which given me many input (e.g. https://xdaforums.com/showthread.php?t=2608408)

@Aaahh for his great first steps to a G4 hijack -> His work had given me the motivation back to continue when I was about to stop all this :p

@dibbled for creating the android FIsH logo :)

steadfasterX for being steadfast! ;)

@jasonlindholm for your donation it was highly appreciated!

XDA:DevDB Information

TWRP-in-FIsH_LGG4, Tool/Utility for the LG G4

Contributors

steadfasterX, Aaahh, TheMadScientist420, KeiranFTW, cray_Doze, dssmex, TeamWin, ChainFire, the_naxhoo, SimoxTav, Rees86, uio88, sdembiske, jasonlindholm, ... and all new other contributors who gave me feedback for this!

Source Code: https://github.com/Carbon-Fusion/android_FIsH

Version Information

Status: Stable

Current Stable Version: 4.2

Stable Release Date: 2017-06-21

Current Beta Version: 5.0

Beta Release Date: 2017-12-19

Created 2017-03-14

Last Updated 2017-12-19