[Solution] How to Delete Your Android Security PIN & PATTERN - Android Q&A, Help & Troubleshooting

This guide will walk you through deleting your security PIN via several methods. This guide is for those who have forgotten your security PIN and cannot do a Google reset for some reason. Have restored your phone from an old backup that had a different PIN than your current PIN, and now the Android system is completely confused which PIN to use and isn’t accepting any of them.
You should have a custom recovery installed on your phone, or ADB installed on your computer, but that is beyond the scope of this guide as custom recovery installation methods varies by device. Check Appuals for how to install TWRP on your specific device, or how to install ADB on Windows.
There are two situations you may encounter after restoring from a backup that contained a different PIN than the one you are most recently using.
Device Uses Two Different PINs
This will happen when you have a recent boot PIN, and your backup contains an old screen-lock PIN. So now the device will have two different PINs, which may in fact add to overall device security, but be a headache when you need to remember both PINs.
To resolve this you simply need to reset your PIN in the Android settings. Just go to Settings > Security > Screen Lock, and enter a new PIN. It will overwrite the boot PIN and default back to using just one PIN.
The Device Won’t Accept Any PIN
This is where things get frustrating. In certain cases, your phone may accept the boot PIN, but not a screen unlock PIN. For this, we are going to completely delete the files that store your PIN (yes, your PIN is stored in system files that can be deleted – shocking?).
Delete your Android PIN – TWRP Method
Boot your phone into TWRP recovery.
Go to Advanced > File Manager and navigate to /data/system.
Find the files that end in the .key extension and any files that have “locksettings” in the filename. They will typically be (but vary by manufacturer):
Code:
Gatekeeper.password.key
gatekeeper.pattern.key
locksettings.db
locksettings.db-shm
locksettings.db-wal
After you’ve deleted those files, reboot your phone. You will be greeted by a lock screen, but it will not prompt you for any password or PIN. If it does, you did not delete all the necessary files.
Set a new PIN in your security settings!
Delete your Android PIN – ADB Method
Note: This requires a rooted phone and USB debugging enabled. If USB debugging is not enabled and you are locked out of your phone, you need to try and flash a custom recovery such as TWRP, which can also grant an ADB sideloader.
Connect your phone to your computer via USB and launch an ADB terminal.
Type the following commands into the command prompt:
Code:
adb devices
adb shell
cd /data/system
su
rm *.key
rm *.key
adb reboot
Delete your Android PIN – ADB/SQL Method
Note: This is an alternative ADB method for those who have SQLite3 alongside their ADB installation.
Type the following commands into your ADB/SQL terminal:
Code:
adb shell
cd /data/data/com.android.providers.settings/databases
sqlite3 settings.db
update system set value=0 where name=’lock_pattern_autolock’;
update system set value=0 where name=’lockscreen.lockedoutpermanently’;
.quit
Delete your Android PIN – Flashable Pattern Password Disable.Zip Method
Note: This is for those who have a custom recovery (it doesn’t matter which) installed and want to flash a .zip that will do the work for you.
Download the Pattern Password Disable .zip from here and transfer it to your phone’s SD card.
Reboot into your custom recovery of choice.
Flash the zip and reboot your phone.

I have phone that I am and "owner" user. I've created a user accounts for kids. They used fingerprint to unlock the screen for the user account, but then once the phone asked the PIN to "improve" security, but they forget the pin.. of course. It also looks like the phone switched to FBE (file based encryption) with some OS update. Removing locksettings.db makes the phone unbootable, ale also the owner pin disappears. Is there a way how owner can reset the pin for a user?
I have a root also on this device..

Related

Unlock Patter is blocked

Hi all, after many attempts to unlock pattern my phone says:
Please enter your google account and password. I´ve attempt enter my google account and password and don´t work..
What i do now? Any idea?
Try this...
So it happens, that my brother locked me out of my own phone :O and i didnt want to wipe, so i searched and searched, until i found this solution which worked flawlessly
Method 1 :
Step 1. Download the Android SDK (http://developer.android.com/sdk/)
Step 2. Make sure to configure the ADB usb interface drivers
Step 3. Plug your G1 into your computer (via usb). (Settings -> Application -> Development -> USB Debugging, must be enabled [it is enabled by default in JesusFreke/CM's releases i think])
Step 4. Open command prompt and enter the following:
Code:
adb -d shell
sqlite3 data/data/com.android.providers.settings/databases/settings.db
update system set value=0 where name='lock_pattern_autolock';
update system set value=0 where name='lockscreen_lockedoutpermanently';
.exit
exit
reboot
Thats it, you'r gh0od :clap:
Method 2 :
Code:
adb -d shell
su
sqlite3 data/data/com.android.providers.settings/databases/settings.db
.header on
.mode column
select * from system;
Now, in the table, find the ID of the two lines called lockscreen.l and lock_pattern, in my case; 3125 and 3126
Code:
update system set value=0 where _id=(replace with your id and remove brackets);
update system set value=0 where _id=(replace with your id and remove brackets);
.exit
reboot
Click to expand...
Click to collapse
Instructions from a slightly dodgy, copyright infringing site, so I copied and pasted them to avoid linking to warez. If you google search for a small part of it, you'll find the original source.
Obviously instructions to be followed at your own risk, since they are for the G1, but I reckon the G2 would be the same (same underlying android code).
If poss, make a nandroid backup first
anon2122 said:
Try this...
Instructions from a slightly dodgy, copyright infringing site, so I copied and pasted them to avoid linking to warez. If you google search for a small part of it, you'll find the original source.
Obviously instructions to be followed at your own risk, since they are for the G1, but I reckon the G2 would be the same (same underlying android code).
If poss, make a nandroid backup first
Click to expand...
Click to collapse
Thanks to u advanced answer...but i make wipe.

[GUIDE] Access locked AXON 7: How to clear the lockscreen security settings

I have been experimenting with flashing, etc. and somehow the lockscreen were corrupted and the pattern I was using was not longer valid. I had the fingerprint already setup so I could enter using the rear sensor, but having a corrupted lockscreen is annoying. THis method requires TWRP custom recovery. It is compatible with locked bootloaders and doesn't modify the stock boot or system. It is also compatible with all the AAXON 7 models.
If you have the stock ROM and need TWRP and ADB interface:
A. Setup ADB interface in your PC and device drivers. and connect your terminal to the PC.
B. Setup axon7tool in your computer. Enter into EDL mode by running the command "adb reboot edl" in the command prompt. The terminal will seen to be off.
C. Disable the antivirus and then backup your recovery image using axon7tool running "axon7tool -r recovery". Save the created file in a safe place.
D. Flash tenfar's signed TWRP as a new recovery using axon7tool. It will reboot to system again.
E. Open the command prompt and run:
Code:
adb devices
adb reboot recovery
1. In TWRP , and with the ADB interface properly installed run these the commands from your computer:
Code:
adb devices
adb shell mv /data/system/locksettings.db locksettings.db.old
adb reboot
Now the system will allow you to pass lockscreen without security. In that case you do not need to apply the rest of the steps. Should you continue experimenting issues with the lockscreen, then you should apply the full procedure. Just add the following 2 steps:
2. Open the command prompt and run:
Code:
adb devices
adb reboot recovery
3. When TWRP had fully loaded, run in the command prompt the following commands:
Code:
adb devices
adb shell mv /data/system/gatekeeper.pattern.key gatekeeper.pattern.key.old
adb shell mv /data/system/locksettings.db locksettings.db.old
adb shell mv /data/system/gatekeeper.password.key gatekeeper.password.key.old
adb shell mv /data/system/locksettings.db-shm locksettings.db-shm.old
adb shell mv /data/system/locksettings.db-wal locksettings.db-wal.old
adb reboot
If you want to restore the stock recovery, you just need to rename the recovery-backup.bin file created in step C back to recovery.bin and run the command "axon7tool -w recovery". after that you can enable your antivirus software again. axon7tool can't connect with some antivirus software. I will be editing this OP with links to the procedures required for each step. All of them are in this forums.
Enjoy
@Oki
To fix either " Wrong Pattern " , " Wrong Pin " users only need to delete " /data/system/locksettings.db " from either Terminal/File Explorer with root or TWRP File explorer then Reboot and you'll be good to go .
DrakenFX said:
@Oki
To fix either " Wrong Pattern " , " Wrong Pin " users only need to delete " /data/system/locksettings.db " from either Terminal/File Explorer with root or TWRP File explorer then Reboot and you'll be good to go .
Click to expand...
Click to collapse
Sure! but this guide is intended for people with the stock, unrooted, blocked bootloader who want to remain with a pure stock experience. Usually people without experience rooting devices. This is why I will edit the guide to add all the details to every step.
Could I do this with a pin as well? I restored a backup and it corrupted my password and I have to use the fingerprint on the back to get in.
twilighttony said:
Could I do this with a pin as well? I restored a backup and it corrupted my password and I have to use the fingerprint on the back to get in.
Click to expand...
Click to collapse
Yes, the procedure deletes everything. If you have problems just do the same also with:
gatekeeper.password.key
locksettings.db-shm
locksettings.db-wal
I have updated the OP just to describe the full procedure.
I had this problem earlier today of having the PIN corrupted, but I have it set to require the pin on the first boot.
I fixed it by removing all files ending in ".key" in /system. Not really sure how this compares to removing locksettings.db. Afterward, I put my password back using Google's device manager.
Of course, I am rooted with twrp, so this comes after setting that up.
Masterjuggler said:
I had this problem earlier today of having the PIN corrupted, but I have it set to require the pin on the first boot.
I fixed it by removing all files ending in ".key" in /system. Not really sure how this compares to removing locksettings.db. Afterward, I put my password back using Google's device manager.
Of course, I am rooted with twrp, so this comes after setting that up.
Click to expand...
Click to collapse
The problem of this method is that it only works if the bootloader is unlocked and the phone has the No-verify patch installed.
When you say "No-verify patch," are you talking about removing Google license verification from apps (via an app such as lucky-patcher for instance)? AFAIK that is on a per-app basis and wouldn't affect something like the lockscreen password.
So if the phone has those prerequisites (unlocked, No-verify, TWRP), is there a difference between removing the ".key" files and the locksettings.db? I am not entirely sure what the different files contain, and don't seem to be able to find this information through Google, though I may just not be searching the right set of keywords.
Masterjuggler said:
When you say "No-verify patch," are you talking about removing Google license verification from apps (via an app such as lucky-patcher for instance)? AFAIK that is on a per-app basis and wouldn't affect something like the lockscreen password.
So if the phone has those prerequisites (unlocked, No-verify, TWRP), is there a difference between removing the ".key" files and the locksettings.db? I am not entirely sure what the different files contain, and don't seem to be able to find this information through Google, though I may just not be searching the right set of keywords.
Click to expand...
Click to collapse
No-Verify is an additional security system implementend in the kernel. When No-Verify is active, it checks for the signature of the system partition. If the system was modified, then the system won't boot. This is why after unlocking the bootloader you have to apply No-Verify Patch or any package with the integrated patch such as SuperSU. As you can see, it has nothing to do with the app signature or the lockscreen at all.
The method presented in the OP is valid for most Android phones, and the only prerequisite is to have TWRP installed. It is safe and a lot more recommended than patching the system partition. Patching system or kernel should always be your last resort. usually deleting locksettings.db is enough, and it is a general method that works for almost any locking method.
On B25 and have followed all instructions. Seems this method no longer works :/

Respond Programatically to Android Device Manager (ADM)

I have an Android 6.0 px5 head unit which has the lock screen settings disabled in rom. I tried Google's Android Device Manager to lock the unit remotely, and it just gave me a "lock" screen that can be easily bypassed. Problem is, this screen pops up at ever boot, as soon as Google Play services connects to wifi, and it's just plain annoying.
I've researched this and tried a number of things. Because there are no lock settings, the normal way to resolve this, enter the password on the locked device, won't work. I've tried a number of adb solutions (I am rooted on device), including removing the gesture.key file, issuing commands to the settings.db and locksettings.db databases, setting
Code:
ro.secure=0
in default.prop, and issuing the unlock keyevent ("
Code:
input keyevent 82
"). Nothing works. The only thing I have been able to do is create a script that removes the lock screen from the current window (
Code:
dumpsys window | grep mFocusedWindow
) -- but it still stays in the status bar and comes back every boot.
My question is: Does anyone know how I can programatically, from the Linux command line, issue a command back to ADM that either sends an "unlock" code or sends the password it's expecting or somehow responds in the way it needs in order for it to stop trying to lock my device at every boot?

Can adb remove a system file from a non-rooted device?

My unrooted Samsung S7 edge is pattern locked but I also set my fingerprint on it. Since I haven't used the pattern in a while, i forgot what it was but I can still open the phone with my fingerprint.
I read online of using adb to delete a gesture.key file however on mine it is a gatekeeper.pattern.key file and when I try to use adb to delete it, adb says permission denied.
my question: I don't want to root this phone or install a custom recovery. is there any way to remove or reset the pattern without factory resetting my phone? I do not get an option to reset using my gmail account.
Thanks.
If you can still access the phone threw finger print data why are you not able to go into lock screen and security and change pass key or it needs the puzzle and fingerprint to proceed
PoochyXXX
Without root you can pull files with adb, but editing or deleting them is out of the question. I've done what you are wanting to do before, but you have to have root or TWRP.
Sent from my LG-Q710AL using Tapatalk

MIUI Unlocking Bootloader, Flashing Recovery & Rooting Process

First of All, these are my knowledge which was gained through hard reading from XDA Developers Forum, GitHub, reddit, different websites & watching YouTube Videos.​DISCLAIMER: ​Here, I will explain all the process of unlocking Bootloader, Flashing Recovery & Rooting Your Xiaomi Phone, though the general idea is the same, so you can read it from TOP TO BOTTOM because you can use this knowledge FOR ANY ANDROID PHONE GENERALLY. Here, I also explained ALL THE PROBLEMS YOU MIGHT FACE WHILE DOING THIS, AND HOW TO GET OUT OF THOSE PROBLEMS, BECAUSE XDA THREADS AND YOUTUBE VIDEOS DOES NOT ANSWER YOUR PROBLEMS IN ONE THREAD OR IN ONE VIDEO, ONLY WHILE DOING IT, WE FIND THAT, DOING THESE WEREN'T SO EASY LIKE YOUTUBE VIDEOS OR XDA THREADS
AND OF COURSE, DO THESE ON YOUR OWN RISK, IF SOMETHING HAPPENS TO YOUR DEVICE AND YOU BLAME ME, I WILL LMAO AT YOU.
REQUIREMENTS: 1. PC/LAPTOP 2. PENDRIVE WITH OTG CABLE (FOR PRECAUTION, GO TO STEP 4.3 TO LEARN WHY)
Step Number 01: Backup All Your Data:​
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
YOU HAVE BACKUP ALL YOUR DATA, INCLUDING APP DATA, GALLARY PHOTOS, ALL OF THEM BECUASE UNLOCKING BOOTLOADER WILL RESET EVERYTHING, IT WILL START FROM THE MOMENT WHEN YOU BOUGHT YOUR PHONE FIRST & SWITCHED IT ON.
STEPS:​
To Backup All Your Data-
Go to settings "backup and restore" in additional setting (or in MY DEVICE - BACK UP & RESTORE) you can use either mobile or computer backup, both are same, after backing up, transfer it to computer.
Backup your contact from "contacts" (optional, because "step a" includes this)
Then connect your phone with your pc & backup all the necessary files, for example, create a backup of these folders:
DCIM
Download
Pictures
MIUI (Gallery, recorder etc.)
Shareit, vidmate folder
Whatsapp folder (you can also backup it in google, goto SETTINGS - CHATS - CHAT BACKUP)
and others as per your necessity
My process is a manual process, so no app is required.
READ IT: in internet, you will find that you can use rooted app to backup these, like TITANIUM, or take a NANDROID BACKUP (SYSTEM AND APPS) USING TWRP RECOVERY, my boy, listen well, you haven't yet unlocked your bootloader, how can you have a rooted device and twrp recovery? (well you can have a rooted device but that also requires unlocked bootloader which will reset everything on your phone)
Step Number 02: Unlock Your Bootloader​
STEPS:​
Enable developer option by clicking on MIUI version 7 times
from "Additional setting", go to "developer option". there, do these:
enable OEM UNLOCKING
in device unlocking, add your MI account. if shows problem or error, remove your MI account then add it again from device unlocking, (NOT FROM MY DEVICE, ADD ACCOUNT) then, it will take you to main settings, just come back and click add again, it will work in Sha Allah.
now in your pc, download MI Flash Unlock from official MI website, HERE (better to install the latest)
Unzip it, run it using "batch_unlock", add your mi account
in additional settings again, in developer option, enable "USB DEBUGGING"
now in pc, connect your phone in fastboot mood, (swithing off then holding power button and volume down will take you to fastboot mood, there is another process of going to fastboot mood, which is described in step 3)
if your device is recognized IN MIUI UNLOCK TOOL but after connecting it in miui unlock tool, fastboot mood turns of and says "PRESS ANY KEY TO SHUTDOWN" in your phone, you may try swithing to USB port 2 but it didn't work for me. Instead, I ran this bat file code "AS ADMINISTRATOR" from XDA developer forum, you can do it too. I renamed it as "a.bat" first thing to come it my mind. then disconnect USB and connect again in your fastboot mood. Click Refresh in unlock tool.
(OR, IF YOUR DEVICE IS NOT RECOGNIZED IN MIUI UNLOCK TOOL, FOLLOW THESE:
remove MI account from unlock tools and again add, if password shows error even after typing correctly, use phone number and pass to log in, in stead of email and password. Check if device if recognized or not.
If not, try these, Download MIUI Flash Tool and unzip it, run XiaoMiFlash.exe. At the top line, find DRIVER, install all DRIVERS.
IF YOU FACE LOG FILE ERROR,
SOLUTION: JUST CREATE A FOLDER NAMED "log" in the same directory. DONE, YOUR DRIVER WILL BE INSTALLED, CLICK YES EVERY TIME, THEN CONNECT YOUR PHONE WITH MIUI UNLOCK TOOL AND CLICK REFRESH.
your device will be shown in "batch_unlock" in sha Allah. Click unlock. Remember, your phone will loose all data, just full factory reset.
8. after 99% it will show "unlock sign" at the top of your phone, and your phone will reboot, just let it reboot. It will take at best 12 minutes to reboot. Don't worry, seat tight, watch a YouTube Video of Dr. Zakir Naik or Ahmed Deedat Sir <3.​9. setup your phone as if it's a new device. (it is necessary, because after this, we will flash recovery and root your phone, because it is really important to take a backup of your original "PERSIST.IMG" . it is possible for rooted device only. (though it can be done through recovery, but from magisk, it's the best way and safest).​10. you can restore all backup from your pc now. (not necessary, if you want to change ROM)​
Step Number 03: Install ADB (PC) & TWRP RECOVERY (Android)​STEPS:​
download latest SDK from OFFICIAL WEBSITE.
2. name of the download will be "platform-tools_r31.0.2-windows.zip" unzip it in DESKTOP (IMPORTANT). it's name will be "platform-tools", open it. (ADB COMMAND WILL RUN ONLY IN THIS FOLDER.​
ALTERNATIVE ADB: you can also do it by one click adb installer, just install the file, and cmd will work at any position. File is given in the telegram, in my .rar file. But sometimes it shows problem, adb command is not recognized by the windows. then, above platform tools folder is useful as it always works.
3. downlead latest TWRP specific for your device from HERE. website guide: >find your device name> device model> Download Links > click either "Primary (Americas)" or "Primary (Europe)" or you can download them from XDA too (XDA process: search in google "TWRP for MI 9 se (your specific device with model number, not Mi9SE) XDA" then, go to the thread, below you will find GITHUB or any other download link, go there and you can download it from there.​
4. (YOU CAN IGONORE THIS STEP, LET ME KNOW IF YOU FACED ANY PROBLEM, THOUGH YOU SHOULDN'T) rename the twrp file to twrp.img (not necessary though, check if your device extension is hidden or not, if hidden, you will not see any extension after any file, in that case, you can just rename "twrp" because img extention is already there and it's hidden. How to check hidden extention: in that folder, go to view at the top of the screen of that folder, (at beginning - beside cross, minimize then click "view"> click "option" in one row down, at extreme right side of it > click "view"> in downwards, untick "hide extensions for known file type"> click "apply">click "ok" then close it.)​
5. keep the "twrp.img" (the file you downloaded, no need to rename, .img will show depending on unhidden condition) in the "platform tools" folder.​
6. now go to "platform tools" folder. it's better to keep the folder in "desktop". go to the folder address, it is above the "Name, Date Modified, Type, Size" row, where it is written all the folders name that you have clicked to come to this folder. Now, click on the folder address, write "cmd", hit enter.​
7. now connect your phone making sure "USB DEBUGGING IS STILL ON" because after unlocking bootloader, it will automatically be set to OFF.​
write these commands: (after each command hit enter)
adb devices (it will show your device number if it is connected properly, if shows unauthorized, g0 to your phones home screen, disconnect and connect the usb again, in cmd write adb devices, a permission will pop up in your phone at bottom, not in notifications, click YES, your device will be authorized)
adb reboot bootloader (it will take you to fastboot mood instantly)
fastboot devices (it will show your device number it it is connected properly, to make sure it is still connected)
fastboot flash recovery (give space after recovery, then drag the twrp.img file here)
fastboot boot (give space after boot, then drag the twrp.img file here, your phone will boot into recovery.) ALTERNATIVE TO THIS STEP: fastboot reboot (it will reboot, but stop it instanlty by holding "power and volum up button", it is a must, it will take you to twrp manu, if you don't go now, later twrp will be removed by your phone)
AND OF COURSE, YOU HAVE TO ROOT YOUR PHONE RIGHT NOW, EVEN IF YOU DON'T WANT IT, CAUSE IF YOU DON'T, YOUR PHONE WILL REMOVE TWRP AS YOUR RECOVERY.
8. you will see twrp screen, then asking you "to keep system files as read only or swipe to allow modification, tick in DON'T SHOW AGAIN AND SWIPE TO ALLOW MODIFICATION". Then it will ask for a password to decrypt your phone, give the password to decrypt your phone. (to learn about encryption decryption, go to step number 4.3).​
IF YOU FACE BOOTLOOP OR ANY OTHER ISSUE LIKE TWRP RECOVERY IS NOT STARTING AS IT SUPPOSED TO:
Again, go to fastboot mood by pressing power + volume down button. Download this vbmeta file. Go to platform tools > cmd > type
fastboot --disable-verity --disable-verification flash vbmeta (space, then drag the vbmeta file and hit enter, then follow step number 3.7
(3 is step number, 7 is the point number under step number 3)
Step Number 04: Install Magisk​STEPS:
1. you should stay in TWRP manu from the last step of STEP NUMBER 3 and your phone is connected with your computer via USB.​
2. In your computer, download MAGISK FROM OFFICIAL GITHUB PAGE . Copy the magisk.apk and paste it twice in the same folder, now you have three magisk apk, rename the second one removing the "copy from name and just add .zip in stead of .apk at last. Rename the third one as this: "uninstaller.zip"​
3. Now listen carefully, this is very important part of this topic:​
your phone has two state: a. encrypted b. decrypted
a. IF ENCRYPTED AND CAN'T BE DECRYPTED THROUGH TWRP, that is TWRP IS NOT ASKING PASSWORD AT THE BEGINNING TO DECRYPT YOUR PHONE, THEN: some china rom's security is so encrypted, LIKE MY MI9SE, THAT TWRP CAN'T DECRYPT IT, EVERYTIME I HAVE TO RESET THE PHONE TO DECRYPT, IN THIS CASE ,YOU CAN'T ACCESS YOUR PHONE'S INTERNAL STORAGE NEITHER FROM TWRP NOR FROM PC (TWRP ACTS AS MTP, MEDIA TRANSFER PROTOCOL, MEANING YOU CAN TRANSFER FILE BETWEEN PHONE AND ANDROID IN RECOVERY MOOD), SO YOU CAN'T ACCESS YOUR INTERNAL STORAGE, YOU CAN'T INSTALL MAGISK. HERE, PENDRIVE WITH OTG COMES HANDY. Disconnect your phone Keep those three files in pendrive and connect it in OTG with your phone. go to twrp > install > select storage at bottom > select pendrive > select magisk.zip > swipe to flash. CONGRATULATIONS, YOUR PHONE IS ROOTED.​
b. IF YOUR PHONE IS DECRYPTED BY TWRP AFTER GIVING PASSWORD:​
Copy those three magisk file from your computer and drop it in your phones internal storage. go to twrp > install > select magisk.zip > swipe to flash. CONGRATULATIONS, YOUR PHONE IS ROOTED.
4. Reboot Your Phone (If your phone is bootlooped, which never happened to anyone I know, still for safety, again go to recovery by holding POWER + VOLUME UP BUTTON. go to twrp > install > select uninstaller.zip > swipe to flash. This will uninstall magisk from your phone and then reboot to system, your phone will reboot normally)​
5. A Magisk app will be shown among your apps which is not like magisk logo. Don't touch it, Goto file manager, find those three magisk files, one file is the original magisk.apk file you downloaded, install it normally like any other app.​
6. CONGRATULATIONS, YOUR PHONE IS COMPLETELY ROOTED.​
Step Number 05: Backing up your PERSIST.IMG (MOST IMPORTANT)​STEPS:
You will know from my other threads about what is persist partition of your phone. But let's just back it up now without knowing it. Copy it to your computer, cloud so that you never loose it.
Assuming you still have your phone connected through usb to the computer.
Install TERMUX from playstore or from HERE if you don't have play store.
in termux, type su to obtain root permission. A pop up will be shown to grant root permission, if it doesn't work, leave termux app, go to magisk app, at bottom, you will be 4 options, click the second one, you will see this screen.
grant super user permission for termux from here.
4. again go to termux, type this:
su (hit enter)
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img (hit enter)
5. your persist.img is backed up in your internal storage.
6. you can transfer it to pc manually or
use this process because it is relatively safe, though I never found any difference,
go to platform tools in cmd, type this:
adb pull /sdcard/persist.img D:\
it will take around 10 seconds, you will find the file persist.img in your PC's D drive folder, whatever the name is, the next folder to C drive, okay? Copy the persist.img wherever you want to keep it. I am again saying, it's not mandatory to do it in this way, just do normal copy paste from your phone's internal storage to your PC, it will do the work.
THANK YOU GUYS FOR READING IT ATTENTIVELY, FROM TOP TO BOTTOM, AND IF YOU DIDN'T, WHAT CAN I SAY. IT TOOK MORE THAN 30 DAYS TO ACQUIRE ALL THESE KNOWLEDGE AND YOU ARE GETTING IT WITHOUT ANY EFFORT, FREE, WHAT MORE DO YOU WANT?
My Other Threads according to "how should you read them" serial:
1. MIUI 12.5 Chinese ROM Google PlayStore Stopped Working
2. MIUI Unlocking Bootloader, Flashing Recovery & Rooting Process (This Thread)
3. Android Terminology You Must Know Before Toying with Your Android
4. ROM Naming & CUSTOM ROM, AOSP ROM, TREBLE ROM, GSI ROM, PORTED ROM
shafi1885 said:
First of All, these are my knowledge which was gained through hard reading from XDA Developers Forum, GitHub, reddit, different websites & watching YouTube Videos.​DISCLAIMER: ​Here, I will explain all the process of unlocking Bootloader, Flashing Recovery & Rooting Your Xiaomi Phone, though the general idea is the same, so you can read it from TOP TO BOTTOM because you can use this knowledge FOR ANY ANDROID PHONE GENERALLY. Here, I also explained ALL THE PROBLEMS YOU MIGHT FACE WHILE DOING THIS, AND HOW TO GET OUT OF THOSE PROBLEMS, BECAUSE XDA THREADS AND YOUTUBE VIDEOS DOES NOT ANSWER YOUR PROBLEMS IN ONE THREAD OR IN ONE VIDEO, ONLY WHILE DOING IT, WE FIND THAT, DOING THESE WEREN'T SO EASY LIKE YOUTUBE VIDEOS OR XDA THREADS
AND OF COURSE, DO THESE ON YOUR OWN RISK, IF SOMETHING HAPPENS TO YOUR DEVICE AND YOU BLAME ME, I WILL LMAO AT YOU.
REQUIREMENTS: 1. PC/LAPTOP 2. PENDRIVE WITH OTG CABLE (FOR PRECAUTION, GO TO STEP 4.3 TO LEARN WHY)
Step Number 01: Backup All Your Data:​
YOU HAVE BACKUP ALL YOUR DATA, INCLUDING APP DATA, GALLARY PHOTOS, ALL OF THEM BECUASE UNLOCKING BOOTLOADER WILL RESET EVERYTHING, IT WILL START FROM THE MOMENT WHEN YOU BOUGHT YOUR PHONE FIRST & SWITCHED IT ON.
STEPS:​
To Backup All Your Data-
Go to settings "backup and restore" in additional setting (or in MY DEVICE - BACK UP & RESTORE) you can use either mobile or computer backup, both are same, after backing up, transfer it to computer.
Backup your contact from "contacts" (optional, because "step a" includes this)
Then connect your phone with your pc & backup all the necessary files, for example, create a backup of these folders:
DCIM
Download
Pictures
MIUI (Gallery, recorder etc.)
Shareit, vidmate folder
Whatsapp folder (you can also backup it in google, goto SETTINGS - CHATS - CHAT BACKUP)
and others as per your necessity
My process is a manual process, so no app is required.
READ IT: in internet, you will find that you can use rooted app to backup these, like TITANIUM, or take a NANDROID BACKUP (SYSTEM AND APPS) USING TWRP RECOVERY, my boy, listen well, you haven't yet unlocked your bootloader, how can you have a rooted device and twrp recovery? (well you can have a rooted device but that also requires unlocked bootloader which will reset everything on your phone)
Step Number 02: Unlock Your Bootloader​
STEPS:​
Enable developer option by clicking on MIUI version 7 times
from "Additional setting", go to "developer option". there, do these:
enable OEM UNLOCKING
in device unlocking, add your MI account. if shows problem or error, remove your MI account then add it again from device unlocking, (NOT FROM MY DEVICE, ADD ACCOUNT) then, it will take you to main settings, just come back and click add again, it will work in Sha Allah.
now in your pc, download MI Flash Unlock from official MI website, HERE (better to install the latest)
Unzip it, run it using "batch_unlock", add your mi account
in additional settings again, in developer option, enable "USB DEBUGGING"
now in pc, connect your phone in fastboot mood, (swithing off then holding power button and volume down will take you to fastboot mood, there is another process of going to fastboot mood, which is described in step 3)
if your device is recognized IN MIUI UNLOCK TOOL but after connecting it in miui unlock tool, fastboot mood turns of and says "PRESS ANY KEY TO SHUTDOWN" in your phone, you may try swithing to USB port 2 but it didn't work for me. Instead, I ran this bat file code "AS ADMINISTRATOR" from XDA developer forum, you can do it too. I renamed it as "a.bat" first thing to come it my mind. then disconnect USB and connect again in your fastboot mood. Click Refresh in unlock tool.
(OR, IF YOUR DEVICE IS NOT RECOGNIZED IN MIUI UNLOCK TOOL, FOLLOW THESE:
remove MI account from unlock tools and again add, if password shows error even after typing correctly, use phone number and pass to log in, in stead of email and password. Check if device if recognized or not.
If not, try these, Download MIUI Flash Tool and unzip it, run XiaoMiFlash.exe. At the top line, find DRIVER, install all DRIVERS.
IF YOU FACE LOG FILE ERROR,
SOLUTION: JUST CREATE A FOLDER NAMED "log" in the same directory. DONE, YOUR DRIVER WILL BE INSTALLED, CLICK YES EVERY TIME, THEN CONNECT YOUR PHONE WITH MIUI UNLOCK TOOL AND CLICK REFRESH.
your device will be shown in "batch_unlock" in sha Allah. Click unlock. Remember, your phone will loose all data, just full factory reset.
8. after 99% it will show "unlock sign" at the top of your phone, and your phone will reboot, just let it reboot. It will take at best 12 minutes to reboot. Don't worry, seat tight, watch a YouTube Video of Dr. Zakir Naik or Ahmed Deedat Sir <3.​9. setup your phone as if it's a new device. (it is necessary, because after this, we will flash recovery and root your phone, because it is really important to take a backup of your original "PERSIST.IMG" . it is possible for rooted device only. (though it can be done through recovery, but from magisk, it's the best way and safest).​10. you can restore all backup from your pc now. (not necessary, if you want to change ROM)​
Step Number 03: Install ADB (PC) & TWRP RECOVERY (Android)​STEPS:​
download latest SDK from OFFICIAL WEBSITE.
2. name of the download will be "platform-tools_r31.0.2-windows.zip" unzip it in DESKTOP (IMPORTANT). it's name will be "platform-tools", open it. (ADB COMMAND WILL RUN ONLY IN THIS FOLDER.​
ALTERNATIVE ADB: you can also do it by one click adb installer, just install the file, and cmd will work at any position. File is given in the telegram, in my .rar file. But sometimes it shows problem, adb command is not recognized by the windows. then, above platform tools folder is useful as it always works.
3. downlead latest TWRP specific for your device from HERE. website guide: >find your device name> device model> Download Links > click either "Primary (Americas)" or "Primary (Europe)" or you can download them from XDA too (XDA process: search in google "TWRP for MI 9 se (your specific device with model number, not Mi9SE) XDA" then, go to the thread, below you will find GITHUB or any other download link, go there and you can download it from there.​
4. (YOU CAN IGONORE THIS STEP, LET ME KNOW IF YOU FACED ANY PROBLEM, THOUGH YOU SHOULDN'T) rename the twrp file to twrp.img (not necessary though, check if your device extension is hidden or not, if hidden, you will not see any extension after any file, in that case, you can just rename "twrp" because img extention is already there and it's hidden. How to check hidden extention: in that folder, go to view at the top of the screen of that folder, (at beginning - beside cross, minimize then click "view"> click "option" in one row down, at extreme right side of it > click "view"> in downwards, untick "hide extensions for known file type"> click "apply">click "ok" then close it.)​
5. keep the "twrp.img" (the file you downloaded, no need to rename, .img will show depending on unhidden condition) in the "platform tools" folder.​
6. now go to "platform tools" folder. it's better to keep the folder in "desktop". go to the folder address, it is above the "Name, Date Modified, Type, Size" row, where it is written all the folders name that you have clicked to come to this folder. Now, click on the folder address, write "cmd", hit enter.​
7. now connect your phone making sure "USB DEBUGGING IS STILL ON" because after unlocking bootloader, it will automatically be set to OFF.​
write these commands: (after each command hit enter)
adb devices (it will show your device number if it is connected properly, if shows unauthorized, g0 to your phones home screen, disconnect and connect the usb again, in cmd write adb devices, a permission will pop up in your phone at bottom, not in notifications, click YES, your device will be authorized)
adb reboot bootloader (it will take you to fastboot mood instantly)
fastboot devices (it will show your device number it it is connected properly, to make sure it is still connected)
fastboot flash recovery (give space after recovery, then drag the twrp.img file here)
fastboot boot (give space after boot, then drag the twrp.img file here, your phone will boot into recovery.) ALTERNATIVE TO THIS STEP: fastboot reboot (it will reboot, but stop it instanlty by holding "power and volum up button", it is a must, it will take you to twrp manu, if you don't go now, later twrp will be removed by your phone)
AND OF COURSE, YOU HAVE TO ROOT YOUR PHONE RIGHT NOW, EVEN IF YOU DON'T WANT IT, CAUSE IF YOU DON'T, YOUR PHONE WILL REMOVE TWRP AS YOUR RECOVERY.
8. you will see twrp screen, then asking you "to keep system files as read only or swipe to allow modification, tick in DON'T SHOW AGAIN AND SWIPE TO ALLOW MODIFICATION". Then it will ask for a password to decrypt your phone, give the password to decrypt your phone. (to learn about encryption decryption, go to step number 4.3).​
IF YOU FACE BOOTLOOP OR ANY OTHER ISSUE LIKE TWRP RECOVERY IS NOT STARTING AS IT SUPPOSED TO:
Again, go to fastboot mood by pressing power + volume down button. Download this vbmeta file. Go to platform tools > cmd > type
fastboot --disable-verity --disable-verification flash vbmeta (space, then drag the vbmeta file and hit enter, then follow step number 3.7
(3 is step number, 7 is the point number under step number 3)
Step Number 04: Install Magisk​STEPS:
1. you should stay in TWRP manu from the last step of STEP NUMBER 3 and your phone is connected with your computer via USB.​
2. In your computer, download MAGISK FROM OFFICIAL GITHUB PAGE . Copy the magisk.apk and paste it twice in the same folder, now you have three magisk apk, rename the second one removing the "copy from name and just add .zip in stead of .apk at last. Rename the third one as this: "uninstaller.zip"​
3. Now listen carefully, this is very important part of this topic:​
your phone has two state: a. encrypted b. decrypted
a. IF ENCRYPTED AND CAN'T BE DECRYPTED THROUGH TWRP, that is TWRP IS NOT ASKING PASSWORD AT THE BEGINNING TO DECRYPT YOUR PHONE, THEN: some china rom's security is so encrypted, LIKE MY MI9SE, THAT TWRP CAN'T DECRYPT IT, EVERYTIME I HAVE TO RESET THE PHONE TO DECRYPT, IN THIS CASE ,YOU CAN'T ACCESS YOUR PHONE'S INTERNAL STORAGE NEITHER FROM TWRP NOR FROM PC (TWRP ACTS AS MTP, MEDIA TRANSFER PROTOCOL, MEANING YOU CAN TRANSFER FILE BETWEEN PHONE AND ANDROID IN RECOVERY MOOD), SO YOU CAN'T ACCESS YOUR INTERNAL STORAGE, YOU CAN'T INSTALL MAGISK. HERE, PENDRIVE WITH OTG COMES HANDY. Disconnect your phone Keep those three files in pendrive and connect it in OTG with your phone. go to twrp > install > select storage at bottom > select pendrive > select magisk.zip > swipe to flash. CONGRATULATIONS, YOUR PHONE IS ROOTED.​
b. IF YOUR PHONE IS DECRYPTED BY TWRP AFTER GIVING PASSWORD:​
Copy those three magisk file from your computer and drop it in your phones internal storage. go to twrp > install > select magisk.zip > swipe to flash. CONGRATULATIONS, YOUR PHONE IS ROOTED.
4. Reboot Your Phone (If your phone is bootlooped, which never happened to anyone I know, still for safety, again go to recovery by holding POWER + VOLUME UP BUTTON. go to twrp > install > select uninstaller.zip > swipe to flash. This will uninstall magisk from your phone and then reboot to system, your phone will reboot normally)​
5. A Magisk app will be shown among your apps which is not like magisk logo. Don't touch it, Goto file manager, find those three magisk files, one file is the original magisk.apk file you downloaded, install it normally like any other app.​
6. CONGRATULATIONS, YOUR PHONE IS COMPLETELY ROOTED.​
Step Number 05: Backing up your PERSIST.IMG (MOST IMPORTANT)​STEPS:
You will know from my other threads about what is persist partition of your phone. But let's just back it up now without knowing it. Copy it to your computer, cloud so that you never loose it.
Assuming you still have your phone connected through usb to the computer.
Install TERMUX from playstore or from HERE if you don't have play store.
in termux, type su to obtain root permission. A pop up will be shown to grant root permission, if it doesn't work, leave termux app, go to magisk app, at bottom, you will be 4 options, click the second one, you will see this screen.
grant super user permission for termux from here.
4. again go to termux, type this:
su (hit enter)
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img (hit enter)
5. your persist.img is backed up in your internal storage.
6. you can transfer it to pc manually or
use this process because it is relatively safe, though I never found any difference,
go to platform tools in cmd, type this:
adb pull /sdcard/persist.img D:\
it will take around 10 seconds, you will find the file persist.img in your PC's D drive folder, whatever the name is, the next folder to C drive, okay? Copy the persist.img wherever you want to keep it. I am again saying, it's not mandatory to do it in this way, just do normal copy paste from your phone's internal storage to your PC, it will do the work.
THANK YOU GUYS FOR READING IT ATTENTIVELY, FROM TOP TO BOTTOM, AND IF YOU DIDN'T, WHAT CAN I SAY. IT TOOK MORE THAN 30 DAYS TO ACQUIRE ALL THESE KNOWLEDGE AND YOU ARE GETTING IT WITHOUT ANY EFFORT, FREE, WHAT MORE DO YOU WANT?
My Other Threads according to "how should you read them" serial:
1. MIUI 12.5 Chinese ROM Google PlayStore Stopped Working
2. MIUI Unlocking Bootloader, Flashing Recovery & Rooting Process (This Thread)
3. Android Terminology You Must Know Before Toying with Your Android
4. ROM Naming & CUSTOM ROM, AOSP ROM, TREBLE ROM, GSI ROM, PORTED ROM
Click to expand...
Click to collapse
I have redmi k40 bootloader locked and stuck on fastboot mode and can't unlock it through mi unlock tool so any solution for that problem beside edl ? And if I go with edl which flashing tool i will use ??
Hussein Gbr said:
I have redmi k40 bootloader locked and stuck on fastboot mode and can't unlock it through mi unlock tool so any solution for that problem beside edl ? And if I go with edl which flashing tool i will use ??
Click to expand...
Click to collapse
have you flashed any rom? or flashed anything? if you haven't, just restart your phn using power button. and if you have flashed anything already, how on earth you did it without unlocking your bootloader?
shafi1885 said:
have you flashed any rom? or flashed anything? if you haven't, just restart your phn using power button. and if you have flashed anything already, how on earth you did it without unlocking your bootloader?
Click to expand...
Click to collapse
My bootloader was unlocked but when i try to use mi flash tool by mistake or by default flash and lock bootloader option with there and the flash didnt go through in last second
Is there a way to unlock the phone if it only turns on in fastboot mode and is not associated with a xiaomi account?
Hello there, I would like to contribute to this tutorial if you agree
There is a way for people that have encrypted storage and no usb otg pendrive:
Step 4.3:
a-alternative. If encrypted, but no OTG Pendrive at your disposal:
You still can use the adb push command to send your Magisk folder into a decrypted part of your phone’s root folder. You are going to use your phone “/tmp” folder.
“/tmp” folder is suitable for temporary files just as our files (We will not need these files anymore after this tutorial). There is no risk to add files into this folder while it is not encrypted but do not delete any files already present into your /tmp folder!
1.Copy your Magisk folder containing your three Magisk files into the Plateform-tool folder:
2.Then in the cmd execute: adb push [replace_brackets_by_your_Magisk_folder_address_location] /tmp
3.Your Magisk folder should be now copied into your /tmp folder
4.twrp > install > select tmp/magisk.zip > swipe to flash. CONGRATULATIONS, YOUR PHONE IS ROOTED.
4.5-alternative. (This step only for those that processed through the “a-alternative” step) After rebooting your phone, you might have no chance to access the Magisk folder you’ve pushed earlier into the /tmp folder. However, now you have booted into your MIUI usual OS, you can copy the Magisk folder again into your internal storage using the classical drag and drop thanks to MTP protocol, to continue through this tutorial.
Hope this will help

Categories

Resources