Have you forgotten the password for your Androidsmartphone, and USB debugging was disabled? Or is the device stuck at the logo after an unsuccessful update, and the only way to save the data is to connect via ADB? In such cases, standard methods for activating developer mode are not available, but there is a way out: enable debugging via USB debugging recovery (recovery mode).
This method works even on completely locked devices where it is impossible to enter the settings. We will analyze step-by-step guide for Samsung, Xiaomi, Huawei and other popular brands, explain what tools you will need, and warn about possible risks. Important: the method requires the presence of custom recovery (for example, TWRP) or access to stock recovery with support ADB sideload. If you have a standard recovery without additional functions, read alternative solutions at the end of the article.
Why standard methods of enabling debugging do not work
Under normal conditions USB debugging activated through the menu Settings โ About phone โ Build number (7 taps) and further in Developer options. But if:
- ๐ The screen is locked with a password, pattern or fingerprint;
- ๐ฑ The device does not boot beyond the logo (bootloop);
- ๐ The settings have been reset and debugging is disabled automatically;
- ๐ ๏ธ The smartphone is โbrickedโ after the firmware,
โthen the standard path is not available. This is where recovery comes to the rescue - an alternative boot mode that allows you to control the device at a low level. However, not all recoveries support the necessary functions. For example, stock recovery from Samsung or Huawei is often limited to basic options like resetting data.
Key difference custom recovery (for example, TWRP or OrangeFox) - the presence of a terminal ADB, the ability to mount partitions and edit system files. It is through them that you can manually enter debugging parameters in a file build.prop or download a modified one settings.db.
What you will need to enable debugging through recovery
Before you start, prepare:
- ๐ฅ๏ธ Computer with Windows, Linux or macOS;
- ๐ Cable USB Type-C/Micro-USB (original, without damage!);
- ๐ฆ Installed drivers
ADBiFastboot(you can download from official Android website); - ๐ฑ Unlocked bootloader (bootloader) - for most brands, except Xiaomi and some models Samsung;
- ๐ ๏ธ Custom recovery (for example, TWRP) - if the stock recovery does not support
ADB.
If you have a stock recovery, check if it contains the item Apply update from ADB or ADB sideload. On some devices (for example Google Pixel or OnePlus) this option is present by default. For the rest, you will need to first install TWRP.
โ ๏ธ Attention: On devices with a locked bootloader (for example, Huawei or Sony), installation custom recovery is impossible without unlocking. This will lead to a complete data reset!
Also prepare:
- ๐ A backup copy of important data (if the device somehow turns on);
- ๐ Battery charge at least 50% - to avoid sudden shutdown;
- ๐ Information about the device model and version Android (can be found through
fastboot getvar all).
Install ADB and Fastboot on the PC|
Download the firmware or modified settings.db (if required)|
Check for custom recovery|
Disable the antivirus (it can block ADB)|
Connect the phone to the PC and make sure that it is detected in Device Manager-->
Step-by-step guide for devices with TWRP
If your smartphone has TWRP or another custom recovery supported ADB, follow these steps:
Turn off the device. data-i="109">(or on older models); mount the partition).
- ๐ฑ Samsung:
Power + Volume Up + Bixby(orHomeon older models); - ๐ฑ Xiaomi/Redmi:
Power + Volume Up; - ๐ฑ Google Pixel/OnePlus:
Power + Volume Down, then select itemRecovery Mode.
- ๐ฑ Samsung:
On the menu TWRP select Advanced โ File Manager (or Mount โ System, if you need to mount the partition).
Navigate to the path /data/data/com.android.providers.settings/databases/ and find the file settings.db. Make a backup copy of it (copy it to an SD card or PC via ADB pull).
Open the file settings.db in any editor SQLite (for example, DB Browser for SQLite). Find the table secure and add the line:
INSERT INTO secure (name, value) VALUES ('adbd', '1');
If the line already exists, change its value to 1.
Save the file and return it to the device, replacing the original. Reboot into the system.
After the reboot USB debugging will be enabled automatically. Connect the device to the PC and check availability with the command:
adb devices
โ ๏ธ Attention: On some firmware (for example, MIUI or EMUI), after such manipulations the protection may workAnti-Rollback, which will lead to blocking of the device Before editingsettings.dbMake sure the firmware version is compatible!
If editing settings.db seems difficult, you can use a ready-made modified file for your model. They are often posted on forums like XDA Developers or 4PDA.
Alternative method: editing build.prop
If access to settings.db is impossible (for example, due to partition encryption /data), you can try enabling debugging via file build.prop. This method is less reliable, but sometimes. works on older versions Android (up to 9.0).
In TWRP go to
Mount โ System(if the partition is not mounted).Open the file
/system/build.propin a text editor ( TWRP has a built-in editor).Add the following lines to the end of the file:
persist.service.adb.enable=1persist.service.debuggable=1
persist.sys.usb.config=mtp,adbSave the changes and reboot the device.
After reboot, check if the device appears in the list adb devices. If not, return to the method with settings.db.
| Method | Requires root | Works on encrypted /data | Risk of failure |
|---|---|---|---|
Editing settings.db |
No | No (requires access to /data) | Medium (may break settings) |
Change build.prop |
No | Yes | Low (but ineffective on new Androids) |
| Installing Magisk (ADB module) | Yes | Yes | High (requires unlocking the bootloader) |
Features for different brands
The process of enabling debugging through recovery may vary depending on the manufacturer. Let's consider the nuances for popular brands:
Xiaomi/Redmi/POCO
On devices with MIUI protection Anti-Rollbackis often used, which blocks changes to settings.db. Alternative method:
- Install TWRP for your model (for example, through
fastboot flash recovery twrp.img). - In recovery, select
Mount โ Dataand format the partition (this will delete all data!). - Download modified
settings.dbfor MIUI (search on 4PDA according to the device model) and replace the original file with it.
Samsung
On most devices Samsung stock recovery does not support ADB. Solution:
- ๐ง Install TWRP via
Odin(requires an unlocked bootloader). - ๐ Use the method with
build.prop, like this how/dataon Samsung is often encrypted.
Huawei/Honor
Devices Huawei s Kirin-processors have a closed bootloader. If it is locked:
- ๐ Unlock the bootloader through the official service Huawei (unlock code required).
- ๐ฅ Install TWRP for Kirindevices (for example, OrangeFox).
- ๐ ๏ธ Use the method with
settings.db, but be prepared to reset the data.
โ ๏ธ Attention: On devices Huawei with EMUI 10+ and newer editingsettings.dbcan lead to activationeRecoveryand a forced reset!
Frequent errors and how to avoid them
When enabling debugging through recovery, users often encounter the following problems:
- ๐ซ The device is not detected in
adb devices:Check the drivers, try a different cable or USB port. On Windows sometimes installing drivers manually through
Device Manager helps. - ๐ Cannot mount
/data:If the partition is encrypted, try entering the password in TWRP (item
Mount โ Data โ Decrypt Data). On some firmware this is not possible - you will have to format/data(data loss!). - ๐ After the changes, the device froze:
Return to recovery and undo the edits in
build.proporsettings.db. If the system does not boot, reset viaWipe โ Factory Reset. - ๐ก๏ธ Protection triggered
Anti-Rollback:On Xiaomi this leads to blocking of the device. The only solution is to flash the official firmware via Mi Flash Tool with clearing all data.
On devices with Android 12+ and higher, editing settings.db can lead to resetting all settings during the next system update. Scoped Storage.
What to do if nothing helps?
If none of the methods worked, radical measures remain:
1. Flash the modified firmware with debugging already enabled (search on thematic forums).
2. Use exploits like DirtyCOW (works on Android 7-10, but requires technical skills).
3. Contact the service center โsome workshops can enable debugging via JTAG or ISP, but it is expensive (from 3,000 rubles).
Security: risks and how to minimize them
Enabling USB debugging via recovery is a powerful tool, but it is fraught dangers:
- ๐ต๏ธ Attack vulnerabilities: If debugging is enabled, an attacker with physical access to the device can steal data via
ADB. - ๐ง Violation of system integrity: Improper editing
build.proporsettings.dbcan lead tobootloop. - ๐ต Loss guarantees: Unlocking the bootloader and installation custom recovery void the warranty of most brands.
How to reduce risks:
- ๐ After solving the problem disable debugging with the command:
adb shell settings put global adb_debug 0 - ๐ฑ Set a strong password on the device and turn it on encryption.
- ๐ก๏ธ Use Magisk to hide the root status from applications (if installed TWRP).
โ ๏ธ Attention: On devices with Samsung Knox (for example, Galaxy S/Note) any manipulations with the recovery lead to flag trigger Knox 0x1which blocks operation of Samsung Pay, Secure Folder and other functions.
FAQ: Answers to frequently asked questions
Is it possible to enable debugging through recovery without TWRP?
Yes, but only if the stock recovery supports it. ADB sideload. For example, on Google Pixel or OnePlus you can load a modified settings.db via the command:
adb sideload settings.db
However, this will only work if the partition /data is not encrypted.
Why after editing settings.db, debugging does not turn on?
Probable reasons:
- The file
settings.dbwas damaged during editing; - The system ignores changes due to protection
SELinux(try to temporarily disable it with the commandsetenforce 0); - The firmware uses an alternative mechanism for storing settings (for example,
shared_prefsv Android 10+).
How to enable debugging on a locked one iPhone?
On iOS no analog ADB or recovery. The only way is to use vulnerabilities like checkm8 (for chips A5-A11), but this requires soldering work and specialized equipment.
Is it possible to enable debugging via Fastboot?
No, Fastboot does not provide access to system settings. However, you can flash it through custom recoveryand then enable debugging.
What to do if the device does not turn on after the changes?
Follow the following steps:
- Boot into recovery (TWRP or stock).
- Delete or return original files
build.propandsettings.db. - Run
Wipe โ Factory Reset(if you are not afraid to lose data). - Flash the stock firmware via
Fastbootor Odin (for Samsung).
If your device does not have custom recovery and is locked, the only reliable way to enable debugging is to contact a service center. Independent attempts on stock recovery most often end in a complete data reset.