yashsingh1/xdaforums huggingface dataset:
[Galaxy S II Android Development] pocketrule:
Now I can see your problem. I thought, that it would not be that difficult to flash TWRP to Galaxy S2. Perhaps I've forgotten how to flash recent versions of Android. Or I didn't see those problems as I'm upgrading my device step by step over the years. Your link above from droidthunder describes a simple flash with odin - the same as i suggested first to you. Meanwhile I doubt following this guide is a good idea and I have to apologize for giving you a wrong advice - at least if you start from stock rom.

I've done some search and found some quite interesting information. Obviously, in oppsite to newer devices, you cannot just flash a new recovery. The boot image has to support an alternative recovery. So to get TWRP onto your device, you have not only to flash the recovery, but a corresponding boot image too.

Developer [MENTION=6005084]ripee[/MENTION] has provided an impressing description of the problem which was the key to the successful installation of TWRP for me:

[RECOVERY][OFFICIAL] TWRP 3.3.1-0 [I9100]

https://xdaforums.com/galaxy-s2/orig-development/recovery-twrp-3-2-1-0-t3740526

So I've managed to install TWRP from stock rom with the following steps. Please try again and let me know if it worked - this time

Copy the following files to an "external" SD card (USB OTG does not work in stock recovery)

flashing order

**************

1 PhilZ-cwm6-XXLS8-FOP-4.01-signed.zip

- reboot recovery

2a kernel-Lanchon-20160406-cm-13.0-i9100.zip

2b recovery-Lanchon-IsoRec-TWRP-2.8.7.0-20160113-i9100-(by-arnab)-signed.zip

- reboot recovery

3a Kernel (i.e. boot.img) from RR-O-v6.2.1-20181210-i9100-Final.zip

3b TWRP-3.1.0-EMU-MIGRATION-M-20170318.zip

- reboot recovery

Now you can proceed with installing LOS on your Galaxy S2 - hopefully :cyclops:

where to find the files

***********************

1 cannot find it anymore but probably one of these work, too

https://xdaforums.com/galaxy-s2/dev...lz-cwm6-stock-kernel-cwm6-root-exfat-t1877270

Any other CWM recovery should do the trick too if you can install it from stock recovery

2 links to downloads from androidfilehost in OP of this thread https://xdaforums.com/galaxy-s2/orig-development/isorec-isolated-recovery-galaxy-s2-t3291176

3a download link from androidfilehost in OP of this thread

https://xdaforums.com/galaxy-s2/development-derivatives/rom-resurrection-remix-v6-2-0-t3847561

extract boot.img from the zip file (and flash the img-file)

For me, every of these steps was neccessary

1 - only the signed zip can be flashed in stock recovery

2 - without IsoRec kernel you can flash TWRP but without effect

3 - without the newer kernel you'll get a bootloop without the chance to get into the recovery. Any newer kernel should work, too. This one was the one which i had on hand.
[Galaxy S II Android Development] anacronataff:
[MENTION=2222292]rINanDO[/MENTION]

Is it possible to include rsap bluetooth profile? In LOS 14.1 rsap works perfekt. But not in LOS 15.1 and 16?!

I ask admin from android-rsap.com: He told me: "It looks like there is no longer an "official" LineageOS release for the S2. You may ask whoever built the LineageOS 16 to include my changes from the LineageOS 14 branch (...)"
[Galaxy S II Android Development] rINanDO:
I think it is possible. I will try to include this in next build.
[Galaxy S II Android Development] toshibashi:
killed my bootloader

I followed this guide and successfully installed TWRP-2.8.7.0. Then I downloaded RR-O-v6.2.1-20181210-i9100-Final.zip, deleted everything from the zip package except boot.img and flashed 3a and 3b as advised. Now I'm stuck in a boot loop :(

I can only boot into download mode but adb does not detect any devices. Only Heimdall sez: Device detected.

I guess I could use some advice about how to continue.

TIA,

Toshibashi
[Galaxy S II Android Development] Alyonas_boy:
I installed this on my s2 yesterday, everything was working hunky dory and I was happy. I left my phone lying on my desk and went away for a while came back to find it was off. Chalked it up to just random shutdowns for using an unofficial ROM. However, now it does not load the OS. It may appear to be starting sometimes by showing the Lineage loading but then it will shut down. TWRP and Download mode works perfectly with no issues. Any advice?
[Galaxy S II Android Development] pocketrule:
You could try to get the latest stock rom and flash it (with Odin - don't know if it's possible with heimdall, to). That always works for me. I've got the latest rom from sammobile and flash it with Odin.
[Galaxy S II Android Development] pocketrule:
I'm no expert but I assume you cannot flash only the kernel by deleting contents of the flashable zip for the complete rom. Instead you should extract boot.img and flash the img-file (no zip file)
[Galaxy S II Android Development] toshibashi:
Sure I tried that first but TWRP wouldn't let me flash other than zip files. So zipped it but TWRP didn't like it neither. Finally I edited the original RR-O-v6.2.1-20181210-i9100-Final.zip leaving only boot.img inside. Flashed it, flashed TWRP-3.1.0-EMU-MIGRATION-M-20170318.zip and tried to re-boot...

Now I'll re-activate my oldest laptop to run Windows-XP and Odin. Will I really have to start with stock ROM again?
[Galaxy S II Android Development] pocketrule:
You can flash img-files with TWRP. There's a button where you can switch between zip and img.
[Galaxy S II Android Development] hulahala:
Is DRM working?
[Galaxy S II Android Development] pippone121263:
Sorry for the question, but I thonk a did everything in the righat way and everything seems to be worgling except for the emulated storage, I can't see it nor in the comp, or in the file maneger or in setting, the only way to see it is to reboot in recovery.

I don't know what to do to make it working, I am non using an external memory, my phone like to destroi it.

Thaks and sorry for my bad english
[Galaxy S II Android Development] toshibashi:
...oops, must have missed that button. Quite some time since I last used TWRP before.

OK, I can no longer boot into TWRP. But I'm connected via Heimdall (and perhaps via Odin if I connect to my Windows PC).

Heimdall prints the PIT and it looks as expected, identical to that of my working S2. I'm trying to find a safe way to flash boot.img. Since almost everybody is recommending Odin I'll try that first.
[Galaxy S II Android Development] K9100ii:
The latest build of this ROM works perfectly. I haven’t replied in a while because my old Galaxy S2 bricked itself after using it with it on low battery (battery was definitely faulty AFAIK) with the same bootloader reboot loop, but this time with no way to access TWRP (logo shows for 3-4 seconds, reboots and does bootloader reboot loop). I don’t know how to fix it and if a reflash of stock firmware with download mode (still accessible!) with a new USB board will make it work. Now, I’ve got another S2 from eBay and put this ROM on it. I thought I wouldn’t be able to as there was O2 firmware, but it was unlocked so it worked. Great that Samsung allows flashing previously locked phones (unlike a few others, most notably Sony). I restored the last nandroid backup of this ROM from my old S2 after flashing latest XEU firmware. The only differences between my old and new S2s are color (new is black and old is white) and new one has unfortunately got a known bad eMMC chip for the brick bug where my old one had an eMMC chip that was “at least not known to be bad”, which I hope this ROM is safe for phones with the brick bug problem. The exact reasons I bought another S2 is because the community for it is awesome, my Sony Xperia X has “Bootloader unlock allowed: No” and I love this phone. Anyway, that’s beside the point.

ROM works almost perfectly. The call volume “problem” seems to be a new thing introduced in Android 8.0, where the volume is now a 5 step control with no 0% volume (or muted) and there are now higher volumes per step, so it is not a bug at all. The only bug I see is that the brightness control is ineffective from about 0-50% (probably slightly different) and I feel like 0% (all the way to 50% is the same!) brightness is not actually 0% or some limit like 10%, but maybe brighter. (Maybe I’m comparing it unfairly to a LCD or something?). Ignoring that, this ROM seems to be very stable and making it official may now be a possibility. Good luck with this ROM!
[Galaxy S II Android Development] pocketrule:
How does your storage look like? You can install DiskInfo from playstore and compare it with my screenshot
[Galaxy S II Android Development] pippone121263:
Data is only 3.9 gb the rest is the same

thankyou
[Galaxy S II Android Development] pippone121263:
Thanks, but I did it, now it is ok. Thanks
[Galaxy S II Android Development] pocketrule:
I can now confirm flashing with heimdall is succesful:

1) Tab Utilities -> Download PIT-file from device

2) Tab Flash

PIT -> select downloaded PIT-file

Partition Details

a) Recovery -> select TWRP img file (e.g. twrp-3.2.3.0-i9100.img) -> klick Add

b) Kernel -> select boot.img file (e.g. extracted boot.img from RR-O-v6.2.1-20181210-i9100-Final.zip)

Session -> select No Reboot

klick Start

3) reboot recovery and proceed as described in first post.
[Galaxy S II Android Development] toshibashi:
Thank you very much! In the meantime I managed to flash a stock ROM using Odin. So I'll go on in with Heimdall now.

I used to have a pre-installed commandline Heimdall that came with Linux Mint but I had to give it up for the GUI version upgrade. I wasn't able to re-install the cli version since the packages are no longer available.
[Galaxy S II Android Development] SethGeckoXDA:
I'm still on build #11 2019-4-9 because there have been some reports about dead batteries since SamsungDoze was introduced in build #12 2019-5-11. I hope these are unrelated... :eek:
[Galaxy S II Android Development] K9100ii:
I was also on Build #11 2019-4-9 on my old S2, and that’s where it died. I’m running the latest build on my new S2, so this kind of scares me. The battery was a cheap chinese counterfeit battery that was on it’s way to dying, and now I’m using the legitimate but aged Samsung battery, so I don’t know if that’s it and it destroyed something in the phone or corrupted something in the eMMC, but nothing looks destroyed inside, though just because it looks fine doesn’t mean it is fine, and I can’t be sure about corruption. I also hope it wasn’t finally the eMMC brick bug, but maybe (probably?) not.
[Galaxy S II Android Development] JaLoou:
Wow! I found a very attractive battery for us: https://ntec.pl/pl/product/1301,7708-bateria-do-samsung-galaxy-sii-i9100-1800mah

Somebody tried it?
[Galaxy S II Android Development] rINanDO:
New build is up!

I finally can build TWRP properly again and made even an ODIN flashable image to make clean installations more straight forward!

Please test the new instructions and report if something doesn't work or my instructions aren't complete. :)

Build #14 2019-07-07

IMPORTANT

From this build on you need to use my unofficial TWRP 3.3.1-1 which has emulated storage support.

Overall state: Stable

Android build: 9.0.0-r44

Required recovery: TWRP 3.3.1-1

- Updated sources

- Set swappiness to 100

- Fixed BLN

- Using Preload-partition for misc

- Added Bluetooth SIM Access Profile support (I ported this, but can't test)

- Fixed stereo microphone recording (also in videorecording)

Known issues:

- Call recording only records microphone

Please report if there are more issues.

Upgrade from Build 7-13 to Build #14

Flash i9100-LOS-16.0-Emulated-Storage-TWRP-3.3.1-1.img and reboot recovery. In TWRP-3.3.1-1 you will then be able to (dirty) flash

lineage-16.0-20190707-UNOFFICIAL-i9100.zip

Upgrade from Samsung stock ROM to Build #14 using ODIN 3.07

Copy lineage-16.0-20190707-UNOFFICIAL-i9100.zip to your Micro SD-card before flashing.

Pit: i9100-LOS-16.0-Emulated-Storage.pit

PDA: i9100-LOS-16.0-Emulated-Storage-TWRP-3.3.1-1.tar.md5

1. Boot your phone into Download-mode (Volume down + Power/Standby + Home and hold for 10 seconds).

2. Start ODIN 3.07 on your PC.

3. Connect your phone via USB to your PC.

4. Press volume up on your phone, ODIN should detect your phone.

5. In ODIN:

Auto Reboot : unchecked

Re-Partition: checked

PIT : i9100-LOS-16.0-Emulated-Storage.pit

PDA : i9100-LOS-16.0-Emulated-Storage-TWRP-3.3.1-1.tar.md5

6. Press Start.

7. After succesful flash, reboot phone into Recovery:

- Press Volume up + Power/Standby + Home and hold for 10 seconds.

The phone shuts down.

- Repeat Press Volume up + Power/Standby + Home and hold for 10 seconds

Phone boots in recovery TWRP 3.3.1-1.

8. Swipe to Allow Modifications

9. In TWRP 3.3.1-1 you need to format partions

- Wipe -> Format Data -> Type [yes]

- Wipe -> Advanced Wipe -> Select:

* Davik / ART Cache

* Cache

* System

* Non-emulated Storage

-> Swipe to Wipe

10. Install LOS-16.0 + Gapps or MicroG

To prevent "Uncryption unsuccessful" error of GAPPS at first start:

- Reboot to recovery and Wipe -> Format Data -> Type [yes] again

11. Boot System

Downloads

i9100-LOS-16.0-Emulated-Storage.pit

i9100-LOS-16.0-Emulated-Storage-TWRP-3.3.1-1.tar.md5

i9100-LOS-16.0-Emulated-Storage-TWRP-3.3.1-1.img

lineage-16.0-20190707-UNOFFICIAL-i9100.zip
[Galaxy S II Android Development] linusdan:
You're traveling too much! Battery death is related to how much was used, by time or charge cycle. My original battery was 8 years old and went bankrupt 3 months ago. I asked to resuscitate on a assistence. It's not like before, but it still works. Whenever I introduce some function or novelty it is tested between 7 and 15 days after being released to users.
[Galaxy S II Android Development] ran000:
Work well here. Thanks
[Galaxy S II Android Development] Ch0wW:
Good news for the update, but whenever I try to flash it from stock, I'm having a bootloop. Of course, I did have repit'd the phone with the required amount of space, as described in the installation guide.

Is it normal the very first installation takes forever ?
[Galaxy S II Android Development] rINanDO:
It takes some minutes at first start but it should not bootloop. You formatted the partitions as described? Especially format data and not wipe data?
[Galaxy S II Android Development] Ch0wW:
I did, especially since I followed everything to the letter.

I noticed there are a few times where the animation loop slows down slightly, but I don't know if that means the phone is currently doing some work or not.

EDIT : I redid everything once again, and this time, it booted. I'm unsure what caused the problem, but as long as it works...
[Galaxy S II Android Development] K9100ii:
ROM is great. Wow, so many bugs fixed, too!

Maybe this is why batteries are dying? Probably. Old S2 is still dead using the battery from my new one though, so it’s not working with a known good battery, either.
[Galaxy S II Android Development] rINanDO:
The delays in the boot animation is normal. It is doing a lot of work starting android and pauses the animation. At first start Art is compiling stuff. Glad to hear it now works.
[Galaxy S II Android Development] rINanDO:
The thing with our small 1650mAh batteries is probably the installed apps and Android version. As apps and android are getting more smart, complex and bigger our old duo core CPU must work hard and needs a lot of power compared with apps 8 years ago. At boot the phone uses full power to start and it takes a lot of battery power to boot the OS and then it starts all services of installed apps. The battery level drops considerably because the battery demand is too high because of 100% cpu. The voltage is dropping hard. When everything is done, the battery gets finally some rest to restore and the gauge rises. The voltage is increasing. I'm currently using a 3000mAh battery pack and it lasts about 30 hours with normal use. Almost the same with my s7. Maybe starting the s2 with power USB cable connected save battery life in long term because of too high battery demand. It wasn't designed for Pie ;)

I could try to set CPU to 500mhz at boot so it takes more time to boot, but may save long term battery life.
[Galaxy S II Android Development] Ch0wW:
Yep, what caused the bootloop wasn't your build, but the GApps Pico zip. I tried downloading it twice, and it both made a bootloop. However, using the micro package fixed it.
[Galaxy S II Android Development] js-xda:
New build working smoothly - thank you very much!

While being more than happy to upgrade to TWRP 3.3.1, I am just curious and trying to learn something: What is the specific reason that the new TWRP recovery version is required and not anymore your 3.1.0 version already supporting emulated storage?
[Galaxy S II Android Development] rINanDO:
The reason is that in all my Pie builds the device check has been disabled so twrp 3.1.0 can install the rom. I don't know exactly why Pie builds broke this in twrp 3.1.0 so I disabled it. Now I can build trwp myself so I updated it to 3.3.1-1 (-1 indicates emulated storeage, -0 is the official one) without the need of removing the device check. Now I only have one custom patch on top of Lineage 16.0 which is spoofing microg.
[Galaxy S II Android Development] MelTraX:
I just tried to update to the latest build but I am having issues.

I used the provided flashable repit script around 5 builds ago to install your Pie rom the first time.

Since then I successfully dirty flashed every new build.

This time I downloaded the new recovery and the new rom and then rebooted into recovery.

Your old recovery asked me for my encryption password so it could mount the data partition.

I selected "Install", switched to "install image", selected the downloaded recovery (from the encrypted data partition) and selected "Recovery" as a target partition.

The installation was fast and successful so I restarted into recovery again (using the TWRP menu).

The restart worked just fine and showed the new version 3.3.1. I noticed immediately though that it did not ask for my encryption password. Selecting "Mount" and "Data" failed with a silent vibration.

Then I thought "no harm done, it's just the recovery" but rebooting into the proper (old) system takes forever (not sure if bootloop). I literally fell asleep and it was still showing the boot animation when my wife woke me up. It did not ask for my encryption password.

And that's how I currently left it (turned it off though). My questions: Did I do anything wrong? Did anyone update with an encrypted data partition? Do you need anything from the phone in its current state for debugging purposes?

I will wait for an answer for one or two days and then do a clean reinstall.

By the way: This morning (still on build #13) I turned my phone on and the SIM card asked for my PUK instead of my PIN. I did not enter an incorrect PIN and the bug that I had to enter the PIN multiple times was fixed one or two builds ago. I have no idea why that happened. Entering the PUK worked just fine though.

The only other issues I had with build #13 were that continuous autofocus did not work (especially annoying with barcode scanner com.google.zxing.client.android) and the vanilla mail app force closes on start (posted a logcat in my previous post).
[Galaxy S II Android Development] rINanDO:
Hmmm... I did not explicitly test scenarios with encrypted data. Flashing recovery doesn't touch kernel or systen. In theory it should just boot normal to android. Unless twrp did do something. Maybe you can try this. It is a long shot. Try to go back to the old recovery. Check if data mounts. And boot to system. If you have bootloops try to format preload and try again. Hope this works.

I didn't know continuous focus was broke. It is broke in specific app?
[Galaxy S II Android Development] bersem:
The same happened to me at the last build after dirty flashing. After booting up: "Please Enter PUK code". I was confused thought it was a mistake and entered my pin code. The SIM card was gone. Had to apply for a new one from my provider.
[Galaxy S II Android Development] js-xda:
Same thing about PUK happened here on first boot of build #13 after clean flash.
[Galaxy S II Android Development] K9100ii:
Looks like there are issues with SIM pins and then being asked for a PUK code after upgrading to the latest build.

For those who are being asked a PUK code: contact your network provider or find a PUK code finder on their site (they might not have a PUK code finder) for the PUK code. Try entering the PUK code, if it works, it will ask you to input a new pin code to use. If it doesn’t work or it happens again, you could try going back to the build before the latest one. I would recommend keeping nandroid backups in TWRP on another SD card. If everything fails, you will need to completely wipe with the build before the latest and wait until it is fixed.

Also, I can’t test F2FS anymore, I’ve moved to EXT4 due to slight OS corruption in the notification bar with F2FS.
[Galaxy S II Android Development] MelTraX:
The old recovery could mount /data and formatting /preload made build #13 boot again. Yay, working phone!

Could you check why the new recovery can't mount the encrypted /data partition? Can I help with that somehow?

For me it doesn't work anywhere. Even the included camera app can focus on touch and when actually making photos but it does not autofocus continuously. For that app it doesn't really matter because the photos it takes are in focus. But for barcode scanners I have no way to get a sharp image.

I can reproduce it easily by starting the normal camera app and pointing it at some text document. It is not in focus but after touching the screen it focusses just fine.
[Galaxy S II Android Development] rINanDO:
For starters. How do you encrypt data?
[Galaxy S II Android Development] MelTraX:
Well, I clicked "Encrypt phone". I did some trickery to decouple the unlock PIN from a complex encryption password and I use an app that shuts the phone down after 2 or 3 failed PIN attempts so you have to enter the boot password. I think I basically made a backup of /data, changed from PIN to password and then restored the backup.

Mount shows dm-0 so I guess it's using blockdevice level dm-crypt:

GT-I9100:/ # mount
[...]
/dev/block/dm-0 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc)
[Galaxy S II Android Development] hagadus:
Wow, new update, THX ! :)
[Galaxy S II Android Development] hellbach:
Hello

Using build #14, upgrading from stock.

When flashing just the rom, it boot normally, everything seems to be working properly, but I have not had time to do any more tests.

When flashing rom+OpenGapps, it doesn't finish the boot process, being stucked on boot logo. I tried, first, the "nano" and then the "micro" variants, as suggested on the supracited reply.

I tried to see the boot process, by using the vi in twrp to add the "debug.sf.nobootanimation=1" in /system/build.prop, hoping to achieve the same result you would by removing "splash" in the kernel command line in other kernel linux based plataforms, but it just gave me a black screen. Sorry, I just started play with android. I could try to help with the debugging of the boot process if someone pointed me to the relevant documentation.

Any help will be appreciated.
[Galaxy S II Android Development] infinion:
dirty flash over previous version ,new user gone,no multiuser support in #14?!how to recover new user help please
[Galaxy S II Android Development] vdhero:
normally, just formatting data in TWRP would solve the problem. If you can't, reinstall stock rom and then start installing custom roms as normal

---------- Post added at 20:33 ---------- Previous post was at 20:31 ----------

magisk doesn't work due to our old kernel. I think that I had read a post of rINanDO saying that he will update the kernel somewhere.
[Galaxy S II Android Development] linusdan:
I think he referred to the [MENTION=5405215]forkbomb444[/MENTION] midas kernel (Galaxy Note II and Galaxy SIII), where he relied on upgrading HWC to version 1.4.