[Galaxy S II Original Android Development] PackElend:
long story short,

latest LOS

runs with

emulated storage

and

minimum SDCard

(REPIT) and /chache, /data and /sdcard are f2fs but I needed to flash TWRP-3.1.0-EMU-MIGRATION-M-20170318.

Here are the details but logs may miss some essential information since it was bit learning by doing.

My partition table was somehow messed up, I could not install any app, play store was crashing and so on. The reason might be that the figure in settings > storage was negative, properly to the same reason I posted as started flashing RESURRECTION REMIX around one and half years ago (and may some improper REPIT attempt):

This year I continued with my smaller (testing) SD what my led to the negative number (in combination with improper REPIT attempt, can't remember).

For this reason I started straight away with lanchon-repit-20170115-system=1G-data=max+wipe+f2fs-sdcard=min+wipe+f2fs-preload=min+wipe-i9100.zip

within TWRP 3.1.0 but it failed at the first attempt. I recalled that I was still on unified storage so I wiped and formatted the SDCards to get a split SDcards to default layout (internal and removable SDCard).

I thought that is but it continued to complain

info: copying package to '/tmp'
info: unmounting all partitions
umount: can't umount /sdcard0: Device or resource busy

FATAL: unable to unmount all partitions (this package copied itself to '/tmp'; please run it again from there)

eventually so I used the REPIT copied to /tmp and somehow succeeded but it always failed with

Info: Secure Discarded 0 sectors
Error: Failed to Initialise the NAT AREA!!!
Error: Could not format the device!!!

[ERROR 255]

Updater process ended with ERROR: 255
I:Install took 29 second(s).
Error installing zip file '/tmp/lanchon-repit-20170115-cache=same+wipe+f2fs-system=1G-data=max+wipe+f2fs-sdcard=min+wipe+f2fs-preload=min+wipe-i9100.zip'
Updating partition details...
I:Can't probe device /dev/block/mmcblk0p11
Failed to mount '/sdcard0' (Invalid argument)

At that moment I switched to TWRP 3.2.2 but without any improvement. The result was always the same, regardless what TWRP version I used during my LOS flash attempts (details are below).

On github - Lanchon/REPIT I studied

FATAL: file system errors in partition #11 / sdcard (UMS) could not be automaticly fixed #1

Fails to resize SYSTEM partition #3

Install fails #20

Installation fails with latest TWRP/repit on a I9100 #66

but nothing helped. Finally I solved it by wipe sdcard manually. It also triggered a rename of the partition from Internal Storage to sdcard0 .

It seems that REPIT has ome trouble with my specific (?) partition table. The reason could be that:

That there is a /data/media/0 even before I modified /data/system/storage.xml

That there are three sdcards:

/dev/block/mmcblk0p10 /sdcard f2fs rw,seclabel,relatime,background_gc=on,user_xattr,active_logs=6 0 0
/dev/block/mmcblk1p1 /sdcard1 vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/block/mmcblk0p11 /sdcard0 vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,err

After I ended my attempts to understand the somehow succeeded REPIT I started by LOS and GApps flash attempts but I before also formatted /chache to f2fs by means of TWRP. The above mentioned tests were done during the following flash attempts.

Accidentally If flashed GApps first but worked out well so I continued with LOS but I got the error:

Updater process ended with ERROR: 7

There a plenty of post regarding this error e.g. [FIX][SOLVED]Status 7 Error with CWM or TWRP Recovery on Rooted Android!. Common sense is, that the ROM is not compatible with the phone, for what ever reason. only skimmed the previous mentioned thread, it required a way to much modification in the zip files (also in other threads). Luckily I came across a thread where they stated the had to flash back to older TWRP versions, so I did 3.2.2 > 3.2.1 > 3.1.0 > 3.1.0 EMU succeeding with the last one. During those downgrades I also repeated all the REPITs but the result was always as mentioned above. The related log file for the last failed flash LOS > 3.1.0 EMU flash > successful LOS flash is in 20180720_2225.zip.

The next day I made some records of the system without switch to emulated. As I was sure that I anything was fine I modified /data/system/storage.xml and deleted the previous created standard folder structure on the 8MB large /sdcard0. I installed some apps and take some photos and screenshot but so far nothing is written on /sdcard0.

Only TWRP 3.1.0 EMU stores its screenshot on it, for whatever reason?

In addition I could not use vi editor, the keystrokes weren't translated properly and the displayed output was corrupted respectively. For example the shell console identifier via ADB was ~ # ?[6nvi and keystrokes were output like [12;1h~.

Luckily adb pull, push etc were working and there is still Droid Explorer, what worked very well in recovery.

An important side note is that I wasn't able to backup to PC. The command adb backup - twrp didn't trigger anything. There is only one 1 kb large file created called backup.ab but the actual backup is stored on the removable SDCard.

So, as you can image, I'm quite happy that latest LOS 14.1 runs on my S II but there were some events during this process which haven't been answered yet. May you can answer some of them.