Hey
@rINanDO
I'm a little bit in a pickle. I have to resort to using my i9100 as a daily driver once again (my n7100 needs some serious repair). I was using a 2019 version on my S2 for a while without problem, at some point, it somehow 'crashed' (bootloop both normal and twrp) so couldn't recover it easily.
Now, I'm back at it again, and hooked up a serial port to see what was really going on. So the bootloop was triggered by mmcblk0p10 (user data partition) causing fsck to take a bit, and then segfaulting. As I want to see if there's anything that needs recovering (foto's) I figured, lets start by upgrading the kernel + twrp.
edit: see the posts below for potentially more info; I didn't manage to fix the segfault; but, transfering the image to my desktop, and fsck/mounting it there, it works just fine, doesn't even think it's corrupted. So def. a bug in the f2fs driver of that kernel, as the disk-format is not the issue.
Code:
sudo fsck.f2fs datafs.img
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 26697728 (13036 MB)
Info: MKFS version
""
Info: FSCK version
from "Linux version 3.0.101-lineage-gc2aaf5ba3b8-dirty (root@4151fd16d335) (gcc version 4.9.4 20151028 (prerelease) (Linaro GCC 4.9-2016.02) ) #0 SMP PREEMPT Mon Oct 18 11:31:46 UTC 2021"
to "Linux version 5.14.0-1-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.3.0-10) 10.3.0, GNU ld (GNU Binutils for Debian) 2.37) #1 SMP Debian 5.14.6-2 (2021-09-19)"
Info: superblock features = 0 :
Info: superblock encrypt level = 0, salt = 00000000000000000000000000000000
Info: total FS sectors = 26697728 (13036 MB)
Info: CKPT version = d8f6
Info: checkpoint state = 3 : orphan_inodes unmount
[FSCK] Unreachable nat entries [Ok..] [0x0]
[FSCK] SIT valid block bitmap checking [Ok..]
[FSCK] Hard link checking for regular file [Ok..] [0x0]
[FSCK] valid_block_count matching with CP [Ok..] [0x11285a]
[FSCK] valid_node_count matching with CP (de lookup) [Ok..] [0x73f2]
[FSCK] valid_node_count matching with CP (nat lookup) [Ok..] [0x73f2]
[FSCK] valid_inode_count matched with CP [Ok..] [0x70a9]
[FSCK] free segment_count matched with CP [Ok..] [0x1076]
[FSCK] next block offset is free [Ok..]
[FSCK] fixing SIT types
[FSCK] other corrupted bugs [Ok..]
Done: 1.343300 secs
So at least i can recover my data (if there is any, I'd expect some fotos probably though)
I downloaded the latest image from this thread, and used heimdall to flash the KERNEL to the kernel partition, and the latest twrp (3.5.2) image and flashed that into the RECOVERY partition.
Sadly, it still fails to boot normally (init crashing, due to factoryfs being wrong, understandable) however, for some reason isorec is not kicking in to load twrp.
Here's a snippet of the bootlog
Code:
[ 6.165529] c0 gpio_table = [2]
[ 6.270613] c0 Warning: unable to open an initial console.
[ 6.275105] c0 Freeing init memory: 2292K
[ 6.440088] c0 max8922-charger max8922-charger: max8922_is_charging: charging state = 0x0
[ 6.448103] c0 sec-battery sec-battery: sec_bat_check_temper: recovery count = 0
[ 6.455948] c0 sec-battery sec-battery: sec_bat_check_temper: temp=280, adc=903
[ 6.462904] c0 sec-battery sec-battery: Time past : 0 secs
[ 6.468058] c0 max8922-charger max8922-charger: max8922_is_charging: charging state = 0x0
[ 6.476098] c0 sec-battery sec-battery: soc(58), vfocv(3844), vcell(3843), temp(28), charging(1), health(1), chg_adc(1103)
[ 6.861527] c0 init: init first stage started!
[ 6.864948] c0 init: Unable to open /lib/modules, skipping module loading.
[ 6.872697] c0 init: [libfs_mgr]ReadFstabFromDt(): failed to read fstab from dt
[ 6.883243] c0 init: Using Android DT directory /proc/device-tree/firmware/android/
[ 6.925093] c0 notify_change_of_tmu_state: uevent: 0, name = TMUSTATE=0
[ 6.930458] c0 normal: free cpufreq_limit & interrupt enable.
[ 6.971078] c0 init: DSU not detected, proceeding with normal boot
[ 6.977853] c0 init: [libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/platform/dw_mmc/by-name/FACTORYFS
[ 6.992477] c0 EXT4-fs (mmcblk0p9): mounted filesystem without journal. Opts:
[ 6.998696] c0 init: [libfs_mgr]__mount(source=/dev/block/platform/dw_mmc/by-name/FACTORYFS,target=/system,type=ext4)=0: Success
[ 7.010736] c0 init: Switching root to '/system'
[ 7.015683] c0 init: Unable to move mount at '/dev': No such file or directory
[ 7.023282] c0 init: InitFatalReboot: signal 6
[ 7.100323] c0 init: #00 pc 000cb988 /init (UnwindStackCurrent::UnwindFromContext(unsigned int, void*)+84)
[ 7.108873] c0 init: #01 pc 0005e709 /init (android::init::InitFatalReboot(int)+132)
[ 7.116596] c0 init: #02 pc 0005e9ed /init (android::init::InstallRebootSignalHandlers()::$_22::__invoke(int)+20)
[ 7.127104] c0 init: #03 pc 00122f78 /init (__restore)
[ 7.132099] c0 init: #04 pc 0011fe40 /init (abort+168)
[ 7.137322] c0 init: #05 pc 00060667 /init (android::init::InitAborter(char const*)+22)
[ 7.145394] c0 init: #06 pc 0009a9a1 /init (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+48)
[ 7.158327] c0 init: #07 pc 0009a3c9 /init (android::base::LogMessage::~LogMessage()+224)
[ 7.166622] c0 init: #08 pc 0005f1dd /init (android::init::SwitchRoot(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)+612)
[ 7.181709] c0 init: #09 pc 0005b925 /init (android::init::FirstStageMount::TrySwitchSystemAsRoot()+240)
[ 7.191228] c0 init: #10 pc 0005ab1f /init (android::init::FirstStageMount::MountPartitions()+134)
[ 7.200251] c0 init: #11 pc 0005cbfb /init (android::init::DoFirstStageMount()+54)
[ 7.207873] c0 init: #12 pc 00058a77 /init (android::init::FirstStageMain(int, char**)+2594)
[ 7.216424] c0 init: #13 pc 0011f2fb /init (__real_libc_init(void*, void (*)(), int (*)(int, char**, char**), structors_array_t const*, bionic_tcb*)+402)
[ 7.230275] c0 init: Reboot ending, jumping to kernel
After this we get a reboot into download mode; though reboot takes like 30 seconds (could be related to your mentioned bug, improper shutodwn)
So my recovery plan next is, to a) get a kernel built with a busybox shell active; so I can explorer and manually fix stuff from a linux terminal and b) convert the update image from your zip into an ext4.img so I can use heimdall to flash it.
So on both accounts a few questions.
How can I rebuild the kernel without having to do the whole lineage build? I'm very familiar with kernel builds, so that's not an issue, but from a 'traditional' kernel build I end up with a zImage. Afaik, I need to atleast use mkbootimg to convert it into an android boot image, so what else is in your kernel image so i have a drop-in replacement?
Secondly, do you happen to know an easy trick to convert the update image? I'm gonna probably just chroot into the twrp image and fake-install the update file into a loop device, that should work well enough.
Thirdly, do you know if the latest twrp even works on our device? I downloaded it and it's 8708998 bytes, looking at the 'download-pit' from heimdall, the recovery partition is 16384 blocks, which would be 8388608 bytes so twrp doesn't even fit, which could be an explanation of isorec failing.
Code:
twrp-3.5.2_9-0-i9100.img 8.3M 2021-04-06 05:59:38 UTC
twrp-3.5.1_9-0-i9100.img 8.3M 2021-03-15 00:53:27 UTC
twrp-3.5.0_9-0-i9100.img 7M 2020-12-29 01:10:47 UTC
so I'll try downgrading first
edit: So with twrp 3.5.0 recovery works again; so indeed, 8.3M is obviously to big. I'll open a bugreport there and see how easy it is to add a compile-time check to produce a warning on their pipeline; they shouldn't be publishing files that won't fit on 'stock' partitions'
It bootloops again however, since the newer kernel won't allow me to recover either (kernel crashing on the image) the only options I have left; create a kernel, dump the partition to an SD card and fix it on a normal linux system; and/or flash a f2fs image into the user partition so the kernel won't crash anymore
edit2: Bah, this sucks; For whatever reason, the DATAFS partition can't be heimdalled, `
ERROR: Failed to confirm end of file transfer sequence!`
I'll have to start to compile your kernel and add a shell (should be trivial really) so i can run mkfs on the device instead
I think TWRP trying to fsck and crashing is really bad; we can't fix the kernel (too old, should upgrade to mainline really) but can fix TWRP imo to not crash. There should be just a button 'fsck filesystem's instead ... it's a recovery, the whole point is being able to recover no?