Re‑flash Android to Sony Xperia from desktop Linux

I recently purchased a second device to install Sailfish OS on. The documentation recommends installing the latest compatible Android baseband version - which essentially means re-flashing Android - before installing SFOS.

Olf's excellent guide goes into more detail here, esp. for my XA2 Ultra (H3213), and recommends 50.2.A.3.77 instead of 50.2.A.0.400. I downloaded this from the site mentioned.

But the instruction is only for one Windows software which does not work under Linux.

Olf's guide however mentions two softwares that should run under Linux. I tried the Xperia Flashtool first (Java, GUI). I tried it every which way for days (also see here) without success, it would always hang endlessly at "Device connect in flash mode".

Then I tried the command line tool mentioned in Olf's guide, newflasher. It states that it can "flash firmwares acquired through XperiFirm". What this apparently means is that the firmware (with .ftf extension) inside the download archive needs to be unzipped again. file recognizes it as JAR data, but a simple unzip will do, preferably to a separate folder. Open a terminal in that folder, connect your device in flash mode, and run sudo newflasher in that folder.

That's all.

Caveats