GETDroidTipsGETDroidTips

Trending

How to Unlock the Bootloader on Sony Xperia X Compact F5321 (2026 Guide)

Unlock the Sony Xperia X Compact (F5321) bootloader with Sony’s official unlock code. Step-by-step guide with the DRM key warning, updated for 2026.

Abd Razaaq

Updated 3 min read

Share

Sony is one of the few phone makers with an official bootloader unlock program, and the Xperia X Compact (F5321, codename kugo) is supported. Unlocking lets you install TWRP, root the phone and flash custom ROMs like LineageOS 20, which brings Android 13 to this 2016 phone.

This guide walks through the official method step by step, and covers the one big downside you should know about before you start.

Unlock bootloader on Sony Xperia X Compact F5321

Read this first: unlocking erases Sony’s DRM keys

On Sony phones, unlocking the bootloader permanently deletes the DRM keys stored in the phone’s TA (Trim Area) partition. Those keys are used by some Sony camera processing and by protected video playback, so after unlocking you may notice lower camera quality on stock firmware and lower-quality streaming in some apps. Relocking the bootloader later does not bring the keys back unless you made a TA backup before unlocking.

If the stock camera and DRM features matter to you, look into backing up the TA partition first. The methods depend on your firmware version, so check the Xperia X Compact section on XDA Forums. Unlocking also wipes all data on the phone and may affect your warranty.

Advertisement

What is a bootloader?

The bootloader is the first program that runs when you turn the phone on. It checks the software and starts Android. Sony locks it so only official software can run. Unlocking it lets you flash a custom recovery like TWRP, root the phone and install custom ROMs.

Before you start

  • This guide is for the Sony Xperia X Compact F5321 only.
  • Back up your data. Unlocking wipes the phone.
  • Charge the phone to at least 60%.
  • Install ADB and Fastboot and the Sony USB drivers on your PC.
  • Write down your IMEI. Dial *#06# or check Settings, then About phone, then Status.

GetDroidTips is not responsible for any damage to your device. Unlocking the bootloader erases your data and your DRM keys, and it can’t be fully undone. Proceed at your own risk.

How to unlock the bootloader on the Xperia X Compact

Step 1: Check that your phone can be unlocked

  1. Open the phone app and dial *#*#7378423#*#* to open the service menu.
  2. Tap Service info, then Configuration, then Rooting status.
  3. If it says Bootloader unlock allowed: Yes, you can continue. If it says No, or the line is missing, your phone can’t be unlocked. This is common on carrier-locked models.

Step 2: Turn on OEM unlocking

  1. Go to Settings, then About phone, and tap Build number seven times to turn on Developer options.
  2. Go back to Settings, open Developer options, and turn on OEM unlocking and USB debugging.

Enable OEM unlock in Developer options

Step 3: Get your unlock code from Sony

  1. Open Sony’s official unlock bootloader page.
  2. Select Xperia X Compact from the device list and continue.
  3. Enter your IMEI and accept the terms.
  4. Sony shows your unlock code. Copy it somewhere safe, because you’ll need it in the next step.

Enter IMEI on Sony unlock page

Step 4: Boot into fastboot mode

Turn the phone off. Hold Volume Up and connect the USB cable to your PC. The notification light turns blue when the phone is in fastboot mode.

You can also do this from Android with USB debugging on. Open a command window in your ADB folder and run:

adb reboot bootloader

Advertisement

Check that your PC sees the phone:

fastboot devices

Step 5: Unlock the bootloader

Run this command, replacing YOUR_UNLOCK_CODE with the code from Sony:

fastboot -i 0x0fce oem unlock 0xYOUR_UNLOCK_CODE

The phone unlocks and wipes itself. Then reboot it:

fastboot reboot

The first boot takes a little longer. Set the phone up again and turn USB debugging back on before you continue with installing TWRP.

Frequently asked questions

Is Sony’s unlock service still available?

Sony’s unlock page is still listed in its official support articles. If the Xperia X Compact no longer appears in the device list, the service may have changed, so check the Xperia X Compact section on XDA Forums for current advice.

Why does the service menu say “Bootloader unlock allowed: No”?

Your phone’s carrier or region doesn’t allow unlocking. There’s no official way around this.

Can I relock the bootloader?

Yes, but it won’t restore the DRM keys unless you backed up the TA partition before unlocking. See our guide to relock the bootloader on Sony Xperia.

What should I do after unlocking?

Install TWRP and root the phone with our X Compact TWRP guide, or install LineageOS 20.

Written by

Abd Razaaq

I'm a Tech Content Writer and Full-Time blogger. Since I love Android and Google's device, I started my career in writing for Android OS and their features. This led me to start "GetDroidTips". I have completed Master of Business Administration at Mangalore University, Karnataka.

Share

Leave a Comment

Share your thoughts, questions, or extra tips with other readers.

Comments are reviewed before appearing on the site.