We have moved to a new Sailfish OS Forum. Please start new discussions there.

Guide: Installing Sailfish X on Xperias

asked 2020-02-02 16:29:20 +0300

olf gravatar image

updated 2020-07-10 05:24:59 +0300

Guide for installing Sailfish X on Sony Xperias

This guide aims at setting up an Xperia step by step, extending Jolla's flashing guide by preparatory and follow up measures, plus specific considerations WRT privacy.

Table of content

1 Preparation

1.1 First steps

  1. Buy a Sony Xperia model, which is supported by Sailfish OS via the Sailfish X end user license programme.
    For more details see available devices supported by Sailfish OS.
  2. Unbox your Xperia, but do not insert a SIM or SD card yet.
  3. Start your Xperia by pressing the power button for a few seconds.
    BTW, it should be charged between 40% and 55% when new.
  4. Choose No, Off, Cancel, Skip, Disable, Dismiss, Decline, Deny for really everything during the initial setup:
    Google account, WLAN, Bluetooth, GPS, Mobile network, Sony support, device PIN and fingerprint (because that would trigger the device encryption unnecessarily) etc.!
  5. Do not upgrade Android!
    Otherwise you may not be able to install Sailfish OS.
    Furthermore there is zero benefit for the Sailfish OS installation later on, as it uses its own firmware binaries (which you will download later) etc.
  6. Thoroughly browse through the Settings subsections and switch off everything with regard to online, location and other potentially privacy relevant functions / services. Pay attention to not accidentally switch on something which may receive or transmit data, as many functions / services are off by default.
    Note that you have to go online in part 2 of the preparation, thus do this diligently.
    • Pay special attention to the settings in the Google subsection.
    • Note that settings might even be "logically inverted", e.g. setting Settings -> Google -> Ads -> Opt out of Ads Personalisation to on actually switches the personalised ads off!
  7. Check your device hardware with Sony's device test tool per Settings -> System -> About phone -> Support -> Decline -> Run all tests:
    • The GPS test will fail, even if "location access" is granted (hence don't!), as it runs too briefly to obtain a GPS fix without A-GPS.
      This test will be performed in a different manner, later.
    • The "Nearby" test will fail without a location fix, location access by the Sony test tool and Google Chrome, plus acknowledging the use of Google Chrome.
      Skip it!
  8. Go to Settings -> System -> Date & Time and switch off both "Automatic date & time" and "Automatic timezone". Then set the correct date, time and timezone in order to obtain a GPS fix (in the next step) reasonably quick.
    Also switch on Settings -> Lock screen & security -> Privacy: Location -> Use location on for the next step.
  9. Open the Service menu as described by Sony (by entering *#*#7378423#*#* in the dialler app).
    • Service info -> Configuration -> Rooting status: must state "Bootloader unlock allowed: Yes".
    • Service tests -> GPS runs indefinitely and should obtain a GPS fix within approximately 10 minutes.
    • You may perform other tests in Service tests, but many of them are tedious.
    • You may also look at other information in Service info, e.g. SIM lock.
  10. Switch Settings -> Lock screen & security -> Privacy: Location -> Use location off again.
  11. Go back to Settings -> System -> About phone
    • Compare the IMEI(s) with the ones on the original cardboard box from Sony (the IMEI(s) are on a printed label at its small side): They ought to be the same. If not, you bought your Xperia from a likely fraudulent seller.
    • Tap seven times on Settings -> About phone -> Build number to check if you can enable the "Developer mode". If this fails, the device is locked and Sailfish OS cannot be installed.
  12. Switch your Xperia off.

1.2 Further preparation (modem initialisation)

  1. Insert a working SIM card, preferably the one you will be using later.
  2. Start your Xperia.
  3. Enter the PIN of your SIM card.
  4. Let the Xperia rest for at least 10 minutes at a location with at least medium mobile network reception.
    • The SIM card might reboot once or twice, resulting in a brief loss of mobile network connectivity; you may have to enter the SIM-PIN again.
    • You should perform a telephone call after waiting for 10 minutes to check that this is working fine.
    • You may additionally switch on mobile data and check internet access, but using any of the preinstalled apps for that will likely push device specific data (i.e., privacy relevant data) to Sony, Google etc.
      Hence you may as well skip this mobile data test!
      Or alternatively (but tediously) transfer a privacy protecting network speed test app (e.g. download the latest APK of Speedtest from F-Droid on your PC) per Bluetooth, install it (needs "untrusted sources" enabled) and use that.
      When done, switch mobile data (plus Bluetooth and "untrusted sources") off again.

Up to this point ...

  • your Xperia did not have a chance to transmit privacy relevant (e.g., device specific or personal) data to a third party, except for modem specific and SIM card data to your mobile network provider (which is unavoidable when using a SIM card).
  • all measures are fully reversible by performing a "factory reset" of Android: After that your Xperia will be in exactly the state, when you received it (if it was new or factory reset before).

2 Flashing Sailfish OS

Attaching your Xperia to a "USB root hub" (internal to your computer), to which no other device is attached (neither internally or externally):

  • Execute lsusb in a terminal window, without having your Xperia connected.
  • Look for a bus which solely has a Linux Foundation 2.0 root hub attached (i.e., nothing else).
  • Connect your Xperia to a USB port, which is attached to this bus.
  • Execute lsusb again; for example, an Xperia X on bus 003 then looks like this:
    Bus 003 Device 015: ID 05c6:0afe Qualcomm, Inc. Xperia X
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Under Windows you should be able to achieve the same by the help of the device manager's tree view.

Note that:

  • If there are no buses without internal USB devices attached (this is the case for many notebooks), you may disable those devices (e.g. cameras, card readers) in the firmware (UEFI- / "BIOS"-) setup and retry then.
  • Although pure USB 2 ports are preferable, if there are none or these share a USB root hub with other devices, do try a USB port which also supports USB 3 (often colour coded in blue; on Intel machines lsusb may also show a "rate adaptor" attached to this bus, which is harmless): You should still see your Xperia being attached to a USB 2 root hub.
    If it turns out to be logically attached to a USB 3 root hub then, flashing will likely fail, hence use a different USB port or try to temporarily force all USB 3 ports to USB 2 mode.
    As a last resort measure, you may try putting a USB 2 hub between a USB 3 port and your Xperia, or if you are really desperate a USB 3 hub connected with a USB 2 cable to your computer.
  • In general, do not put anything (e.g., an external USB hub, adapters) between your Xperia and your computer's USB port, except for a single USB 2 cable (or a USB 3 cable plugged into a pure USB 2 port) of at most 2 metres length. The USB cable which came with your Xperia should work fine (at least at a USB 2 port).

After having determined a suitable USB port for the subsequent unlocking and flashing, unplug your Xperia from the USB cable.

Diligently follow the model specific (and host OS specific) guide for flashing Sailfish X by Jolla, starting with the section "Install the fastboot driver to your computer" (you have already performed actions equivalent to the steps described in Jolla's first sections before).

  • An Xperia needs an internet connection for altering the "Developer options" (after enabling them) in Settings -> System -> Advanced -> Developer options (per Jolla's section "Enable developer options on your phone"): Deliberately switch WLAN (preferred for privacy) or alternatively mobile data on for this (and off again thereafter).
  • Note that the unavoidable steps of altering the "Developer options" and (even more so) of unlocking the bootloader are not fully reversible.

For details and troubleshooting, covering the whole section 2 of this guide, see also Jolla's "Checklist for issues in installing Sailfish X".

3 Basic configuration of Sailfish OS

3.1 First boot ("initial bring-up")

  1. Select a language, preferably English UK or English US (unfortunately English EU aka English DK is not available).
    Note that you can add (and remove) arbitrary languages (localisations, dictionaries and keyboard layouts) later (after the initial setup) and Sailfish OS knows no "primary" language.
  2. Enter a new security code.
  3. Enable WLAN and log in to a WLAN network.
  4. Select time and date.
  5. Enter your Jolla Store credentials to log in.
  6. Initial selection of Jolla provided apps:
    • Do not select Jolla's Weather app (actually by Foreca), because MeeCast is a better, Open Source and privacy conscious alternative, which can be installed later per Storeman.
    • You may select Exchange Active Sync (EAS) support depending on your needs.
    • Do select everything else for installation, even if you think you will not need them: Some other apps depend on them being installed, they do nothing if not used and they are all quite small.
    • If the XT9 support is not available (free and community versions of Sailfish OS), install Presage per Storeman later on.
  7. Do select Android App Support, depending on your preference (only offered here, if you are entitled for it).
    Do not select the "Store" app (actually a special Aptoide client version), if it is offered here (since Sailfish OS 3.3.0), because of the security issues using Aptoide bears plus the multiple security breaches Aptoide had. See also section 4.4.4.
  8. Do not set up the fingerprint sensor yet ("Skip"), as it may result in issues doing it now. You can perform this action any time later.

All these apps can also be installed or uninstalled (and reinstalled) later per the Jolla Store app, but privacy relevant data cannot be recalled once given away.
Note that most of them are proprietary licensed by Jolla.

3.2 Enabling "developer mode"

Optional, but absolutely recommended!

  1. Switch on Settings -> Developer tools -> Developer mode, followed by also switching on Remote connection there and setting a root password of your choice.
  2. Wait for the Terminal app to become installed and open it.
  3. Execute devel-su in the Terminal and enter your root password.
  4. If becoming root in the Terminal went fine, enter Ctrl-D twice or type exit twice (or just brutally close the Terminal app).

3.3 Increasing the "root" LVM volume size

Optional, although strongly recommended.

There are multiple descriptions of the issues the tiny (2500 MiB) default "root" volume size might cause later at Together.Jolla.com ("TJC": [1], [2], [3], [4] etc.), which affects all devices since Sailfish OS started using LVM (i.e., all since the Jolla C).

3.3.1 Booting a Sailfish OS recovery image per fastboot boot

  1. Locate the file hybris-recovery.img in the unpacked Sailfish X directory on your host computer.
  2. Power down your Xperia and connect its USB cable to your host computer (but not the Xperia, yet). Bring your Xperia into recovery boot mode be pressing the "Volume up" button when plugging in your Xperia to USB. Release the button when its LED has become blue.
  3. Execute fastboot boot hybris-recovery.img on your host computer. You may need to execute the fastboot command as root, e.g. by prepending a sudo.
  4. Wait until booting the recovery image finished: It displays a message in a very tiny font at the top of your Xperia's screen.
  5. Execute telnet on your host computer.

This is the general way of booting a Sailfish OS recovery image on devices reflashed from Android.
For details and troubleshooting, see Jolla's Zendesk article "Xperia devices: How to use the Recovery Mode".

  • Always use a downloaded recovery image, which matches the installed Sailfish OS release.
    Hence, if you have upgraded the Sailfish OS installation on the device per OTA update and want to use the recovery image, do download the recent installation image, unpack it and boot that recovery image.
    Never use an older recovery image than the installed Sailfish OS release!
  • Do not flash an Xperia's recovery partition with it (which is technically possible and basically working), as this recovery image will be outdated and not matching anymore after a Sailfish OS update on your Xperia.
    Furthermore you lose Sony's original Android recovery as a fallback by overwriting it with a Sailfish OS recovery.

3.3.2 Shrinking the "home" LVM volume and extending the "root" one

Do not be afraid of loosing a little space on your "home" volume, your user data (music, pictures / photographs, offline maps, videos etc.) can be seamlessly outsourced to an SD card.

  • For devices with 32 GiB internal FLASH memory (resulting in an original "home" volume size of approximately 20 GiB) aim at a "root" LVM size of 4 GiB for regular use respectively 6 GiB if you plan to install a lot of native software (Android APKs are installed on the "home" volume).
  • For devices with 64 GiB of internal FLASH memory you might add additional 2 GiB to these values, because the "home" volume size is at least 37 GiB (even after resizing).
  • If you really plan to install gcc and compile software on the device (which is technically feasible, but you should rather use the SailfishOS SDK on an x86 computer for that), add another 2 GiB or just aim at 10 GiB (the maximum for this scheme, see next point).
  • As 10 GiB "root" LVM volume size is very spacious, more does not seem to make any sense. Thus the values chosen below only work for increasing the "root" volume size to at most 10 GiB (on both, 32 GiB and 64 GiB devices).
  • For 64 GiB devices, the values of 10G and 22000000 (below) might be tripled to 30G and 66000000 in order to reduce unnecessary shrinking and expanding later on.
  • When executing the steps of either section 3.3.2 (a or b), you may encounter the output (e.g. of a lvm lvresize command):
    /dev/mmcblk0rpmb: read failed after 0 of 4096 at X: Input/output error
    This specific error message is harmless and rather a bug.
    Mind that any other error message likely constitutes a real error.
  1. Select 3 for Shell in the recovery menu.
  2. Check per lvm lvdisplay that the "root" volume is comprised of 625 (logical) extents each 4 MiB in size. Note that while the extent size on all devices using LVM has been 4 MiB, that may change for future devices, as the (physical) extent size shall be equal or larger than the erase block size of the device's eMMC FLASH memory (see cat /sys/block/mmcblk0/device/preferred_erase_size and cat /sys/block/mmcblk0/queue/discard_granularity). Future device's eMMCs may have a larger erase block size, hopefully Jolla then increases the physical and consequently the logical extent size accordingly.
    If the extent size is not 4 MiB or the "root" volume is not comprised of 625 extents, do not use the -l -xxxx option for the lvm lvresize  sailfish/home command (below), because the values are calculated for these preconditions, aiming at allocating an even number of extents. You might resort to use the option -L -xxxxM instead (with one of the values given in parentheses; see lvresize man-page for details) then.
    If the "root" volume size is not 2500 MiB, you need to recalculate the value for the lvm lvresize -l -xxxx sailfish/home command (below).
3.3.2.a ... on devices / Sailfish OS releases without home volume encryption

(All Xperia X and XA2 with Sailfish OS 3.2.1 or lower installed, plus those Xperia X and XA2 originally flashed with Sailfish OS 3.2.1 or lower which were upgraded to Sailfish OS 3.3.0 or higher per OTA / "Sailfish OS updates" but the device encryption was not activated)

  1. e2fsck -f /dev/mapper/sailfish-home
  2. Shrink size of "home" file-system to 10 GiB (you might use 30G on 64 GiB devices):
    resize2fs /dev/mapper/sailfish-home 10G
  3. e2fsck -f /dev/mapper/sailfish-home
  4. lvm lvchange -a n sailfish/home
  5. Shrink "home" volume by -911 extents (= -3644M) for a 6 GiB, -1423 extents (= -5692M) for a 8 GiB, -399 extents (= -1596M) for a 4 GiB or -1935 extents (= -7740M) for a 10 GiB "root" volume size:
    lvm lvresize -l -911 sailfish/home
  6. lvm lvresize -l +100%FREE sailfish/root
  7. lvm lvchange -a y sailfish/home
  8. resize2fs /dev/mapper/sailfish-home
  9. e2fsck -f /dev/mapper/sailfish-home
  10. resize2fs /dev/mapper/sailfish-root
  11. Hit Ctrl-D (or type exit).
  12. Select 2 for Reboot.
3.3.2.b ... on devices / Sailfish OS releases with home volume encryption

(All Xperias newly flashed with Sailfish OS 3.3.0 or higher, Xperia 10 series since Sailfish OS 3.2.0, plus Xperia X and XA2 originally flashed with Sailfish OS 3.2.1 or lower on which the device encryption was activated after being upgraded to Sailfish OS 3.3.0 or higher)

  1. Open the cryptsetup container (using your security code) per
    cryptsetup luksOpen /dev/mapper/sailfish-home crypt-home
  2. e2fsck -f /dev/mapper/crypt-home
  3. Shrink size of "home" file-system to 10 GiB (you might use 30G and 66000000 (below) on 64 GiB devices):
    resize2fs -f /dev/mapper/crypt-home 10G
  4. e2fsck -f /dev/mapper/crypt-home
  5. Shrink size of cryptsetup-container to 10,49 GiB (22000000 sectors á 512 Bytes; you might use 66000000 = 31,47 GiB on 64 GiB devices):
    cryptsetup resize -b 22000000 /dev/mapper/sailfish-home
  6. cryptsetup close crypt-home
  7. lvm lvchange -a n sailfish/home
  8. Shrink "home" volume by -911 extents (= -3644M) for a 6 GiB, -1423 extents (= -5692M) for a 8 GiB, -399 extents (= -1596M) for a 4 GiB or -1935 extents (= -7740M) for a 10 GiB "root" volume size:
    lvm lvresize -l -1423 sailfish/home
  9. lvm lvresize -l +100%FREE sailfish/root
  10. lvm lvchange -a y sailfish/home
  11. cryptsetup luksOpen /dev/mapper/sailfish-home crypt-home
  12. cryptsetup resize /dev/mapper/sailfish-home
  13. resize2fs -f /dev/mapper/crypt-home
  14. e2fsck -f /dev/mapper/crypt-home
  15. cryptsetup close crypt-home
  16. resize2fs /dev/mapper/sailfish-root
  17. Hit Ctrl-D (or type exit).
  18. Select 2 for Reboot.

4 Installing software

  • Always check when the latest version of an app was released, regardless which app store you are using: If it is from before 2017 it likely does not run well.
  • Also always read an app's description in any of the store client apps thoroughly before installing it.
  • Additionally read the recent comments of an app in the Jolla Store client app respectively Storeman (for apps at OpenRepos.net).

4.1 Using the Jolla Store

Open the Jolla Store app and install the "File Browser" (by Kari) to check if the Jolla Store is working fine (you will need a file browser sooner or later, anyway).

Advice for users of the Android runtime environment ("Android App Support"):
Do not install any Android apps from the Jolla Store (those with their icons labeled with a small, overlayed Android, plus the line "Android app" atop their description), not even the app stores' client apps offered there (F-Droid, Aptoide, Yandex etc.), otherwise you may later run into troubles when updating these apps.
Alternatively you may solely install Android apps from the Jolla Store (and never use any other Android store app), which is not really feasible (due to the small and awkward selection of Android apps in the Jolla Store).

4.2 Using OpenRepos.net (Sailfish OS community app repositories)

Optional, although strongly recommended.

  1. Download the RPM (for armv7hl) of the current Storeman release from OpenRepos per the Sailfish OS Browser:
  2. Enable Settings -> Untrusted software -> Allow untrusted software.
  3. Start the File Browser app and go to Downloads. Tap on the downloaded Storeman RPM and select Install in the top pulley.
  4. Disable Settings -> Untrusted software -> Allow untrusted software again.

4.3 Installing Patchmanager

Optional, although recommended.

  1. Install Patchmanager 3 (by coderus) per Storeman:
    Search for "Patchmanager" per Storeman's top pulley, select "Patchmanager 3", enable its repository (per top pulley) and ultimately install it.
  2. Reboot your Xperia.
  3. Browse Patchmanager's web-catalog in Settings -> Patchmanager -> (top pulley) Web catalog and install a Patch which sounds interesting for you and which is compatible with the installed Sailfish OS release.
    Go back to Patchmanager's main page and apply this Patch there.
    Select Restart preloaded services in the top pulley and see what it does.

4.4 Installing Android app stores' client apps

This requires the Android runtime environment ("Android App Support" / AlienDalvik) being installed and running, which is only available for paid Sailfish X licenses.

  • Note that installing APKs on Sailfish OS does not require "Untrusted sources" enabled, because the Android runtime environment with all its installed APKs is separated from the Sailfish OS installation proper and its native apps.
  • Also note that APKs (Android apps) must be built for the ARMv7-A architecture (32 bit), because Sailfish OS currently still solely uses 32 bit user space binaries.

4.4.1 F-Droid

  1. Download the recent F-Droid client app in the Sailfish OS Browser:
  2. Start the File Browser app and go to Downloads.
    Tap on the downloaded F-Droid client APK and select Install in the top pulley.

4.4.2 A proper Android file-manager

As the "AlienDalvik" Android runtime environment does not provide any preinstalled apps, one needs a proper file-manager for Android to serve Android file intents:
Start the F-Droid client app (if it is its first start ever on this device, wait a couple of minutes for it to synchronise its repositories) and install the OI File Manager.

4.4.3 Google Play Store per Aurora Store / YALP Store app

For accessing the Google Play Store, install the Aurora Store app per F-Droid client app on all Xperias, except the Xperia X (for which the YALP Store app works, also available per F-Droid client app).
Note that Google regularly disables the "shared accounts" these apps offer to use, so you might need to enter the account information of an own Google account.

4.4.4 Other Android app sources

Other Android apps stores or manually downloading and installing APKs is not recommended due the negative security implications: Downloading and installing apps from somewhere (specifcally "someone"), plus (when doing this manually) never being informed about their updates.
If you really want to pursue this, start with the app ApkTrack from F-Droid.

5 Further recommendations

5.2 Guides for utilising an SD card to consider

6 Further guidance and sources of information

For further information always search first at

For issues with a device using a paid license, you may open a Zendesk support request after having exhausted searching aforementioned sources of information and including everything relevant you found and have tried.

Have fun with Sailfish OS on your Xperia!

P.S.: The original source of this guide is at Gitlab.com and is rendered better there (e.g., its formatting, especially enumerations across paragraphs) than at TJC (except for the TOC and the line spacings in this footer).

edit retag flag offensive close delete


in 1.1.9, the sequence "7378423" is hard to remember. Suggest to add the hint that it can be "dialed" as "service".

A.Maretzek ( 2020-02-03 01:30:14 +0300 )edit

@A.Maretzek, sorry I fail to comprehend each of your two sentences:

  • While *#*#7378423#*#* is surely "hard to remember", there is no need to: One has to enter it only once.
  • What does "it can be 'dialed' as 'service'" mean?
    Did your Xperia have a preset a phone book entry labeled "service" with this "number"?

Anyway, feel free to pose a pull request ("PR") / merge request ("MR") at this guide's source code repository.
Then we can discuss and / or merge your concrete suggestion there.

olf ( 2020-02-04 18:31:07 +0300 )edit

@olf, on the dialer thrre are chars below each number. if you click on 7 cause its standing for an s ... service realy resolves in that number

pawel ( 2020-02-04 19:09:56 +0300 )edit

@pawel & @A.Maretzek, as stated before, please create a pull request ("PR") / merge request ("MR") at this guide's source code repository, so we can discuss and / or merge your concrete suggestion there.

Please provide a foolproof description of the steps which substitute typing the "special number" manually, while using the exact wording (e.g., "Service" vs. "service") on the screen.
I cannot do that, as none of my Xperias still has its original firmware installed.

olf ( 2020-02-04 20:15:52 +0300 )edit

I'm not sure if everyone got it what A.Maretzek was trying to say. So here is some further information about phonewords:


Pohli ( 2020-02-06 14:20:23 +0300 )edit

3 Answers

Sort by » oldest newest most voted

answered 2020-04-19 00:25:19 +0300

citronalco gravatar image

Maybe you could add instructions or at least a note for Xperia X Compact. It's not officially supported and requires a patch on the Sailfish X image, but runs flawless. https://github.com/g7/sailfishx-patcher-f5321

edit flag offensive delete publish link more


Thanks for doing that with your message!

As this guide is primarily about officially supported Xperias, IMO your note is sufficient.
Note that an Xperia X Compact (F5321) is hard to obtain nowadays and bears the same drawbacks as the Xperia X (old Aliendalvik based on AOSP 4.4.4, old kernel version).

olf ( 2020-04-19 01:11:57 +0300 )edit

answered 2020-02-13 11:01:45 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2020-02-13 11:01:45 +0300

Chap gravatar image

Juste went throuh first steps here, and I can confirm your Xperia needs to be connected to the Internet in order to alter the Developrs options.

edit flag offensive delete publish link more


@Chap, thanks you very much.
Will try to update this weekend.

Edit: done

olf ( 2020-02-13 14:00:42 +0300 )edit

answered 2020-04-18 22:55:02 +0300

ds1979 gravatar image

Great work! :)

Please include this point about USB2 cable/hub on top of your article as a kind of "What you need to prepare before starting". This has been a huge mystery for me on my Lenovo X250, which is a couple of days old. :-) With Windows, it has worked on USB3, too.

edit flag offensive delete publish link more


Well, AFAICS the USB cable, which comes with an Xperia fulfills this, so everyone should have a appropriate USB cable at hand.
But I might denote that in the guide.


olf ( 2020-04-26 03:54:17 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2020-02-02 16:29:20 +0300

Seen: 10,527 times

Last updated: Jul 10 '20