How to Root Sony Phones: A Comprehensive Guide
In this article
Rooting a Sony phone is not possible through a single app or a simple toggle; it requires unlocking the bootloader, patching the boot image, and flashing it via a computer. This process grants you administrative access (root) to the Android file system, allowing you to remove pre-installed bloatware, install custom kernels for better battery life, and use advanced system-level apps. However, because Sony employs strict security measures, this process varies significantly depending on whether your specific model's bootloader is unlockable or permanently locked.
What You'll Need
- A Windows PC or macOS computer with a stable USB connection.
- The original USB cable that came with your phone (or a high-quality data cable).
- A full backup of all personal data, as unlocking the bootloader triggers a mandatory factory reset.
- The official Sony bootloader unlock code for your specific IMEI.
- ADB (Android Debug Bridge) and Fastboot tools installed on your computer.
- A copy of the current stock firmware (ROM) that matches your phone's build number exactly.
- The Magisk app (official version) installed on your phone for patching the boot image.
- At least 60% battery charge to prevent the device from shutting down during flashing.
Step-by-Step
- Verify Bootloader Unlockability: Before proceeding, you must check if your device is unlockable. Visit the official Sony unlock portal and enter your IMEI. If the portal states that the bootloader cannot be unlocked for your specific model or carrier variant, you cannot proceed with this method. Labels and menu options may differ slightly depending on your Android version or region.
- Enable Developer Options: On your Sony phone, go to Settings > About Phone. Scroll down to the Build Number and tap it seven times until a notification appears saying you are now a developer.
- Activate USB Debugging and OEM Unlocking: Return to the main Settings menu and go to System > Developer Options. Find the toggle for USB Debugging and turn it on. Then, find the OEM Unlocking toggle and enable it. If the OEM Unlocking toggle is greyed out, your device may be carrier-locked.
- Request the Unlock Code: Enter your IMEI on the Sony unlock website. If eligible, Sony will provide a unique alphanumeric unlock code. Copy this code and save it in a text file on your computer.
- Boot into Fastboot Mode: Power off your device completely. Hold the Volume Down button and connect the phone to your computer via USB. The LED indicator should turn blue, indicating the device is in Fastboot mode.
- Unlock the Bootloader: Open a command prompt or terminal on your computer. Type (replacing the bracketed part with your actual code) and press Enter. The phone will wipe all data and reboot.
- Extract the Boot Image: Download the stock firmware for your exact build number. Use a firmware extraction tool to locate the
boot.imgfile within the firmware package. Transfer thisboot.imgfile to your phone's internal storage. - Patch the Boot Image with Magisk: Install the Magisk app on your phone. Open the app, tap the "Install" button next to Magisk, and select "Select and Patch a File." Navigate to the
boot.imgyou transferred. Magisk will generate a new file, usually namedmagisk_patched.img, in your Downloads folder. - Transfer Patched Image to PC: Connect your phone to the computer again and move the
magisk_patched.imgfile from your phone's Downloads folder to the folder on your PC where your ADB and Fastboot tools are located. - Flash the Patched Boot Image: Reboot your phone back into Fastboot mode (Volume Down + USB). In the command prompt on your PC, type
fastboot flash boot magisk_patched.imgand press Enter. - Reboot and Verify: Type
fastboot rebootto restart the device. Once the phone boots up, open the Magisk app. If it shows "Installed" with a version number, your Sony phone is successfully rooted.
Common Mistakes
One of the most frequent errors is using a firmware image that does not exactly match the build number of the device. Even a minor security patch difference can lead to a "bootloop," where the phone restarts indefinitely. Another common mistake is failing to enable OEM Unlocking in the developer settings before attempting the fastboot command; this will result in a "Command not allowed" error.
Users also often forget to back up their data. Unlocking the bootloader is a security feature that forces a factory reset to ensure that no one can steal a phone and access private data by unlocking the bootloader. Finally, using a poor-quality USB cable can cause the connection to drop during the flashing process, which can lead to a hard-brick scenario where the device will not turn on at all.
Tips
To ensure a smooth process, always use a USB 2.0 port if your computer has one, as some Fastboot implementations have compatibility issues with USB 3.0 or 3.1 ports. If you encounter errors, try changing the cable or the port. It is also highly recommended to keep a copy of the original, unpatched boot.img on your computer. If the patched image causes the phone to crash, you can quickly flash the original image back to restore stability.
When using Magisk, take advantage of the "Zygisk" feature in the settings to hide the root status from sensitive apps, such as banking applications or corporate email clients, which often block rooted devices for security reasons. Always read the specific forum thread for your exact model number, as some Sony devices require a specific "boot.img" modification or a different flashing command for the recovery partition.
Troubleshooting
If the device does not enter Fastboot mode, ensure the phone is completely powered off before holding the Volume Down button. If the LED does not turn blue, try a different USB cable. If the computer does not recognize the device in Fastboot mode (checked via fastboot devices), you likely need to install the Sony Fastboot drivers. On Windows, this is done through the Device Manager by manually updating the driver for the "Android" device to the Sony-specific driver.
If the phone enters a bootloop after flashing the patched image, the first step is to boot back into Fastboot mode. Use the command fastboot flash boot boot.img to flash the original, unpatched boot image. This will remove root access but will allow the phone to boot normally. If the device is completely unresponsive (hard-brick), you may need to use the Sony Xperia Companion tool on a PC. Use the "Software Repair" option, which can reinstall the factory firmware even if the phone cannot boot into Android. Note that Software Repair will delete all data on the device.
Frequently Asked Questions
Does rooting void my warranty?
Yes, unlocking the bootloader and rooting typically voids the manufacturer's warranty. Sony can detect that the bootloader has been unlocked even if you relock it later.
Can I still receive OTA updates?
No, rooted devices generally cannot install official Over-the-Air (OTA) updates. You will need to manually flash the new firmware and re-patch the boot image to maintain root.
Will my camera quality drop after rooting?
Rooting itself does not affect camera quality. However, if you install a custom ROM that does not include the proprietary Sony camera drivers, you may lose some advanced photography features.
Is it possible to relock the bootloader?
Yes, you can use the fastboot oem lock command, but you must ensure the device is completely stock (no root, no custom recovery) before doing so, or the device may fail to boot.
What is the difference between root and bootloader unlocking?
Bootloader unlocking is the process of removing the lock on the boot partition so you can flash custom files. Rooting is the process of gaining administrative privileges within the Android OS itself.