You are here:Home»KB»Mobile Phones»Android»Samsung S2 - Cannot install GApps on CM13.0, Insufficient space on system partition
Monday, 30 May 2016 13:41

Samsung S2 - Cannot install GApps on CM13.0, Insufficient space on system partition

Written by

The Problem

This is a weird one. I updated my Samsung S2 to Cyanogenmod 13.0 (cm-13.0-20160528-NIGHTLY-i9100 / Android 6.01) which went well but every time I tried installing the GApps I got the error ’Not enough room on the system partition to install’. At first I check my drives and there was room on the SD card and data partition. These are not the system partition which was my first mistake. The system partition on an S2 is on 500mb in size so it is only just enough room for CM13.0 but not GAPPS as well.

The Fix/Theory

In simple terms we need to alter the partition sizes. The S2 comes with a 16GB flash chip but for some reason Samsung on gave 500mb to the system partition and 2.0GB to the data partition.

We will make the system partition larger and while we are at it, make the data partition bigger. System partition will go to 1GB and the data partition will go to 6GB. The Internal SD will take the remainder and ends up about 7.5GB

What Are We Going To Do?

Now I have given you the idea of what we are going to achieve, here come the tricky bit. I have learnt this information from many different places to put together simple instructions especially for those who are not experienced at flashing but I do encourage you to read my instructions and then have a look at the links and research I have put together just in case I have got anything wrong.

To repartition the phone we will use the REPIT from Lanchon but that needs to have an IsoRec compatible Bootloader/Recovery in place otherwise issues will occur and could possibly brick your phone.

The ROM being loaded also needs to be IsoRec compatible I believe otherwise it might not load correctly. I am not 100% about this.

Because of how things are you most likely cannot just install the latest version of TWRP which is IsoRec compatible because it is only available in an img format. To get around this we will install an older version of TWRP which is available in zip format that can be installed from most Custom Recoveries. Once this old version of TWRP is installed we can then use it to install the newer version in the img package format. There are other ways to install the img package:

  • HeimDall - I tried this and it doesn’t work. The software just give me errors and I don’t think the software has been updated in ages
  • Side load – not 100% what this is
  • ADB – via the command line
  • Other Custom Recoveries

NB: I don’t think you can install the img packages via ODIN. ODIN is file system aware and I think img are binary files

Make sure your battery is charged and perform these actions whilst the phone is plugged into the mains.

Instructions

These instructions are geared for my Samsung Galaxy S2 i9100 Int

Overview

  1. Backup phone
  2. Install CM13 (IsoRec compatible ROM)
  3. Install old version of TWRP via a custom recovery to add img support
  4. Install TWRP 3 which is an IsoRec compatible recovery
  5. Run the REPIT software to repartition the Samsung S2 Flash Drive
  6. Install GAPPS
  7. Wipe cache and data
  8. Reboot
  9. Done

Full Instructions

Preparation

1. Download the following files to your PC

  1. recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip - This is an IsoRec compatible version of TWRP v2.8.7.0 by arnab in a zip format that you can install via most Recoveries. This is specific to a Samsung S2
    or
    twrp-3.0.2-0-i9100.zip (latest version in zip format)
  2. twrp-3.0.2-1-i9100.img - This is a new official version of TWRP in img format for a Samsung S2
  3. lanchon-repit-20160415-system=1.0-data=same-sdcard=max-preload=min+wipe-i9100.zip
    • This is REPIT by Lanchon for the Samsung S2
    • The files are specific to your phone, if there is no file then you cannot use this method.
    • You can request a file for the process
  4. SAMSUNG_USB_Driver_for_Mobile_Phones.zip - needed to connect to your phone, if not already installed
  5. cm-13.0-20160528-NIGHTLY-i9100.zip - Latest version of Cyanogen mod Android for the Samsung S2
  6. open_GApps-arm-6.0-micro-20160529.zip - CM13 / Android 6 compatible GAPPS

2. Rename the REPIT file

lanchon-repit-20160415-system=1.0-data=same-sdcard=max-preload=min+wipe-i9100.zip
-->
lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip
  1. I changed -data=same to -data=6
  2. This files will set 1GB system partition and a 6GB data partition
  3. The file name controls the repartitioning options
  4. The file is specific to the model of the phone

3. Copy the following files to your phones Internal SD Card

  1. recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip
  2. twrp-3.0.2-1-i9100.img
  3. lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip (note it is the one with the larger data partition)
  4. cm-13.0-20160528-NIGHTLY-i9100.zip
  5. open_GApps-arm-6.0-micro-20160529.zip

4. Backup all that is important to you, pick whatever method you prefer. A nandroid and a files backup is the best. Copy the backup of the phone on to your PC

Install Cyanogen mod 13

  1. Install cm-13.0-20160528-NIGHTLY-i9100.zip via recovery as normal
    • Can be done later just before installing GAPPS, I found I had to do it this way because TWRP would not replace Clockworkmod. (or appeared so)
    • It did install but when Clockworkmod rebooted to bootloader, Clockworkmod just re-loaded
    • after I installed CM13 and booted to Recovery, TWRP loaded without re-installing it again meaning it must of installed previously but Clockwordmod did not properly unload from memory
    • NB as ever, it is better to wipe your cache and do a factory reset to prevent incompatibilities

Upgrade the Recovery with IsoRec compatible TWRP

  1. Install an old version of TWRP via recovery (recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab).zip)
    • SD Card might of got wiped here
    • We have to install an old version of the TWRP so we can install the latest version of TWRP which is in img format.
    • If your custom recovery supports the install of img files you can probably skip this step
    • Reboot to recovery - This loads TWRP v2.8.7.0
  2. Upgrade to the latest vcersion of TWRP (twrp-3.0.2-1-i9100.img)
    1. Flash twrp-3.0.2-1-i9100.img via TWRP - When prompted which partitions to flash, select Recovery
    2. Reboot to Recovery - this loads the new TWRP v3.0.2.1

Repartition the Flash Drive

We now are going to repartition the drive which is very simple, when you know how. This will give a 1gb system partition and a 5.91GB data partition, the internal SD Card will take the rest of the space which is about 7.49GB

  1. Plug your phone into the mains if not already.
  2. Assuming you are still in TWRP v3.0.2.1 , Browse to and flash the REPIT file:
    lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip
  3. It most likely will fail first time and say it has copied itself to the /tmp/ directory. This is fine. If it actually processes your phone skip flashing from the /tmp/ directory steps.
  4. Browse to /tmp/ in TWRP by going up one level in the folder tree
  5. Flash the REPIT file in the /tmp/ directory:
    /tmp/lanchon-repit-20160415-system=1.0-data=6-sdcard=max-preload=min+wipe-i9100.zip
  6. The partitions will now get resized. Mine took about 15 minutes and kept the /system/ files, possibly the /data/ files and the Internal SD Card files. I did not have that much on my phone, possibly a 200mb – 300mb, so you time might vary.
  7. Perform a System Reboot to make sure Android loads and runs ok and the partitions are the correct size etc... (optional)

Install GAPPS

  1. Reboot back in to recovery and install GAPPS
  2. Flash this file via the recovery partition open_GApps-arm-6.0-micro-20160529.zip
  3. Clear /Cache/ and /data/ partitions
    1. A Factory Reset as might remove GAPPS (check this)
  4. Perform a System Reboot

Final Settings

  1. CM13 will now load and you should setup as normal.
  2. Once you have setup the phone, make sure that Cyanogen mod is not configured to replace the bootloader as I am not 100% sure if this will stop things working or if it was just whilst repartitioning the drive. This option is found in the Developer Options.
  3. Finished

Done, What Now?

You now should have a Samsung S2 with a much larger system and data drive. Dont forget you can always re-run this process and make the drives larger, but for now you can just use your phone for flashing ROMs as you have in the past. The only exceptions I can see is do not flash stuff by ODIN as I do not know if it will break anything.

Notes

These are my notes I made whilst I figured all of this out, which would of not been possible without the guys who did the all of the programming.

Flashing Compatible TWRP

  • TWRP for Samsung Galaxy S2 i9100 – Official Home Page for the Samsung S2
  • Installing TWRP 3 the Easy Way – This shows you how you can load TWRP img file via ADB. (it is also the IsoRec homepage)
  • [RECOVERY] [ISOREC] [TWRP 3.0.2-1] [OFFICIAL] [26/04/2016] (Official thread by arnab)
    • Flash via Recovery
    • Flash via Heimdall Suite (Windows only)
    • Update via Recovery
    • Side Load
    • Can you get a new compatible recovery via the play store?
  • Two things I found:
    • adb side load isn't actually exposing any adb, but instead creates a "USB storage" device
    • when files are copy-pasted via MTP, last modified date is changed

IsoRec

  • IsoRec is a new feature which I believe allows for the use of a combined recovery/bootloader partition. Either way bootloader either support it or they don’t.
  • [MOD] IsoRec: Isolated Recovery for the Galaxy S2 – XDA Developers thread explaining what this technology is
  • [RECOVERY] [ISOREC] [TWRP 3.0.2-1] [OFFICIAL] [26/04/2016]
    • XDA Developer thread for TWRP 3.0.2-1
    • Maintained by arnab
    • This has various installation instructions
      • Flash via Recovery
      • Flash via Heimdall Suite (Windows only)
      • Update via Recovery
  • Download links for:
    • HeimdallSuite_v1.4.0.zip
    • SAMSUNG_USB_Driver_for_Mobile_Phones.zip
  • The i9100 does not support a separately bootable recovery partition. To install and use TWRP, you will need to install a custom kernel or boot image that supports IsoRec
  • CM12.1 and CM13 has IsoRec support

REPIT

  • GitHub Homepage
    • This site has some very good instructions on how it works
    • The example instructions and filenames are for the i9100
  • Original XDA Developers thread (no longer updated)
  • The Software
    • A Device-Only Data-Sparing Repartitioning Tool For Android (keeps your data)
    • The REPIT files are Phone specific
    • The operations are controlled by the filename
    • Use of this requires an IsoRec compatible Recovery to be installed

PIT Files

Cyanogen mod

  • You need to make sure that you install GAPPS and CM13 at the same time otherwise it might go mental (check this)
  • I have not seemed to of had any problem but if you install GAPPS before 1st use, the Google wizard runs on first boot. This might also happen when you install GAPPS later but I am not sure.
  • CM 13.0 Release 1 – Official blog post. It outlines some issues.
    • CM13.0 is funny about installing GApps apparently. You must install both packages at the same time (CM and GApps) with no reboot otherwise it might go mad. I have not seen this.
  • Samsung Galaxy S2 by CNBLACK ROM set which Contains
    • cm-12.1-20160406-UNOFFICIAL-i9100.zip
    • cm-12.1-20160406-UNOFFICIAL-i9100.zip.md5sum
    • Cyanogen Recovery - i9100.tar - An ODIN Flashable Recovery

Heimdall

 

Read 14421 times Last modified on Tuesday, 31 May 2016 12:21