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

[HowTo] Install Google Play Services on baseport 8 devices from the phone itself (Tested working)

asked 2019-05-12 22:31:26 +0300

this post is marked as community wiki

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

updated 2019-06-03 12:09:08 +0300

Giacomo Di Giacomo gravatar image

This guide provides a simple procedure to create a version of system.img including the pico version of opengapps (Google Play Services). This requires only the phone itself, used as a Linux box, and possibly a PC to transfer files to it via USB (but you can anyway edit and download files from the phone). This procedure was developed and tested by @Artur.

First of all, enable developer mode. All the procedure is run from the phone's command line shell. Work as root by issuing the command devel-su and entering the root password you set when you enabled developer mode.

Secondly, install the required elements that will be using to create a modified version of system.img. As a working directory, you can create a subdirectory of /home/nemo/Downloads, or you can use a directory on your SD card. Let's call our directory the "Work directory".

  1. Install lzip and a version of squashfs-tools with lz4 support:

    pkcon install info
    
    rpm -i https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/l/lzip-1.16-1.fc22.armv7hl.rpm
    
    rpm -i https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/l/lz4-r128-2.fc22.armv7hl.rpm 
    
    rpm -U --oldpackage --nodeps https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/s/squashfs-tools-4.3-8.fc22.armv7hl.rpm
    
  2. Stop Android Support from Settings -> Android Support. Run devel-su rm -rf /home/.android/*; this will uninstall all your current Android applications and remove their data. This is useful to avoid weird things happening.

  3. Create an install_opengapps.sh script with the following content, or download it from the link at the bottom, and make it executable with the command chmod 755 install_opengapps.sh. You can copy the text from a PC and move it to the phone via USB; if you do so, take care to open the file in TinyEdit (or any other editor) on the phone and save it again; this will convert the stupid Microsoft-style newlines in proper ASCII newlines.

    #!/bin/sh
    
    set -e
    
    google_remove='carriersetup extservicesgoogle extsharedgoogle googlebackuptransport googlecontactssync googlefeedback googlepartnersetup'
    
    opengapps_zip="$1"
    
    if [ -f system.img.orig ]; then
        echo 'WARNING: reusing existing system.img.orig' >&2
    else
        cp /opt/alien/system.img system.img.orig
    fi
    
    unsquashfs system.img.orig
    
    unzip "$opengapps_zip" -d opengapps/
    
    for p in $google_remove; do
        rm "opengapps/Core/$p-all.tar.lz"
    done
    
    if [ -f opengapps/Core/extservicesgoogle-all.tar.lz ]; then
        rm -r squashfs-root/system/priv-app/ExtServices
    fi
    if [ -f opengapps/Core/extsharedgoogle-all.tar.lz ]; then
        rm -r squashfs-root/system/app/ExtShared
    fi
    
    rm opengapps/Core/setupwizardtablet-all.tar.lz
    
    mkdir opengapps_2
    for f in opengapps/Core/*.tar.lz; do
        lzip -c -d "$f" | tar -x -C opengapps_2
    done
    cp -r opengapps_2/*/*/* squashfs-root/system/
    
    rm -f system.img.gapps
    mksquashfs squashfs-root system.img.gapps -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no-fragments
    
    rm -r opengapps opengapps_2 squashfs-root
    
  4. Download opengapps for Android 8.1 from www.opengapps.org; choose the pico version for the ARM64 architecture (ARM will work anyway).

All of this should be done only once on your phone.

Now you should patch the system.img file; this must be done after all Sailfish OS updates. Do the following:

1. Stop Android support if it is running. Run install_opengapps.sh as root and pass the opengapps zip as a parameter (e.g. devel-su ./install_opengapps.sh ./Downloads/open_gapps-arm-8.1-pico-20190508.zip). If you are updating your system and you get a message about lack of lz4 support, this means that Sailfish now includes a version of squashfs-tools without this support. To overcome this, just install it again by executing again the last line in step 1 of the preliminary procedure above.

(Running as root is necessary for unsquashfs to create files with the correct permissions when it unpacks the image.)

2. Copy system.img.gapps to /opt/alien/system.img.

3. Start Android support. If you are successful, in few minutes the Android setup screen should appear. Skip network configuration and finish the setup. In a few seconds you should get a notification about Google Play Protect. Click the notification and disable Play Protect. (If you miss it, open Google Play Store and check the three-dot-menu for the option; if the option is not there, close Play Store, wait a few minutes, and try again.) Please note that this does not solve the issue of Google Play Store refusing downloads: you won't be able to download apps using Google Play Store in any case. You will need to use Yalp Store or another Android store.

edit 20.5.2019: Downloads from Google Play Store seem to work with mobile connection (3.0.3.9).

  1. Install the Aptoide store from Jolla Store (if it is already installed, uninstall and install it again), then make sure you can open it. If the icon disappears, wait a few minutes.

    (This step is intended for testing if you can install Android applications, even if you want to uninstall Aptoide afterwards.)

In case you want to put things back as they were, you can find the original system.img file as system.img.orig in your Work directory.

ready script to use install_opengapps.sh.zip

edit retag flag offensive close delete

Comments

2

Suggested edits by a moron who initially did most of it wrong:

In 1, the command lines presentation is a tad confusing. Could the separate rows for each file be in separate boxes?

In 2, if you don't know code at all you can easily mistake to think that the command line does the stopping of Android Support. You need to do that from the Settings app.

In 3, please include the command line to make the sh file executable so that doesn't get lost in text.

In 4, please mention it's specifically Android 8.1 we need. I believe using the newest 9 would be a huge mistake.

In the second 3, please mention that downloading from Google Play doesn't seem to work, and as such you don't really need to and shouldn't sign up to your Google account during the configuration. The Play Services will work either way.

teemu ( 2019-05-12 23:00:48 +0300 )edit
1

@teemu It's a wiki, so you or whoever else can edit based on own results in order to clarify and possibly correct the howto. Anyway I will try to improve it myself based on your suggestions. Feel free to add your edits.

Giacomo Di Giacomo ( 2019-05-13 00:41:33 +0300 )edit

Strange that someone remove my link to final script to use -.-

Ahhh and remember if something go wrong, before next use you must remove opengapps, opengapps_2 and squash-root directory

Stanislav1988 ( 2019-05-13 06:22:04 +0300 )edit

@Giacomo I'm a bit wary to presume editing myself, I rather other people re-check my suggested edits for factuality.

Do I really have to do this again after every Sailfish OS update? I have installed Google Play Services by following the previous instructions posted on Jolla Together with older Android/Sailfish versions, and never had any trouble with the Android/Play Services functionality after a Sailfish OS update.

Is the situation different now because of there being expected updades in the Android Support (which at this point still is beta on XA2)? The Play Services probably will remain installed, but will the future Android-related updades mess up something that will effect on them?

I'm not looking to re-re-install every Android app every time.

teemu ( 2019-05-13 15:12:57 +0300 )edit
1

@teemu Yes. The problem is that now the Android system lies within a single compressed file (system.img). Otherwise there would not have been the need for all this stuff, we should just have copied the new files in the right places.

Giacomo Di Giacomo ( 2019-05-13 16:26:26 +0300 )edit

squashfs image is read only though? So installing Android apps doesn't change the image. But, the installed Android apps survive a Sailfish OS update that update the system.img, so the installation information apparently is stored elsewhere in the file system.

So, shouldn't apps installed with a modified system.img continue to work as is when there is a system.img update in a Sailfish OS update and you then (re-)modify that system.img in similar fashion? In theory at least?

teemu ( 2019-05-13 19:41:41 +0300 )edit

@teemu That's what I expect, but we will only know when 3.1.0 is out.

Giacomo Di Giacomo ( 2019-05-13 23:37:49 +0300 )edit

As I do not gibber androidish. What is the difference between this approach (opengapps) and the one using microG and stuff like deodexing'?

peterleinchen ( 2019-05-18 17:21:08 +0300 )edit
1

@peterleinchen These are the real Google apps, microG is an open source more-or-less-compatible alternative.

Giacomo Di Giacomo ( 2019-05-18 17:44:17 +0300 )edit
1

@peterleinchen I discovered that when I used MicroG I have heavy drain battery, than with Google Play Services

Stanislav1988 ( 2019-05-19 06:01:30 +0300 )edit

What should I actually do with this? 2. Copy system.img.gapps to /opt/alien/system.img.

edit: i did factory reset, started everything from beganning, but i still cannot find this system.img.gapps. Even when searching all folders.

antti1979 ( 2019-05-24 00:27:44 +0300 )edit

Was late but keep getting stuck at:

unzip:  cannot find or open ./Downloads/open_gapps-arm-8.1-pico-20190508.zip, ./Downloads/open_gapps-arm-8.1-pico-20190508.zip.zip or ./Downloads/open_gapps-arm-8.1-pico-20190508.zip.ZIP.

Should open_gapps-arm-8.1-pico-20190508.zip be placed in /Downloads or sub-directory Work and pass as parameter ./home/nemo/Downloads/open_gapps-arm-8.1-pico-20190508.zip or ./home/nemo/Downloads/Work/open_gapps-arm-8.1-pico-20190508.zip?

aspergerguy ( 2019-05-25 17:51:04 +0300 )edit

@aspergerguy did you used my .sh file ?

Stanislav1988 ( 2019-05-25 18:25:28 +0300 )edit

After some research and two or three factory resets I finally notice that file open_gapps-arm-8.1-pico-20190508.zip are having year/month/day before .zip-ending. The gapps-file downloaded from the webpage is have date when it was downloaded.

Therefore, the only way to use exact instructions (as i did), is to use download the file from 8th of May 2019 or make some manual changes :-)

Everything works like a dream and i feel silly.

antti1979 ( 2019-05-25 19:09:37 +0300 )edit

@Stanislav1988 Yes I did thanks, all good now as stupid mistake on my part as already in "Downloads" so command should have been:

[root@Sailfish Downloads]# ./install_opengapps.sh ./open_gapps-arm-8.1-pico-20190508.zip
aspergerguy ( 2019-05-25 23:06:10 +0300 )edit

I'm trying to install this on xa2 plus and went through the process for a number of times: always different behaviours. Especially when starting Android services Google setup starts and I skip all the stuff related to sim and networks but it goes in a sort of loop and doesn't finish the setup properly. I also notice that the two folders opengapps and opengapps2 are not created at all: most likely because the initial setuo does not complete properly. I'm on latest Hossa. Thanks in advance for any suggestion ...

glalli ( 2019-05-26 14:50:25 +0300 )edit

If you look at final command in "install_opengapps.sh" opengapps and opengapps2 are removed, so only present temporarily. What size is system.img.gapps as mine is 361.67MB compared to system.img.orig being 291.99MB? Are you carrying out process upon freshly formatted device or not? Got quite good at removing newly created squashfs-root folder to allow me to repeat the script:

rm -rf squashfs-root

Think I probably didn't wait long enough after re-starting Android support before hitting Play Store icon, but all came good in the end and downloads apps via network.

aspergerguy ( 2019-05-26 16:58:28 +0300 )edit

@aspergerguy Thanks for your reply. The script is successful, but then when I start Android support the Android setup starts almost immediately and wouldn't end even if I keep hitting "done". I don't know if there's something different with the dual sim version ... May be

glalli ( 2019-05-26 22:38:53 +0300 )edit

@glalli Should have made clear my XA2 is also H4113 Dual Sim, although only currently has one data enabled SIM in place. What happens if you open Play Store, are you given option to sign-in?

aspergerguy ( 2019-05-27 21:01:02 +0300 )edit

@glalli try and look what will done, if you have mobile connection and you are able to connect to the ethernet, so you can log-in into Google Account

Stanislav1988 ( 2019-05-27 21:10:48 +0300 )edit

Ok I went through the process quite a number of times: always from scratch after resetting the phone. Only on a couple of occasions I was able to sign-in to google. Most of the times as soon as the Android setup starts it will ask a few questions about sim settings, network, etc, then your name , finally one screen that should be the last one and I click on "done", but then it starts from the beginning again. What starts immediately after re-starting Android support looks exactly like setup on an Android phone, but missing some stuff and it will never complete properly. If I try to open the store then the same setup process starts over and over. Thanks for your help

glalli ( 2019-05-27 21:19:48 +0300 )edit

No luck at all installing google play. All went fine untill I need to copy system.img.gapps to opt/alien/system.img. Can't find system.img.gapps at all.

Gouneesz ( 2019-05-28 21:40:39 +0300 )edit

@glalli Resetting the phone should not be necessary, only removing /home/.android/data. Try skipping the Google login during the set up, as I have not tested this with a Google account. If you succeed then, but want to use your Google account, I suggest playing with the google_remove variable in the script (always stopping aliendalvik and removing /home/.android/data between each attempt) and seeing if the login succeeds.

Artur ( 2019-05-30 07:16:03 +0300 )edit

@Gouneesz Did you used my script file in this turial? And search in the directory when you had a gapps file

Stanislav1988 ( 2019-05-30 08:00:42 +0300 )edit

For the record, I did do this with signing in to Google Account during the initial setup. I didn't have any issues, everything worked fine.

... and then I did sign myself out of the Play Store by removing my account (using coderus' AliendalvikControl from OpenRepos), and everything still worked, and then I signed myself into the Play Store again and everything still worked. I didn't have any issues with the Google Account.

Downloads from Play Store didn't work on wifi though.

I had hard time installing the rpm files in step 1 though, and had to do it in different way.

teemu ( 2019-05-30 09:32:54 +0300 )edit
1

I cannot edit the question. Please change the line that installs squashfs-tools to rpm -U --oldpackage --nodeps https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/s/squashfs-tools-4.3-8.fc22.armv7hl.rpm instead of rpm -i, and remove the instructions specific to 3.0.10. No need to get the different version, and it will work for both cases.

Artur ( 2019-05-31 05:32:40 +0300 )edit

@Artur Done.

Giacomo Di Giacomo ( 2019-05-31 11:08:28 +0300 )edit

@Stanislav1988 yes I did use your script. If you mean install_opengapps.sh.zip.

Gouneesz ( 2019-05-31 17:13:04 +0300 )edit

Question:

does the logd daemon and logcat inside the container still work with your method?

I've notice that when unpacking (with unsquashfs) and repacking (mkdsquashfs) system.img some attributes are lost and logcat breaks.

I've tested it on a few desktop Linux boxes (as the signature spoofing for microG requires a bit more software and currenlt isn't compiled for smartphone) but maybe the specific version of squashfs you use inside the smartphone works better ? Maybe it's a x86 vs armv7 thing ?

I can circumvent the problem by using loop-mount and rsync -avPSHAX instead of unsquashfs.

DrYak ( 2019-05-31 21:58:39 +0300 )edit

@DrYak logd and logcat don't work. I get exacly the same stuff as you do when executing journalctl --follow

teemu ( 2019-06-01 18:29:17 +0300 )edit
1

Okay, so the unsquashfs used here is as broken as the one on my desktops.

@Arthur could you please test an rsync alternative ?

unsquashfs system.img.orig

should be replaced with something along the lines of :

mkdir -p squashfs-root tmp-mount
mount -o loop,ro system.img.orig ./tmp-mount
rsync -avPSHAX --inplace tmp-mount/ squashfs-root
umount ./tmp-mount
rmdir ./tmp-mount

Could you please test ?

DrYak ( 2019-06-02 13:37:07 +0300 )edit

Is there any chance that a later version of squashfs might work correctly?

Like, the topmost armv7hl one in https://www.rpmfind.net/linux/rpm2html/search.php?query=squashfs-tools:

squashfs-tools-4.3-20.fc31.armv7hl.rpm

teemu ( 2019-06-02 14:32:28 +0300 )edit

This Playstore port works like a charm! I can even download apps though Playstore with WIFI only. It hugely extends the services on my Sony Xperia XA2. Thanks for this wiki! p.s. I use vendor bin Nile version 16 on Hossa 3.0.3.10.

Rudge79 ( 2019-06-02 15:24:19 +0300 )edit

@teemu :

My desktop distro is a rolling one - openSUSE Tumbleweed - and even if it already has the latest 4.3 version of squashfs it shows the same buggy behaviour.

DrYak ( 2019-06-02 19:08:51 +0300 )edit

I tried this two times (factory reset in between) and arrived to the same issues. Aptoide does not work, so I installed APKpure instead. That works, I can install a news app like NOS (Dutch). First try I could download apps over Wi-Fi (I think), second time not. After rebooting to get mobile coverage, I entered my credentials in Play Store, and downloaded Whatsapp. Could not activate Whatsapp account: "This app won't work properly unless you allow Google Play services' request to access the following: SMS". First try I had a similar experience. Another app I tried, Garmin Smartphone Link, complained about Bluetooth not being accessible.
Steps taken after installing opengapps:
Hello - English
Connect to mobile network - Skip
Connect to Wi-Fi - Skip
Warning pop-up "Without connection..." - Continue
Date & Time (was correct) - Next
Name - X - Next
Google Services - Help apps find location - Off, Send usage and Diagnostic data - Off - Accept
Notification on Sailfish home screen, pressed that
Play Protect, pressed gear symbol to find Play Protect settings - Off - pressed Back arrow
Google Services screen - Back up to Google Drive - Off. Can't remember what came after that. Probably I accepted this screen. Don't think there were options to access SMS etc.
When prompted in Whatsapp about SMS access, there was an option to Open Settings. New Android window opened, but nothing reacted to touch.
I hope you have a solution, and thanks Giacomo for delivering for this break-through anyway!

rob_kouw ( 2019-06-08 12:48:37 +0300 )edit

@rob_kouw I think I answered you in other thread. But, go to Settings - Apps - Whatsupp - Open Android Settings and give Whatsapp rights to use SMS. And then try again. Try both mobile and wi-fi, in case there's a network issue too.

(there is a bug that makes Android apps unresponsive when they are opened by another Android app, which apparently happens to you when Whatsapp calls up the (Android) Settings app.)

teemu ( 2019-06-08 13:14:44 +0300 )edit

Great! It works. (It doesn't work for Garmin Smartlink, but maybe I should not expect a difficult subject like Bluetooth to work.) Thanks!

rob_kouw ( 2019-06-10 10:19:35 +0300 )edit

@DrYak I tried to do this on my XA2/3.0.3.10 with the changes you suggested to the sh script:

$ devel-su ./install_opengapps.sh open_gapps-arm64-8.1-pico-20190530.zip
Password: 
rsync: --sparse cannot be used with --inplace 
rsync error: syntax or usage error (code 1) at main.c(1554) [client=3.1.0]
[nemo@Sailfish Downloads]$

The rsync package installed on my Sailfish is rsync-3.1.0+git2-1.4.1.jolla.armv7hl, should be the vanilla one.

teemu ( 2019-06-11 10:00:41 +0300 )edit

@DrYak how did you manage to use --sparse and --inplace together? I understand you got it working for yourself?

teemu ( 2019-06-12 15:10:21 +0300 )edit

Using --sparse and --inplace simultaneously requires:

  • a recent enough ( >= 3.1.3) rsync version (its disallowed on older).
  • a filesystem that supports hole-punching (ext4, btrfs)

works on recent desktop distros (e.g openSUSE Tumbleweed), but indeed the one inside Sailfish is older and thus you must drop either one. (there aren't many sparse files, there isn't much space saving).

DrYak ( 2019-06-12 16:11:03 +0300 )edit
1

Note: i got i working myself... for MicroG.

Which runs on the desktop in a docker container because you need to run some signature spoofing patches that require a full Java stack.

My mods use a very recent docker base layer, so I completely forgot about old rsync versions on plain Sailfish as used for Google Play Service blobs here.

My bad.

Debian stable and RaspBian should suffer from the same problems (ships with 3.1.2).

DrYak ( 2019-06-12 16:18:03 +0300 )edit

I tried manually doing what the script does on Linux Mint that should be up to date, but probably is having too old rsync still.

But, I can leave --sparse out then? I tried that too on my XA2, but there came some fatal issue in the umount bit. Apparently tmp-mount was still active or something. Terminal stuck and the phone auto-rebooted.

teemu ( 2019-06-12 16:47:01 +0300 )edit
1
  • --sparse tries to keep sparse files sparse, i.e. empty part of file that don't contain data and thus don't need to actually be written on disk. I'm using it out of habit, but I don't think there are many in Android.
  • --inplace modifies files directly. Other wise the default behaviour is make a new temp copy and swap the files once copying is finished. If you're running this pipeline only once it doesn't make any difference. If you're running multiple tries, this will simply just replace the couple of byte you've modified, instead of the whole file.

You can leave out both, I'm just using them out of habit (when uploading multiple attempts at patching system.img you can imagine the time saving of just overwriting the tiny part that changed between attempts, vs. create a whole new copy of the file each time)

Apparently tmp-mount was still active or something.

I would suspect that some background process decided to go inside and do stuff. Probably the media indexer ? You can prevent it from indexing something by creating a file.

touch .nomedia

The problem is that you're probably running the script in your home and you probably want it indexed, so don't forget to

rm .nomedia

at the let the indexer go there again.

(I think I should be also possible to prevent indexing if you use a hidden file name, so ./.tmp-mount instead of ./tmp-mount - note the leading dot).

DrYak ( 2019-06-12 17:19:31 +0300 )edit

just for the record, the important options of rsync are:

  • a (archive) copies nearly everything
  • H (hard-links) hard links are also carried over (two different files being actually the same on disk)
  • A (ACLs) rights beyond the simple chmod's u/g/o "rwx" are also carried over.
  • X (xattr) extended attributes are also copied.

this last one, i think, is what the bug squashfs loses.

DrYak ( 2019-06-12 18:13:16 +0300 )edit

I tried so hard, and got so far. But, in the end, it doesn't even matter. journalctl --follow still has the same old logd failure action going after my attemps to use rsync instead of squashfs.

teemu ( 2019-06-12 19:25:55 +0300 )edit

I don't have some lyrics to creatively riff on, but - in a moment of "palm meets face":

  • exactly which system.img did you loop-mount and rsync from? the original pristine one that came from Jolla? or the one that already got trashed during a previous attempt?

I mean it's nice to put tons of efforts to keep the xattrs, but if they aren't there to begin with...

Didi you get the

WARNING: re-using existing system.img.orig

message ? And was that existing file copied from the original file?

If you lost the original file, force re-install the package aliendalvik.

DrYak ( 2019-06-13 13:04:32 +0300 )edit

I suspected something like that having happened to system.img myself, and tried removing and reinstalling Android Support but managed to only mess my system so that I had to do a factory reset.

And with this factory reseted installation, I executed the actions in this guide, using rsync to unsquash the extremely pristine system.img.

And the damn logd stuff just keeps going on when I journalctl --follow.

My alterations to the script (replacing the row "unsquashfs system.img.orig"):

mkdir -p squashfs-root .teemu
mount -o loop,ro system.img.orig ./.teemu
rsync -aPHAX .teemu/ squashfs-root
umount ./.teemu
rmdir ./.teemu

The Google setup btw is much messier now than in May when I did it previously. Android setup windows open other setup windows, which tend to be unresponsive.

teemu ( 2019-06-13 14:34:52 +0300 )edit

Are we sure that mksquashfs doesn't do something nasty with them xattrs which squashfs-tools can't handle to the other way either?

teemu ( 2019-06-13 17:56:44 +0300 )edit

according to mksquashfs --help:

-xattrs stores extended attribues (default)

it Should be storing them by default...

if you pay attention, at the end mksquashfs should output a summary, and when comparing the unsquash vs rsync versions, the latter should have a line with some counts about extended attributes (don't remember exactly, don't have my laptop around atl the moment).

DrYak ( 2019-06-13 20:42:57 +0300 )edit

It says this:

inflating: opengapps/META-INF/CERT.RSA
mksquashfs: /usr/lib/liblzma.so.5: no version information available (required by mksquashfs)
Parallel mksquashfs: Using 2 processors
Creating 4.0 filesystem on system.img.gapps, block size 131072.
[====================================================================================================-] 5775/5775 100%

Squashfs 4.0 filesystem, lz4 compressed, data block size 131072
compressed data, compressed metadata, no fragments, compressed xattrs
duplicates are not removed
Filesystem size 354097.47 Kbytes (345.80 Mbytes)
58.80% of uncompressed filesystem size (602189.67 Kbytes)
Inode table size 52562 bytes (51.33 Kbytes)
41.13% of uncompressed inode table size (127805 bytes)
Directory table size 28496 bytes (27.83 Kbytes)
57.28% of uncompressed directory table size (49752 bytes)
Xattr table size 1065 bytes (1.04 Kbytes)
26.92% of uncompressed xattr table size (3956 bytes)
No duplicate files removed
Number of inodes 2060
Number of files 1454
Number of symbolic links  340
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 266
Number of ids (unique uids + gids) 6
Number of uids 3
root (0)
system (1000)
logd (1036)
Number of gids 6
root (0)
system (1000)
cache (2001)
shell (2000)
sdcard_r (1028)
logd (1036)
[nemo@Sailfish Downloads]$
teemu ( 2019-06-13 21:52:27 +0300 )edit

If I do it with -noX ("do not compress extended attributes"), Xattr table size is 3782 bytes (3.69 Kbytes), and 95.60 % of uncompressed xattr table size (3956 bytes)

The logd issue will keep happening with this system.img with uncompressed Xattr too... and Android apps seem to refuse to start, though Android support will

teemu ( 2019-06-13 23:18:53 +0300 )edit

doing just a de-pack / repack of the original system.img, from the laptop

my table when doing rsync: 4036 (compressed to 1089)

my table when doing unsquashfs: 3916 (compressed to 1038)

there's 120 bytes of xattrs lost somewhere between the two.

Your attempts seems closer to my unsquash attempt.

To tired (and no USB cable) to redo the tests on the smartphone, but in the past, the unsquash one was making problems, not the rsync one.

I don't know waht to do to help.

DrYak ( 2019-06-14 00:03:52 +0300 )edit

Oh I'm quite happy with this level of functioning and the slight extra overhead that the patched Android runs. I don't really need logd for anything myself. This was just intelligence gathering mission in case someone wants to fine tune the process, or maybe unearth the bug that's doing it.

teemu ( 2019-06-14 00:28:10 +0300 )edit

And then I executed the same script (with rsync) on my Linux Mint, same system.img.orig and other input, and with this version of system.img.gapps there's no journalctl overhead and logd works just fine.

I match your Xattr count after this run: Xattr table 4036 bytes, compressed 1089

squashfs-tools 1:4.3-6ubuntu0.18.04.1
mksquashfs version 4.3-git (2014/06/09)

rsync 3.1.2-2.1ubuntu1
rsync version 3.1.2 protocol version 31

So to find where the xattr loss happens, I guess one would have to unsquashfs system.img.orig and rsync system.img.orig on both XA2 and on the computer and then mksquashfs the versions of squashfs-root with the other device and compare the results.

teemu ( 2019-06-15 00:13:39 +0300 )edit

But... it has to be the rsync on Sailfish. The uncompressed number obviously is what it is after rsync, the compressed number is what comes from the mksquashfs compression. Sailfish rsync gives me 3956 uncompressed bytes, Linux Mint rsync 4036.

Unless mksquashfs in Sailfish does something silly when taking the uncompressed input from the squashfs-root folder.

edit: just for laughs, I executed the unsquashfs version of the script on my Linux Mint laptop: Xattr table size 1088 bytes compressed, 4036 bytes uncompressed. It's 1 byte less in the compressed Xattr, but both rsync and squashfs versions of the script end with the same 4036 bytes.

On Sailfish OS, unsquashfs return me 1038 compressed and 3916 uncompressed bytes of Xattr. rsync return 1065 compressed and 3956 uncompressed bytes of Xattr. There is a noticeable difference of 50 bytes between unsquashfs and rsync when doing it on the phone, and both lose xattr information compared to the Linux Mint versions of unsquashfs and rsync.

teemu ( 2019-06-15 00:25:39 +0300 )edit

thanks for you exploring this.

(other possible source of loss: for some reason the XA2 isn't capable of storing them correctly. Maybe trying to rsync directories over SSH between the laptop and xa2 to further explore ?)

DrYak ( 2019-06-15 11:33:55 +0300 )edit

@DrYak you said in the other thread that you filed a bug ticket with Jolla (on the unsquashfs?), but the xattr loss problem seems to be a bigger issue with unsquashfs/mksquashfs/rsync when executed on the phone (at least XA2).

Can you update the ticket, and would we maybe need a separate topic on TJC for the issue to entice interest?

teemu ( 2019-06-15 14:44:58 +0300 )edit
1

@DrYak@teemu Seems to be a bug in this version of rsync. Running it twice copies the correct xattrs on the second try. See my answer for a script that patches the image without breaking logcat: https://together.jolla.com/question/205890/howto-install-google-play-services-on-baseport-8-devices-from-the-phone-itself-tested-working/?answer=207956#post-id-207956

Artur ( 2019-06-15 15:38:51 +0300 )edit

13 Answers

Sort by » oldest newest most voted
0

answered 2019-08-09 13:25:43 +0300

ehakkarainen gravatar image

updated 2019-08-09 13:26:17 +0300

Getting stuck (loop?) in the Android setup phase "Checking information" (in Finnish "Tarkistetaan tietoja") - any advice?

edit flag offensive delete publish link more

Comments

skip all steps in window, and add account after skip all this steps

Stanislav1988 ( 2019-08-09 14:06:36 +0300 )edit

Hi. After install .sh do it:

rm -rf /home/.android/*

Else skip all steps in window, and finish. After open Play Store and add the acocunt

Rafaelvlmendes ( 2019-08-09 19:20:50 +0300 )edit

Did someone try this procedure using the above script for sfos 3.1.0.11 for xa2? Are you able then to run the youtube app, which requires google play services to work?

xidira ( 2019-08-15 00:13:16 +0300 )edit

@xidira yes. All fun and the apps all right.. I want create a new tutorial. If you have questions I send here

Rafaelvlmendes ( 2019-08-15 01:16:50 +0300 )edit
0

answered 2019-08-27 06:56:47 +0300

babo gravatar image

updated 2019-08-27 08:32:09 +0300

Ever since the 3.1 update, im trying to make that work.Everything goes as expected and I finish the setup.However, when I try to log into google (through playstore or settings) it doesn't work and I get this :

image description

Appreciate any help

edit flag offensive delete publish link more

Comments

Have you tried on both mobile connection and on wifi?

I at least still have ongoing issues on 3.1 with Android apps that seem to seemingly randomly and without logic fail to work either with mobile or wifi but with the other connection will work without problems.

The app won't even communicate to me that it's not doing anything because of "no internet connection", but when trying with other connection it will work like there never was a problem.

teemu ( 2019-08-27 10:55:18 +0300 )edit

I can confirm this. Get the same message on XA2 with SailfishOS 3.1 and wifi connection.

MaxT ( 2019-08-27 12:34:24 +0300 )edit

@teemu Yes I have tried both connections, even tried it with VPN. Everything Android-related works fine

babo ( 2019-08-27 12:36:28 +0300 )edit

When you say Settings, do you mean:

  1. Settings - Accounts (the Sailfish OS side of things), or

  2. the Android side settings at Settings - Apps - [any Android app] - Open Android Settings - [back button to main Android settings] - Users and Accounts?

edit: 3. Or the gray cogwheel iconed Google Settings app?

teemu ( 2019-08-27 14:47:14 +0300 )edit

Hey but hey!

As the debugging should work now, you can access the Android logs on the Terminal by:

lxc-attach -n aliendalvik -- /system/bin/logcat

Open the logging as devel-su and leave it running, then try to sign to Play and see from the log what fails to happen.

Further reading: https://together.jolla.com/question/204859/how-to-help-debug-android-support/?answer=204871#post-id-204871

teemu ( 2019-08-27 14:58:57 +0300 )edit
0

answered 2019-12-21 21:07:32 +0300

Jowe gravatar image

will this tutorial and/or script work on an Android 9 base with Sailfish X version 3.2.1.20 on an Xperia 10?

If not, what adaptations must be made?

Thank you for all of your hard work on this!

edit flag offensive delete publish link more

Comments

1

I don't have an Xperia 10 to test. Try it. In the worst case you can reinstall Aliendalvik.

Artur ( 2019-12-21 21:47:24 +0300 )edit

Awesome. Thanks. I'll report back and let you know what I find out.

Jowe ( 2019-12-21 22:04:53 +0300 )edit
1

The short answer is it didn't work perfectly. I updated your script to download the correct gapps (Android 9) and installed it. It did install google play store. It did however force close the store right after starting it. I was also getting an error about updating the store if I remember correctly. I can investigate further for science after dinner.

Jowe ( 2019-12-21 23:01:29 +0300 )edit

Thanks for the feedback. So Aliendalvik for the 10 is actually Android 9?

I didn't use Play Store, iirc I always disabled it. Now I'm using MicroG and no Google Apps at all. Might try to debug the script's current status next month.

Artur ( 2019-12-24 03:25:13 +0300 )edit

Hello,

I have also now a Sony Xperia 10 with SFOS 3.2.1.20. I came from Jolla C and miss now the google play services for some apps (ZÄPP, my DVG). Bedcause I want to try this but in Salfish X the folder '/opt/alien/system/priv-app/' not exist now. Follow way I wan't to try, but I am affraid that the Phone need a factory reset after it.

devel-su
"password" ENTER
systemctl stop aliendalvik.service
systemctl mask aliendalvik.service
#copy the 4 files withe root file explorer to the directory /opt/alien/system/priv-app/
#(GmsCore.apk, GoogleLoginService.apk, GoogleServicesFramework.apk, Phonesky.apk)
systemctl unmask aliendalvik.service
systemctl start aliendalvik.service
apkd-install Phonesky.apk

The 4 files are in the zip file from here in the folder: "gapps-kk-20140606-signed\system\priv-app".

Could you help me with this easy way. I have no linux pc. It is possible to open the system.img file to add the 4 files? Or it is possible to install the 4 files manually?

Thanks for your answer in advance

Ralf ( 2019-12-29 13:24:07 +0300 )edit
Login/Signup to Answer

Question tools

Follow
22 followers

Stats

Asked: 2019-05-12 22:31:26 +0300

Seen: 8,433 times

Last updated: Dec 21 '19