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

How To Guide Unlocking, Rooting, System RW, LED Notification Summary

Search This thread

latentspork

New member
Oct 18, 2021
2
4
First time posting and I wanted to say thank you to all the excellent talent here on XDA! None of this would have been done without the work of so many people.

I have a Moto G Play (2021) (XT2093-4) that I recently purchased (Best Buy - $159 US/Carrier Unlocked) and I wanted to document my adventure in to rooting, making '/system' RW, and fixing the missing LED notification light (hint: I used the charging light) (hint^2: It's not required to make '/system' RW in order to fix the LED notification light - I just wanted more control over my phone).

First, "OEM unlocking" was greyed out for me, but became available after several days of having the phone online with a SIM card.

I followed the instructions here to unlock the bootloader and root with Magisk (Non-TWRP). Along with these instructions.

Once bootloader is unlocked, you will need the 'boot.img' file from your stock firmware. I used the "Rescue and Smart Assistant" utility to grab a copy of the stock firmware (GUAMNA_RETAIL_QZAS30.Q4_39_35_9_subsidy_DEFAULT_regulatory_DEFAULT_CFC.xml) and extracted the "boot.img" file for the next steps.

Continue installing Magisk (Filenames may be different! Don't just copy and paste.):
Code:
adb install Magisk-v23.0.apk
adb push boot.img /sdcard/Download
(Follow the instruction on your phone to patch 'boot.img' in Magisk)
adb pull /sdcard/Download/magisk_patched-23000_aKKMt.img
adb reboot bootloader
fastboot flash boot_a magisk_patched-23000_aKKMt.img
fastboot flash boot_b magisk_patched-23000_aKKMt.img

You should now have a working, rooted Moto G Play. You can just stop here and have fun with your phone, but I noticed that even with root, the system partition was not RW.

I followed these instructions to make '/system' writable (Note: you will need the 'sysrw_repair.zip' that's included in the bundle and a Linux system):

Code:
adb push systemrw_1.32_flashable.zip /data/local/tmp/
adb shell
su
cd /data/local/tmp/
unzip systemrw_1.32_flashable.zip
cd systemrw_1.32/
chmod +x systemrw.sh
./systemrw.sh in=`ls -l /dev/block/by-name/super | awk '{print $NF}'` out=/data/local/tmp/systemrw_1.32/img/super_original.bin size=50

The phone doesn't have enough space to complete 'lpmake' on the device and will end with an "Error 73" code. Running the "sysrw_repair_v1.32" tool on a Linux machine was a workaround because it pulls the '*.img" files to your local machine then combines them in to a single '.bin' file. But, before I did that, and because it's really annoying, I made some room to stop the phone from complaining about a lack of space:

(Still on the phone's adb)
Code:
rm ./img/super_original.bin

Now, on the Linux machine, I unzipped 'sysrw_repair_v1.32_proper.zip' then commented out line 39 (where it calls the "flash()" function) of the script (sysrw_repair.sh) because I wanted to flash the "super" partition myself.

(On another Linux terminal)
Code:
cd /path/to/unzipped/sysrw_repair/dir/
chmod +x sysrw_repair.sh
./sysrw_repair.sh

This results in a new folder (img) with a rather large bin file (super_original.bin).

(Back on the phone adb)
Code:
exit # Exit root
exit # Exit adb
adb reboot bootloader

Now it's time to flash the fixed bin file to the "super" partition:

Code:
cd /path/to/unzipped/sysrw_repair/dir/
fastboot flash super ./img/super_original.bin
fastboot reboot

You should be able to login and have a writable '/system':

Code:
adb shell
su
mount -o rw,remount /

No errors should appear.

Last, I like having an LED indicator that tells me that I have an SMS/MMS notification waiting. Motorola thought it would be wise to eliminate that feature altogether instead of having the option to enable it. So, I forced it back on using a startup script that dumps the notifications and greps for some key words. And, if it finds something, it "breaths" the charging LED. The script loops until the notification is gone, then keeps checking for new notifications every 30 seconds. (Note: the "/data/adb/service.d/" directory is used by Magisk like an INIT service):

(Still root on the phones adb)
Code:
cd /data/adb/service.d/
cat <<EOF > ledfix.sh
#!/bin/sh

while true; do
    if dumpsys notification | egrep NotificationRecord | egrep sms > /dev/null
        then
            if [[ $(cat /sys/class/leds/charging/breath) == 0 ]]
                then
                    echo 1 > /sys/class/leds/charging/breath
                    sleep 2
                    continue
            else
                sleep 2
                continue
            fi
    elif egrep 'Charging' /sys/class/power_supply/battery/status > /dev/null
        then
            if [[ $(cat /sys/class/leds/charging/breath) -ne 0 && $(cat /sys/class/leds/charging/brightness) -ne 0 ]]
                then
                    echo 0 > /sys/class/leds/charging/breath
                    echo 255 > /sys/class/leds/charging/brightness
            elif [[ $(cat /sys/class/leds/charging/breath) == 0 && $(cat /sys/class/leds/charging/brightness) == 0 ]]
                then
                    echo 255 > /sys/class/leds/charging/brightness
            else
                continue
            fi
    else
        echo 0 > /sys/class/leds/charging/breath
        echo 0 > /sys/class/leds/charging/brightness
    fi
sleep 30
done
EOF
chown 0.0 ledfix.sh
chmod 0755 ledfix.sh
reboot

Now, the charging light will fade off and on about every 2 seconds if there's an SMS/MMS notification waiting. And will check for notifications every 30 seconds. I'm sure someone can come up with a better way of doing this, but this was a nice quick-and-dirty way to get what I wanted.

Hope this helps!
 
Last edited:

PROFSLM

New member
Oct 18, 2021
1
0
I created an account to say thank you for this, I have already done a good portion, having unlocked the bootloader, the problem is the Rescue Smart Assistant, it won't let me log in, it keeps telling me it can't connect, and the GUI is different because of an update, there is no download button inside the program, only a greyed out rescue button. How did you manage to make the backup Boot.img? Maybe you are using a different OS, and/or version of the program (Not the app, that is already auto-installed), I'm using Windows 10, are you on Linux? I might just need to try from Linux, maybe in a VM.

I was trying to do this before I found this post, and have already installed ADB, the SDK, fastboot, and Motorola Drivers, I just need a way to get the Boot.img, and to patch it, also figure out how to flash it. The last android I rooted with a custom rom was the HTC EVO 4G with Oreo/Jellybean, so I'm a little rusty, but am able to understand technical jargon.

If anyone could help, that would be awesome. I've reinstalled different versions of Rescue Smart Assistant as well, they always upgrade on boot, same problem. I've added exceptions to my firewall and everything.

UPDATE: Was about to post this when I had updated from android 10 to 11 and decided to try logging in again a little closer to my router, to see if the connection was timing out, I think that was the cause, as I can now sign in, and the GUI seems correct from the first appearance. I don't see why I should have any trouble following the rest of the guide, but feel I should share my trials and frustrations anyways, for anyone else experiencing the same,

Thanks again.
 

sd_shadow

Recognized Contributor
Sep 21, 2011
18,279
2
8,809
South Dakota
goo.gl
Motorola Droid X
Essential Phone
I created an account to say thank you for this, I have already done a good portion, having unlocked the bootloader, the problem is the Rescue Smart Assistant, it won't let me log in, it keeps telling me it can't connect, and the GUI is different because of an update, there is no download button inside the program, only a greyed out rescue button. How did you manage to make the backup Boot.img? Maybe you are using a different OS, and/or version of the program (Not the app, that is already auto-installed), I'm using Windows 10, are you on Linux? I might just need to try from Linux, maybe in a VM.

I was trying to do this before I found this post, and have already installed ADB, the SDK, fastboot, and Motorola Drivers, I just need a way to get the Boot.img, and to patch it, also figure out how to flash it. The last android I rooted with a custom rom was the HTC EVO 4G with Oreo/Jellybean, so I'm a little rusty, but am able to understand technical jargon.

If anyone could help, that would be awesome. I've reinstalled different versions of Rescue Smart Assistant as well, they always upgrade on boot, same problem. I've added exceptions to my firewall and everything.

UPDATE: Was about to post this when I had updated from android 10 to 11 and decided to try logging in again a little closer to my router, to see if the connection was timing out, I think that was the cause, as I can now sign in, and the GUI seems correct from the first appearance. I don't see why I should have any trouble following the rest of the guide, but feel I should share my trials and frustrations anyways, for anyone else experiencing the same,

Thanks again.
You can also get the firmware from
Search for Firmware by codename, software channel, Software Version, and build #
 

mario0318

Senior Member
So I wasn't going crazy when I could swear a LED notification light in the upper right side above the screen blinked once whenever I rebooted the phone?

Why would Motorola include such a thing and not utilize it for more than merely a boot up indicator? Like I dont even get to see it come on while charging, it literally only blinks once during boot and that's it.
 

latentspork

New member
Oct 18, 2021
2
4
So I wasn't going crazy when I could swear a LED notification light in the upper right side above the screen blinked once whenever I rebooted the phone?

Why would Motorola include such a thing and not utilize it for more than merely a boot up indicator? Like I dont even get to see it come on while charging, it literally only blinks once during boot and that's it.
I know!

I don't know what triggers that light to come on. I even waited until the battery was at 6% and the light still never came on.

So, I updated the script above to make the light go full brightness if the battery is charging. The order matters, so if a notification comes in while charging, it'll "breath" the LED. Also, if the battery is full, then the light will turn off. Kind of telling you that it's time to unplug.
 
  • Like
Reactions: mario0318

jorduino

New member
Nov 11, 2021
3
0
OnePlus 8T
Moto G Play
I followed these steps and my touch screen stopped working. I had previously installed twrp already on it while trying to learn how to root it, and when i boot into fastboot it goed through twrp, i also used the boot.img file from lolinet, not sure which of these caused the issue. Interestingly though, the touch screen does work whilst in twrp. any suggestions on how to fix or what would be causing it? Phone does work with usb mouse over OTG
 

mario0318

Senior Member
I followed these steps and my touch screen stopped working. I had previously installed twrp already on it while trying to learn how to root it, and when i boot into fastboot it goed through twrp, i also used the boot.img file from lolinet, not sure which of these caused the issue. Interestingly though, the touch screen does work whilst in twrp. any suggestions on how to fix or what would be causing it? Phone does work with usb mouse over OTG
Are you absolutely sure you used the correct boot.img from an image version exactly matching your phone variant version?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    First time posting and I wanted to say thank you to all the excellent talent here on XDA! None of this would have been done without the work of so many people.

    I have a Moto G Play (2021) (XT2093-4) that I recently purchased (Best Buy - $159 US/Carrier Unlocked) and I wanted to document my adventure in to rooting, making '/system' RW, and fixing the missing LED notification light (hint: I used the charging light) (hint^2: It's not required to make '/system' RW in order to fix the LED notification light - I just wanted more control over my phone).

    First, "OEM unlocking" was greyed out for me, but became available after several days of having the phone online with a SIM card.

    I followed the instructions here to unlock the bootloader and root with Magisk (Non-TWRP). Along with these instructions.

    Once bootloader is unlocked, you will need the 'boot.img' file from your stock firmware. I used the "Rescue and Smart Assistant" utility to grab a copy of the stock firmware (GUAMNA_RETAIL_QZAS30.Q4_39_35_9_subsidy_DEFAULT_regulatory_DEFAULT_CFC.xml) and extracted the "boot.img" file for the next steps.

    Continue installing Magisk (Filenames may be different! Don't just copy and paste.):
    Code:
    adb install Magisk-v23.0.apk
    adb push boot.img /sdcard/Download
    (Follow the instruction on your phone to patch 'boot.img' in Magisk)
    adb pull /sdcard/Download/magisk_patched-23000_aKKMt.img
    adb reboot bootloader
    fastboot flash boot_a magisk_patched-23000_aKKMt.img
    fastboot flash boot_b magisk_patched-23000_aKKMt.img

    You should now have a working, rooted Moto G Play. You can just stop here and have fun with your phone, but I noticed that even with root, the system partition was not RW.

    I followed these instructions to make '/system' writable (Note: you will need the 'sysrw_repair.zip' that's included in the bundle and a Linux system):

    Code:
    adb push systemrw_1.32_flashable.zip /data/local/tmp/
    adb shell
    su
    cd /data/local/tmp/
    unzip systemrw_1.32_flashable.zip
    cd systemrw_1.32/
    chmod +x systemrw.sh
    ./systemrw.sh in=`ls -l /dev/block/by-name/super | awk '{print $NF}'` out=/data/local/tmp/systemrw_1.32/img/super_original.bin size=50

    The phone doesn't have enough space to complete 'lpmake' on the device and will end with an "Error 73" code. Running the "sysrw_repair_v1.32" tool on a Linux machine was a workaround because it pulls the '*.img" files to your local machine then combines them in to a single '.bin' file. But, before I did that, and because it's really annoying, I made some room to stop the phone from complaining about a lack of space:

    (Still on the phone's adb)
    Code:
    rm ./img/super_original.bin

    Now, on the Linux machine, I unzipped 'sysrw_repair_v1.32_proper.zip' then commented out line 39 (where it calls the "flash()" function) of the script (sysrw_repair.sh) because I wanted to flash the "super" partition myself.

    (On another Linux terminal)
    Code:
    cd /path/to/unzipped/sysrw_repair/dir/
    chmod +x sysrw_repair.sh
    ./sysrw_repair.sh

    This results in a new folder (img) with a rather large bin file (super_original.bin).

    (Back on the phone adb)
    Code:
    exit # Exit root
    exit # Exit adb
    adb reboot bootloader

    Now it's time to flash the fixed bin file to the "super" partition:

    Code:
    cd /path/to/unzipped/sysrw_repair/dir/
    fastboot flash super ./img/super_original.bin
    fastboot reboot

    You should be able to login and have a writable '/system':

    Code:
    adb shell
    su
    mount -o rw,remount /

    No errors should appear.

    Last, I like having an LED indicator that tells me that I have an SMS/MMS notification waiting. Motorola thought it would be wise to eliminate that feature altogether instead of having the option to enable it. So, I forced it back on using a startup script that dumps the notifications and greps for some key words. And, if it finds something, it "breaths" the charging LED. The script loops until the notification is gone, then keeps checking for new notifications every 30 seconds. (Note: the "/data/adb/service.d/" directory is used by Magisk like an INIT service):

    (Still root on the phones adb)
    Code:
    cd /data/adb/service.d/
    cat <<EOF > ledfix.sh
    #!/bin/sh
    
    while true; do
        if dumpsys notification | egrep NotificationRecord | egrep sms > /dev/null
            then
                if [[ $(cat /sys/class/leds/charging/breath) == 0 ]]
                    then
                        echo 1 > /sys/class/leds/charging/breath
                        sleep 2
                        continue
                else
                    sleep 2
                    continue
                fi
        elif egrep 'Charging' /sys/class/power_supply/battery/status > /dev/null
            then
                if [[ $(cat /sys/class/leds/charging/breath) -ne 0 && $(cat /sys/class/leds/charging/brightness) -ne 0 ]]
                    then
                        echo 0 > /sys/class/leds/charging/breath
                        echo 255 > /sys/class/leds/charging/brightness
                elif [[ $(cat /sys/class/leds/charging/breath) == 0 && $(cat /sys/class/leds/charging/brightness) == 0 ]]
                    then
                        echo 255 > /sys/class/leds/charging/brightness
                else
                    continue
                fi
        else
            echo 0 > /sys/class/leds/charging/breath
            echo 0 > /sys/class/leds/charging/brightness
        fi
    sleep 30
    done
    EOF
    chown 0.0 ledfix.sh
    chmod 0755 ledfix.sh
    reboot

    Now, the charging light will fade off and on about every 2 seconds if there's an SMS/MMS notification waiting. And will check for notifications every 30 seconds. I'm sure someone can come up with a better way of doing this, but this was a nice quick-and-dirty way to get what I wanted.

    Hope this helps!
    2
    I created an account to say thank you for this, I have already done a good portion, having unlocked the bootloader, the problem is the Rescue Smart Assistant, it won't let me log in, it keeps telling me it can't connect, and the GUI is different because of an update, there is no download button inside the program, only a greyed out rescue button. How did you manage to make the backup Boot.img? Maybe you are using a different OS, and/or version of the program (Not the app, that is already auto-installed), I'm using Windows 10, are you on Linux? I might just need to try from Linux, maybe in a VM.

    I was trying to do this before I found this post, and have already installed ADB, the SDK, fastboot, and Motorola Drivers, I just need a way to get the Boot.img, and to patch it, also figure out how to flash it. The last android I rooted with a custom rom was the HTC EVO 4G with Oreo/Jellybean, so I'm a little rusty, but am able to understand technical jargon.

    If anyone could help, that would be awesome. I've reinstalled different versions of Rescue Smart Assistant as well, they always upgrade on boot, same problem. I've added exceptions to my firewall and everything.

    UPDATE: Was about to post this when I had updated from android 10 to 11 and decided to try logging in again a little closer to my router, to see if the connection was timing out, I think that was the cause, as I can now sign in, and the GUI seems correct from the first appearance. I don't see why I should have any trouble following the rest of the guide, but feel I should share my trials and frustrations anyways, for anyone else experiencing the same,

    Thanks again.
    You can also get the firmware from
    Search for Firmware by codename, software channel, Software Version, and build #
    1
    So I wasn't going crazy when I could swear a LED notification light in the upper right side above the screen blinked once whenever I rebooted the phone?

    Why would Motorola include such a thing and not utilize it for more than merely a boot up indicator? Like I dont even get to see it come on while charging, it literally only blinks once during boot and that's it.
    I know!

    I don't know what triggers that light to come on. I even waited until the battery was at 6% and the light still never came on.

    So, I updated the script above to make the light go full brightness if the battery is charging. The order matters, so if a notification comes in while charging, it'll "breath" the LED. Also, if the battery is full, then the light will turn off. Kind of telling you that it's time to unplug.