*Working* microg working on Sailfish X 3.0.0.8 F5121 TL;DR
So thanks to many others posting on this subject (listed below). I presume that you know about command line shells in linux, and how to traverse a file tree to find directories and generally poke about. This is not a HOWTO, but a 'HOWI'.
I needed the Curve banking app working on Sailfish X, to make it my daily driver. I tried adding Google Play (the real google play and play services), but it always hung when it tried to update. The Curve app always requested a google play upgrade, and it always failed.
I mucked about with deodex and signature spoofing tools, and broke alien dalvik completely. So I reinstalled Sailfish X on my Xperia X F5121, using the 3.0.0.8 files from the Jolla store (I paid).
This is the story of how I got micro-g installed and working so that my Curve app now runs.
My setup: A linux laptop, running KDE Neon, based on Ubuntu bionic (18.04). Xperia X, connected to the laptop by USB. Developer settings on, ssh enabled, IP 192.168.2.15.
Getting stuff ready: Plugging the Xperie X into the laptop and choosing developer as the USB connection provided a new wired network adapter. Use whatever GUI tool you have to set this IP to 192.168.2.1. The routing for connecting to the phone over USB should now be ready. Test this link from the linux shell with:
ssh nemo@192.168.2.15
Stop the android services:
systemctl stop aliendalvik
The process in outline.
- copy system files from the phone to the pc
- Deodex all the files
- Apply signature spoofing patch to a few important system files
- copy the files back to the phone
- Install the required android software
1. Use rsync to get the file you need from the phone: Make a new working directory somewhere simple (like your home directory). Do this at the linux shell.
rsync -rv nemo@192.168.2.15:/opt/alien/system/* .
2. Go to github and get simple-deodex github.com/jareddantis/simple-deodexer. You will need to install the Oracle version of Java 8 to run simple-deodex. Download it as a zip and unpack it. This gives you a file tree under directory 'simple-deodexer-master'. This software operates by processing all the files that you put under a directory 'triage'. Copy the files you got from the phone into this triage directory. You should copy all three directories 'framework', 'app' and 'priv-app' under 'triage' Run
./deodex.sh -l 19
NB '-l 19' states that you have Android API level 19, which is what Alien Dalvik has (Android 4.4).
The files are now deodex'ed. You can delete any *.odex files that remain in the framework, app, priv-app directories.
3. Get haystack signature spoofing patches github.com/Lanchon/haystack This has two steps. Unpack the zip file into your working directory. You will have a directory tree under 'haystack-master'. The script to run is patch-fileset. The shell command I used for this:
./patch-fileset patches/sigspoof-hook-4.1-6.0/ 19 ../simple-deodexer-master/triage/framework/
This stores the processed file, by default, in the 'framework__sigspoof-hook-4.1-6.0' directory. Then apply the second , core, patch to the files in this directory:
./patch-fileset patches/sigspoof-core 19 framework__sigspoof-hook-4.1-6.0/
This step leaves the processed files, by default, in the 'framework__sigspoof-hook-4.1-6.0__sigspoof-core' directory.
From this you can see that I didn't move the deodex'ed files from their previous position, just pointed the haystack script to where they are. Also you notice only the 'framework' directory needs to be processed.
4. Put the files back with rsync, and get the permissions corrected. So as root on the phone (by devel-su), make the /opt/alien/system/{framework,app,priv-app} directories writable:
cd /opt/alien/system
chmod a+w framework app priv-app
Then put the files back - from the linux shell:
rsync -v haystack-master/framework__sigspoof-4.1-6.0__sigspoof-core/* nemo@192.168.2.15:/opt/alien/system/framework/
rsync -v simple-deodexer-master/triage/app/* nemo@192.168.2.15:/opt/alien/system/app/
rsync -v simple-deodexer-master/triage/priv-app/* nemo@192.168.2.15:/opt/alien/system/priv-app/
Now your three directories framework, app, priv-app on the phone will have some new files owned by your linux user, and some old files owned by root. Delete all the old files owned by root. CAREFULLY! These will be any now unwanted .odex files.
Change the ownership of the files in each directory (framework, app, priv-app) back to root: Change the permissions on the directories back to 755.
Tun the android services back on:
systemctl restart aliendalvik
5. Android stuffGo to f-droid.org and download and install the f-droid app. Add the micro-g repository. Install the signature spoofing check app (see the haystack page). If it works, then you have done the same as me. Cool beanz. Install micro-g core. Do the self-check. Be happy.
Others' work https://github.com/vermut/sailfish-signature-spoofing https://together.jolla.com/question/169496/xperia-x-microg/ https://together.jolla.com/question/117350/microg-on-alien-dalvik/ Plus many bits'n'pieces from other people on the internet, and of course http://forum.xda-developers.com.
HTH docmathoc
Thank you, this could potentially allow us on old Android Runtime to use newer apps.
magullo ( 2018-12-28 11:55:37 +0200 )edit@docmathoc: Thank you very much for this 'hack log'!
I believe there was a typo in the second command of step 3: The line said
./patch-fileset patches/sigspoof-core 19 sigspoof-hook-4.1-6.0
. I corrected it to./patch-fileset patches/sigspoof-core 19 framework__sigspoof-hook-4.1-6.0
in order to point the second round of patching to the already processed filesHowever, following your steps and transfering the deodexed & patched files back do Sailfish X with correct
rozgwi ( 2018-12-30 19:19:13 +0200 )editroot:root
permissions (as per step 4) does not work. Both MicroG core and Spoofing Checker say spoofing is disabled. Persits after App reinstall and OS reboot.Can you advise me on what might have gone wrong?
@magullo Well, I don't think so, as it is probably fixed to the Xperia X Android blobs for 6.0 which go with the Sailfish X installation. But many apps seem to be compatible with Android back to 4.0 or 4.4, which surprised me! I cannot find any info on AlienDalvik's upgrade plans. Sailfish X on XA2 devices does install the later Sony Android blobs for 8.0, so that may indicate an upgrade in the future. Do report back if you anything surprising or exciting.
docmathoc ( 2018-12-31 00:32:06 +0200 )edit@rozgwi Glad it's getting you part of the way, anyway. Did you chown root:root * and also chmod 755 * ? You are correct on the typo, thank you. From tracing discussions elsewhere, the spoofing will all be in the framework files. Of course, if the deodexing didn't work for some reason, then the spoofing patches will not work. If both deodexing and spoofing patches reported success, then I would ensure that you really have the processed files on your phone. I would clear out the phone directories before the rsync, just to make sure. There were a couple of times I tried rsync -u, and the timestamps meant that the old files were not in fact overwritten. All I can think of for now, but feel free to post deodex and haystack terminal output if you are still stuck. Can't promise to solve it, but I'll certainly look it over. HTH
docmathoc ( 2018-12-31 00:40:50 +0200 )edit@rozgwi BTW submitted tag 'hack-log' for moderator approval. A precise suggestion :)
docmathoc ( 2018-12-31 00:50:29 +0200 )edit