• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Can only boot into recovery and bootloader after a magisk update

Search This thread

Sparklapse

Member
Jan 21, 2016
6
1
sparklapse.com
So this is a fun one.
I had my devices loaded with magisk. Everything was fine till a recent update for magisk (I believe v18.0.0). The apk downloaded and then it needed to flash the update. I selected the option with the tag 'recommended' next to it and then it booted straight to the boot loader. I'm able to connect and control through fashboot or recovery but nothing I seem to do fixes it. I saw a twrp image available so I booted to that (not flashed over the current recovery) and did a factory reset and nothing. Also tried a factory reset from stock recovery. Still same story. I'm downloading the latest firmware from the offical asus site with the idea to flash it through recovery but if anyone can suggest anything else before or if it is to fail that would be great.

Helpful info
Model: WW International (A002)

Bootloader displays the following:
Product_name - Siva
Storage_variant - UFS
Bootloader version - 1.23
Version - WW_ZS571KL-14.1600.1801.44
Serial Number - 'this is blank'
Secure boot - enabled
Device state - unlocked
 
Last edited:

Sparklapse

Member
Jan 21, 2016
6
1
sparklapse.com
Updates

Update 1:
So I reflashed the original zip firmware with twrp. Now I'm stuck at the asus logo.

Update 2:
I tried again with flashing the original zip firmware. This firmware is provided by the asus website but when I did a full wipe and flash in twrp, when attempting to reboot it said that there was no os installed so turns out the zip files are just updates and not the whole image. I've found an image here but have yet to test it. Fingers crossed it doesn't include a rootkit.

Update 3:
Well this is new (at least for me)... So I downloaded the zip from the link in the second update and instead of a single rom file I got a bunch of img and bin files. It said to use the 'qualcomm flash image loader' sooooo yeah. I loaded up the program (in a vm since im running on osx) and the files it asks for in all available options don't exist in the firmware folder. On the bright side there seems to be valuable files in the firmware folder like the 'system.img'. After trying to deconstruct the type of rom structure is being used (with reference to this) I copied over the offical update zip from the asus site and the 'system.img' from third-party site. I'll wipe and flash both then update what happens.

Update 3.5:
As a side note, if I manage to get this to work I'll post a guide with relevant files to restore to stock from this state.

Update 4:
SUCSESS! I flashed the update zip from asus using twrp and flashed the 'system.img' using fastboot. I'm now seeing a beautiful spinning wheel. After more digging into the firmware folder from the third-pary there was an sh file which flashed many files to the device with fastboot. Currently setting up the device but will update if there's any major issues/crashes/bugs

Update 4.1:
So not even a second in and wifi doesn't work. Probably need to flash a few more images. Gonna flashing everything from fastboot this time round.

Update 4.5:
So to give some context, here is the '.sh' file that came with the third-party firmware.

Code:
#!/bin/bash

#./fastboot getvar version-bootloader
STORAGE_TYPE=unknown

uname -a
OS_VERSION=`getconf LONG_BIT`

if [ "$OS_VERSION" == 32 ]; then
    echo "We don't support 32bit os environment, exit!"; exit 1
fi

rm fastboot.log

echo "Saving log to fastboot.log"

echo "flash partition:0 gpt_both0.bin..."
./fastboot flash partition:0 gpt_both0.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
       echo 'failed and exit'; exit 1
fi

echo "flash partition:1 gpt_both1.bin..."
./fastboot flash partition:1 gpt_both1.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
       echo 'failed and exit'; exit 1
fi

echo "flash partition:2 gpt_both2.bin..."
./fastboot flash partition:2 gpt_both2.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash partition:3 gpt_both3.bin..."
./fastboot flash partition:3 gpt_both3.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash partition:4 gpt_both4.bin..."
./fastboot flash partition:4 gpt_both4.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash partition:5 gpt_both5.bin..."
./fastboot flash partition:5 gpt_both5.bin > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash bootloader bootloader.img ..."
./fastboot flash bootloader bootloader.img > fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi


echo "flash dsp adspso.bin..."
./fastboot flash dsp adspso.bin >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash mdtp mdtp.img..."
./fastboot flash mdtp mdtp.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi


echo "flash splash splash.img..."
./fastboot flash splash splash.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash asusfw asusfw.img..."
./fastboot flash asusfw asusfw.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "reboot-bootloader..."
./fastboot reboot-bootloader >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi
echo "wait for 5 seconds for bootloader to be ready..."
sleep 5


echo "flash modem NON-HLOS.bin..."
./fastboot flash modem NON-HLOS.bin >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash boot boot.img..."
./fastboot flash boot boot.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash recovery recovery.img..."
./fastboot flash recovery recovery.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "flash system system.img..."
./fastboot flash system system.img >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi


echo "format ADF..."
./fastboot format ADF >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "format asdf..."
./fastboot format asdf >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

echo "format metatdata..."
./fastboot erase metadata >> fastboot.log 2>&1
grep -E 'FAILED|error' fastboot.log
RETVAL=$?
if [ $RETVAL -eq 0 ];then
        echo 'failed and exit'; exit 1
fi

./fastboot oem uart-off

./fastboot reboot -w

I'm not gonna use the script since there's a few things here and there I wanna change as well as input the most up to date images where possible.

Update 5:
Back at square 1... kinda. I'm gonna try and flash files only from the third-party provider this time. Also no twrp since I tried installing twrp and then tried to do a factory reset. Also to the guys that 'ported' twrp it really only works to wipe things and view root directories (at least in my experience) .

Update 6:
I think I'm gonna cry I'm so happy. After pulling an all nighter I now have wifi and a bootable phone! I'm gonna set it up and hopefully be able to go to sleep while google re-downloads all my apps.

Update 6.1:
So I'll post the whole process to restore in the next post but I've been awake for almost 30 hours so another time it will be. Also I learnt my lesson to make NAND backups from now on.

Update 7:
After a short time of use, the device slowed a bit. This could have been cause of anything but I decided a reboot would resolve the issue but instead revealed another. The device was once again stuck at the asus logo. I quickly tried re-flashing some of the files without doing a full wipe in the hope I would be able to keep my data but nothing. I've sent an email to ASUS asking for a full stock rom but am doubtful I will get any files back so I'll keep looking for solutions.

Update 8:
Okay, I think I've finally got this down. So I redid a full wipe and reset through fastboot. As soon as I got into the device I did a factory reset. This must have done something which allowed me to later reboot the device without it getting stuck. Considering how much I've added on this thread I'll create a new thread as a guide to complete this
 
Last edited:
  • Like
Reactions: DrunkenPoney

Sparklapse

Member
Jan 21, 2016
6
1
sparklapse.com

Unless I've been flashing it incorrectly, I believe these are only firmware updates. When looking into the package it's missing certain images like the 'system.img' and 'recovery.img'. Though I'd be more than happy for you to prove me wrong here.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Updates

    Update 1:
    So I reflashed the original zip firmware with twrp. Now I'm stuck at the asus logo.

    Update 2:
    I tried again with flashing the original zip firmware. This firmware is provided by the asus website but when I did a full wipe and flash in twrp, when attempting to reboot it said that there was no os installed so turns out the zip files are just updates and not the whole image. I've found an image here but have yet to test it. Fingers crossed it doesn't include a rootkit.

    Update 3:
    Well this is new (at least for me)... So I downloaded the zip from the link in the second update and instead of a single rom file I got a bunch of img and bin files. It said to use the 'qualcomm flash image loader' sooooo yeah. I loaded up the program (in a vm since im running on osx) and the files it asks for in all available options don't exist in the firmware folder. On the bright side there seems to be valuable files in the firmware folder like the 'system.img'. After trying to deconstruct the type of rom structure is being used (with reference to this) I copied over the offical update zip from the asus site and the 'system.img' from third-party site. I'll wipe and flash both then update what happens.

    Update 3.5:
    As a side note, if I manage to get this to work I'll post a guide with relevant files to restore to stock from this state.

    Update 4:
    SUCSESS! I flashed the update zip from asus using twrp and flashed the 'system.img' using fastboot. I'm now seeing a beautiful spinning wheel. After more digging into the firmware folder from the third-pary there was an sh file which flashed many files to the device with fastboot. Currently setting up the device but will update if there's any major issues/crashes/bugs

    Update 4.1:
    So not even a second in and wifi doesn't work. Probably need to flash a few more images. Gonna flashing everything from fastboot this time round.

    Update 4.5:
    So to give some context, here is the '.sh' file that came with the third-party firmware.

    Code:
    #!/bin/bash
    
    #./fastboot getvar version-bootloader
    STORAGE_TYPE=unknown
    
    uname -a
    OS_VERSION=`getconf LONG_BIT`
    
    if [ "$OS_VERSION" == 32 ]; then
        echo "We don't support 32bit os environment, exit!"; exit 1
    fi
    
    rm fastboot.log
    
    echo "Saving log to fastboot.log"
    
    echo "flash partition:0 gpt_both0.bin..."
    ./fastboot flash partition:0 gpt_both0.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
           echo 'failed and exit'; exit 1
    fi
    
    echo "flash partition:1 gpt_both1.bin..."
    ./fastboot flash partition:1 gpt_both1.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
           echo 'failed and exit'; exit 1
    fi
    
    echo "flash partition:2 gpt_both2.bin..."
    ./fastboot flash partition:2 gpt_both2.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash partition:3 gpt_both3.bin..."
    ./fastboot flash partition:3 gpt_both3.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash partition:4 gpt_both4.bin..."
    ./fastboot flash partition:4 gpt_both4.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash partition:5 gpt_both5.bin..."
    ./fastboot flash partition:5 gpt_both5.bin > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash bootloader bootloader.img ..."
    ./fastboot flash bootloader bootloader.img > fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    
    echo "flash dsp adspso.bin..."
    ./fastboot flash dsp adspso.bin >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash mdtp mdtp.img..."
    ./fastboot flash mdtp mdtp.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    
    echo "flash splash splash.img..."
    ./fastboot flash splash splash.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash asusfw asusfw.img..."
    ./fastboot flash asusfw asusfw.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "reboot-bootloader..."
    ./fastboot reboot-bootloader >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    echo "wait for 5 seconds for bootloader to be ready..."
    sleep 5
    
    
    echo "flash modem NON-HLOS.bin..."
    ./fastboot flash modem NON-HLOS.bin >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash boot boot.img..."
    ./fastboot flash boot boot.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash recovery recovery.img..."
    ./fastboot flash recovery recovery.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "flash system system.img..."
    ./fastboot flash system system.img >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    
    echo "format ADF..."
    ./fastboot format ADF >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "format asdf..."
    ./fastboot format asdf >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    echo "format metatdata..."
    ./fastboot erase metadata >> fastboot.log 2>&1
    grep -E 'FAILED|error' fastboot.log
    RETVAL=$?
    if [ $RETVAL -eq 0 ];then
            echo 'failed and exit'; exit 1
    fi
    
    ./fastboot oem uart-off
    
    ./fastboot reboot -w

    I'm not gonna use the script since there's a few things here and there I wanna change as well as input the most up to date images where possible.

    Update 5:
    Back at square 1... kinda. I'm gonna try and flash files only from the third-party provider this time. Also no twrp since I tried installing twrp and then tried to do a factory reset. Also to the guys that 'ported' twrp it really only works to wipe things and view root directories (at least in my experience) .

    Update 6:
    I think I'm gonna cry I'm so happy. After pulling an all nighter I now have wifi and a bootable phone! I'm gonna set it up and hopefully be able to go to sleep while google re-downloads all my apps.

    Update 6.1:
    So I'll post the whole process to restore in the next post but I've been awake for almost 30 hours so another time it will be. Also I learnt my lesson to make NAND backups from now on.

    Update 7:
    After a short time of use, the device slowed a bit. This could have been cause of anything but I decided a reboot would resolve the issue but instead revealed another. The device was once again stuck at the asus logo. I quickly tried re-flashing some of the files without doing a full wipe in the hope I would be able to keep my data but nothing. I've sent an email to ASUS asking for a full stock rom but am doubtful I will get any files back so I'll keep looking for solutions.

    Update 8:
    Okay, I think I've finally got this down. So I redid a full wipe and reset through fastboot. As soon as I got into the device I did a factory reset. This must have done something which allowed me to later reboot the device without it getting stuck. Considering how much I've added on this thread I'll create a new thread as a guide to complete this