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

Revision history [back]

click to hide/show revision 1
initial version

posted 2019-05-12 22:31:26 +0200

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

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 dowlonad 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 -i --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, 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 from happening.

  3. Create an install_opengapps.sh script with the following content, and make it executable. 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 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).

(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.)

7. 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.

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

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 dowlonad 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 -i --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, 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 from happening.

  3. Create an install_opengapps.sh script with the following content, and make it executable. 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 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).

(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.)

7. 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.

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

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 dowlonad 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 -i --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, 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 from happening.

  3. Create an install_opengapps.sh script with the following content, and make it executable. 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 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).

(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.)

7. 4. 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.

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

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 dowlonad 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 -i --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, 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 from happening.

  3. Create an install_opengapps.sh script with the following content, and make it executable. 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 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).

(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.)

4. 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.

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

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 -i --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, run Support from Settings -> Android Support. Run devel-su rm -rf /home/.android/*. This ; this will uninstall all your current Android applications and remove their data. This is useful to avoid weird things from happening.

  3. Create an install_opengapps.sh script with the following content, and make it executable. 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).

(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.)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.

4. 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.

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

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 -i --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 from happening.

  3. Create an install_opengapps.sh script with the following content, 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).

(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.

4. 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

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

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 -i --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 from happening.

  3. Create an install_opengapps.sh script with the following content, 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).

(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.

4. 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

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

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 -i --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).

(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.

4. 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

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

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 -i --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).

(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).

4. 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

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

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. For 3.0.3.9:

    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 -i --nodeps https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/22/Everything/armhfp/os/Packages/s/squashfs-tools-4.3-8.fc22.armv7hl.rpm
    

    For 3.0.3.10:

    Install lzip:

    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
    

    Then download libzma and squashfs-tools rpms and install them from Sailfish (select them via the Sailfish file browser, then select Install from the pull-down menu).

    The difference appears to be due to the presence in 3.0.3.10 of a version of squashfs-tools newer than the one used in the above procedure for 3.0.3.9, but without lz4 support.

    Of course the procedure for 3.0.3.10 should also work for 3.0.3.9; that one is kept as a reference.

  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).

(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).

4. 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

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

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. For 3.0.3.9:

    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 -i -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
    

    For 3.0.3.10:

    Install lzip:

    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
    

    Then download libzma and squashfs-tools rpms and install them from Sailfish (select them via the Sailfish file browser, then select Install from the pull-down menu).

    The difference appears to be due to the presence in 3.0.3.10 of a version of squashfs-tools newer than the one used in the above procedure for 3.0.3.9, but without lz4 support.

    Of course the procedure for 3.0.3.10 should also work for 3.0.3.9; that one is kept as a reference.

  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).

4.

  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

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

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