-2

This question is uncommon and may not apply to a lot of you. But I dropped two phones in a row so I needed to grab my old Samsung Galaxy Ace 2 GT-I8160 backup phone and revive it. I had it already running with a previous version of Cyanogenmod 11 (Android 4 Ice Cream Sandwich) and already saw that I could possibly run it with Anroid 4.4.4 and a custom Kernel from XDA Developers Forum (last updated Jan 30th 2023).

Although that might be sufficient for others, it turned out that the messenger application I'm using is Signal for Android, which has a minimum OS requirement of Android 5.0.

Later I discovered a more recent version of Cyanogenmod / LineageOS 13 (Android 6.0.1 Marshmallow) on XDA Developers Forum, which was referring a packed Version of SergeyL on the 4PDA forum. I downloaded lineage13.0-20180914-UNOFFICIAL-codina_SergeyL.zip from the given link in the 4PDA forum and made sure it fits the given md5sum dd59385470e5b41be75fcec0377fb910.

To download Signal from the Google Play Store I opted for Open GApps ARM 32bit for Android 6.0 and the Pico variant (Ace 2 has a ARM Cortex A9, ARM v7 32bit CPU). I downloaded open_gapps-arm-6.0-pico-20220215.zip from the Open GApps website.

Because I was certain that I can install both packages, I put them onto a Micro SD card, plugged it into the phone and booted into CWM (ClockWorkMod). Installing Cyanogenmod / LineageOS 13 went pretty well. So I rebooted and recognized, that CWM had been replaced by TWRP 3.0.2-0 (Team Win Recovery Project). When I tried to install GApps i got an Error Code: 70. It told me: Insufficient storage space available in System partition. You may want to use a smaller Open GApps package or consider removing some apps using gapps-config. To keep it short, the proposed solution of using a gapps-config file wouldn't work. Wiping System, Data, Cache from TWRP and installing everything again gave the same result.

So the question is: How to install Cyanogenmod / LineageOS 13 (Android 6.0.1 Marshmallow) with GApps and Signal Messenger onto a Samsung Galaxy Ace 2 GT-I8160?

1 Answer 1

0

Caution

Before using the solution please make sure you understood the following:

  1. The proposed solution is only suitable for a clean install (a.k.a. from scratch).
  2. The proposed solution modifies the patition table of the phone. You are risking a bricked phone (especially if u edit other partitions related to the bootloader). Also entering wrong numbers may lead to a corrupt partition table.
  3. The proposed solution expects you to be familiar with CWM (ClockWorkMod), TWRP (Team Win Recovery Project) and ADB (Android Debug Bridge).
  4. The proposed solution expects having USB-Debugging on your phone enabled.
  5. The proposed solution expects having CWM or TWRP installed. If you do not know, how to do this, search for it. Basically it's using adb and fastboot to unlock your device and flash a recovery image (like TWRP) to your phone.

Solution

While searching for a solution I tried to figure out, what size the system partition has and what is left. I used TWRP, navigated to Wipe > Advanced Wipe > Select System > Repair or Change File System and discovered it beeing 590 MiB having some 100 MiB left. Obviously this was not enough. Because I had no idea how to solve it, I tried using the option Resize File System which didn't do anything to the partition size.

I was asking myself, if this phone has internal memory capacity of 4 GiB, would it be possible to swap space from another partition to system. While searching for a solution I discovered, that someone else had the same idea like me here on StackExchange. But unfortunately it uses custom build binaries (of parted and gdisk) for another phone which I wouldn't want to use here, because I would risk damaging my partition table. Also using resizepart seemed error prone to me, because the version of parted which my phone had installed didn't recognize ext4. Furthermore the whole description seemed like a lot of guessing to me.

My decision was to manually edit the partition table with the onboard tools of my phone, which I could've done with the command line from TWRP. Instead I plugged my phone into the USB port and used adb from Debian Bullseye:

$ uname -a
Linux MACHINENAME 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
$ adb --version
Android Debug Bridge version 1.0.41
Version 28.0.2-debian
Installed as /usr/lib/android-sdk/platform-tools/adb

First I checked for the partition numbers and sizes of system and data paths.

$ sudo adb shell df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   322.6M     64.0K    322.5M   0% /dev
tmpfs                   322.6M    212.0K    322.4M   0% /tmp
/dev/block/mmcblk0p7      9.8M      4.6M      5.2M  47% /efs
df: /mnt/.lfs: Function not implemented
/dev/block/mmcblk0p8      1.1G      1.1G     10.7M  99% /sdcard
/dev/block/mmcblk0p8      1.1G      1.1G     10.7M  99% /and-sec
/dev/block/mmcblk1p1     14.8G      1.6G     13.2G  11% /external_sd
/dev/block/mmcblk0p17
                         15.5M     10.5M      5.0M  67% /ramdisk
/dev/block/mmcblk0p3    602.4M     10.0M    592.3M   2% /system
/dev/block/mmcblk0p4    301.2M      5.0M    296.2M   2% /cache
/dev/block/mmcblk0p5      1.2G     21.4M      1.2G   2% /data

Then I unmounted those paths and used parted to discover the partition's device /dev/block/mmcblk0 and its partition table.

$ sudo adb shell umount /data
$ sudo adb shell umount /system
$ sudo adb shell
~ # parted /dev/block/mmcblk0 
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print free                                                       
print free
Model: MMC SEM04G (sd/mmc)
Disk /dev/block/mmcblk0: 3959MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags
        17.4kB  524kB   507kB   Free Space
10      524kB   1573kB  1049kB               PIT
 6      1573kB  3146kB  1573kB               CSPSA FS
        3146kB  4194kB  1049kB  Free Space
 7      4194kB  14.7MB  10.5MB  ext4         EFS
 2      14.7MB  31.5MB  16.8MB  ext4         Modem FS
        31.5MB  32.5MB  1049kB  Free Space
14      32.5MB  34.6MB  2097kB               SBL
16      34.6MB  36.7MB  2097kB               SBL_2
 1      36.7MB  53.5MB  16.8MB               PARAM
12      53.5MB  55.6MB  2097kB               IPL Modem
13      55.6MB  72.4MB  16.8MB               Modem
15      72.4MB  89.1MB  16.8MB               Kernel
17      89.1MB  106MB   16.8MB  ext4         Kernel2
 3      106MB   748MB   642MB   ext4         SYSTEM
 5      748MB   2056MB  1309MB  ext4         DATAFS
 4      2056MB  2377MB  321MB   ext4         CACHEFS
 9      2377MB  2713MB  336MB   ext4         HIDDEN
11      2713MB  2765MB  52.4MB               Fota
 8      2765MB  3949MB  1184MB  fat32        UMS
        3949MB  3959MB  10.5MB  Free Space

(parted) unit B                                                           
unit B

(parted) print free                                                       
print free
Model: MMC SEM04G (sd/mmc)
Disk /dev/block/mmcblk0: 3959422976B
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start        End          Size         File system  Name       Flags
        17408B       524287B      506880B      Free Space
10      524288B      1572863B     1048576B                  PIT
 6      1572864B     3145727B     1572864B                  CSPSA FS
        3145728B     4194303B     1048576B     Free Space
 7      4194304B     14680063B    10485760B    ext4         EFS
 2      14680064B    31457279B    16777216B    ext4         Modem FS
        31457280B    32505855B    1048576B     Free Space
14      32505856B    34603007B    2097152B                  SBL
16      34603008B    36700159B    2097152B                  SBL_2
 1      36700160B    53477375B    16777216B                 PARAM
12      53477376B    55574527B    2097152B                  IPL Modem
13      55574528B    72351743B    16777216B                 Modem
15      72351744B    89128959B    16777216B                 Kernel
17      89128960B    105906175B   16777216B    ext4         Kernel2
 3      105906176B   747634687B   641728512B   ext4         SYSTEM
 5      747634688B   2056257535B  1308622848B  ext4         DATAFS
 4      2056257536B  2377121791B  320864256B   ext4         CACHEFS
 9      2377121792B  2712666111B  335544320B   ext4         HIDDEN
11      2712666112B  2765094911B  52428800B                 Fota
 8      2765094912B  3948937215B  1183842304B  fat32        UMS
18      3948937216B  3950000127B  1062912B
        3950000128B  3959406079B  9405952B     Free Space

As you can see the partitions of system and data border to each other. In the next steps I will move the border between them, which will reduce the size of data and give additional space to system.

First I deleted partition 5 (data), recreated it and moved the starting point from 747634688B to 947634688B (while keeping the same end) which would make it lose around 200 MiB at the beginning.

(parted) rm 5                                                             
rm 5
(parted) mkpart                                                           
mkpart
Partition name?  []?                                                      

File system type?  [ext2]?                                                

Start? 947634688B                                                         
947634688B
End? 2056257535B                                                          
2056257535B
(parted) name 5 DATAFS                                                    
name 5 DATAFS

After that I deleted partition 3 (system), recreated it and moved the ending point from 747634687B to 947634687B (while keeping the same start) which would make it gain around 200 MiB at the end.

(parted) rm 3                                                             
rm 3
(parted) mkpart                                                           
mkpart
Partition name?  []?                                                      

File system type?  [ext2]?                                                

Start? 105906176B                                                         
105906176B
End? 947634687B                                                          
947634687B
(parted) name 3 SYSTEM                                                    
name 3 SYSTEM

I then quit parted and back in the shell of adb I formatted these partitions with ext4.

(parted) quit                                                             
quit
~ #make_ext4fs /dev/block/mmcblk0p5
~ #make_ext4fs /dev/block/mmcblk0p3

As a last step I checked the partition table again.

~ # parted /dev/block/mmcblk0
(parted) unit B                                                           
unit B
(parted) print free                                                       
print free
Model: MMC SEM04G (sd/mmc)
Disk /dev/block/mmcblk0: 3959422976B
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start        End          Size         File system  Name       Flags
        17408B       524287B      506880B      Free Space
10      524288B      1572863B     1048576B                  PIT
 6      1572864B     3145727B     1572864B                  CSPSA FS
        3145728B     4194303B     1048576B     Free Space
 7      4194304B     14680063B    10485760B    ext4         EFS
 2      14680064B    31457279B    16777216B    ext4         Modem FS
        31457280B    32505855B    1048576B     Free Space
14      32505856B    34603007B    2097152B                  SBL
16      34603008B    36700159B    2097152B                  SBL_2
 1      36700160B    53477375B    16777216B                 PARAM
12      53477376B    55574527B    2097152B                  IPL Modem
13      55574528B    72351743B    16777216B                 Modem
15      72351744B    89128959B    16777216B                 Kernel
17      89128960B    105906175B   16777216B    ext4         Kernel2
 3      105906176B   947634687B   841728512B   ext4         SYSTEM
 5      947634688B   2056257535B  1108622848B  ext4         DATAFS
 4      2056257536B  2377121791B  320864256B   ext4         CACHEFS
 9      2377121792B  2712666111B  335544320B   ext4         HIDDEN
11      2712666112B  2765094911B  52428800B                 Fota
 8      2765094912B  3948937215B  1183842304B  fat32        UMS
18      3948937216B  3957000191B  8062976B     ext4         TEST
        3957000192B  3959406079B  2405888B     Free Space

After that I rebooted into recovery to make sure TWRP is detecting it and having all mount points set correctly. I installed the above mentioned archives (first lineage13.0-20180914-UNOFFICIAL-codina_SergeyL.zip and second open_gapps-arm-6.0-pico-20220215.zip), which now went fine and wiped the Dalvik/Art-Cache. After a reboot to the system and a couple of minutes waiting finally Cyanogenmod / LineageOS 13 with GApps was installed.

I configured my phone and installed Signal through Google Play Store plus F-Droid and some other apps. The GBoard (with Swype gestures) was installed by default. The phone is running fine and everything works as expected (Wifi, 3G, hotspot, bluetooth, mail, alarm clock, browsing, dialing, sms, contacts, camera, etc.). But due to the matter of low storage I couldn't install another webbrowser like Firefox. So I need to stick to the onboard browser, which is okay.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .