[Samsung Galaxy S10 5G Questions & Answers] Vats12:
Hi All,

Device Detail:

- Samsung S10 5G

- Qualcomm Device

- Model: SM-G977U

- ROM: VZW-G977UVRU2ASH7-20190827135903

- Kernel-Version - Linux version 4.14.83-16633035 (dpi@SWDH2517) (clang version 6.0.10 for Android NDK) #2 SMP PREEMPT Wed Aug 14 16:23:48 KST 2019

Background: I have

- rooted the device with instructions given by Magisk.

- I can successfully reboot to the recovery rootfs.

Problem: I am trying to modify the `system.img.ext4.lz4` file to root the device with normal boot. I am aware that it will not let the device install OTA Updates.

Unpack-Pack System and make new AP.tar, flash:

- Without any modification to the `system.img`, I have just unpacked `system.img.ext4.lz4`->`system.img.ext4`->`system.img`->mounted to system directory and packed it back to `system.img`->`system.img.ext4`->`system.img.ext4.lz4`.

- Replaced unpack-packed `system.img.ext4.lz4` with the AP `system.img.ext4.lz4` and make a tar of it.

- Then I have flashed it using Odin v3.13 along with BL, CP, and HOME_CSC.

- Odin has show PASS and I have rebooted the device into recovery mode.

- Done the Wipe data/factory reset and reboot to recovery again but released the recovery key combination on splash screen as mentioned in the root instructions .

- The device stuck in a boot loop.

Tries:

1. Disable Dm-verity

- Removed `avb` flag from `boot.img` with

magiskboot dtb boot.img patch

- Removed `avb` and `verify` flags from `dtbo.img` with

magiskboot dtb dtbo.img patch

- Patched `ramdisk.cpio` with

magiskboot cpio ./initrd 'patch false true'

Patched `boot.img` and `dtbo.img` is working fine with magisk patched AP file but the `ramdisk.cpio` creating the issue: Stuck at splash screen when trying to go to recovery after successfully flash with Odin. Download mode is appearing on splash screen.

So, I have used `boot.img` and `dtbo.img` along with unpack-packed `system.img.ext4.lz4` but the result is still a boot loop. I have also tried a combination of `boot.img` and `dtbo.img` along with unpack-packed `vendor.img.ext4.lz4` and flashed the AP.tar with other files but still the result is a boot loop.

So, I want to debug the problem and got to know about `pstore` which preserve the logs when kernel panic.

2. pstore

- Checked that `/sys/fs/pstore` is mounted by the system with following in init file: Grep the pstore using `find . | grep '\.rc' | xargs cat | grep pstore -n -i` and get following result:

314: # pstore/ramoops previous console log
315: mount pstore pstore /sys/fs/pstore nodev noexec nosuid
316: chown system log /sys/fs/pstore/console-ramoops
317: chmod 0440 /sys/fs/pstore/console-ramoops
318: chown system log /sys/fs/pstore/console-ramoops-0
319: chmod 0440 /sys/fs/pstore/console-ramoops-0
320: chown system log /sys/fs/pstore/pmsg-ramoops-0
321: chmod 0440 /sys/fs/pstore/pmsg-ramoops-0

- Checked the kernel config by pulling the file from /proc/config.gz.

$ cat config | grep PSTORE
CONFIG_PSTORE=y
CONFIG_PSTORE_ZLIB_COMPRESS=y
# CONFIG_PSTORE_LZO_COMPRESS is not set
# CONFIG_PSTORE_LZ4_COMPRESS is not set
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PSTORE_PMSG_SSPLOG=y
CONFIG_PSTORE_RAM=y

- Check the `ramoops` configuration:

./sys/module/ramoops/parameters/console_size 262144
./sys/module/ramoops/parameters/dump_oops 1
./sys/module/ramoops/parameters/ecc 0
./sys/module/ramoops/parameters/ftrace_size 262144
./sys/module/ramoops/parameters/mem_address 3241148416
./sys/module/ramoops/parameters/mem_size 1048576
./sys/module/ramoops/parameters/mem_type 0
./sys/module/ramoops/parameters/pmsg_size 262144
./sys/module/ramoops/parameters/record_size 262144

`pstore` setup looks fine but when I am trying the get logs from `sys/fs/pstore` then I found nothing.

I have tried it by two ways:

1. Crash manually with panic kernel using:

echo 1 > /proc/sys/kernel/sysrq
echo c > /proc/sysrq-trigger

Followed Reading Kernel Logs

2. Flashing non-working rom that cause a boot loop and then flashed a working ROM with rooting steps and checked the file at `sys/fs/pstore`.

I need a favor in:

- Any steps to fix/debug the `pstore` problem?

- Any other way to find the kernel logs?

Update 1: I get the logs from recovery but I am not able to identify the problem.

Logs link

: https://drive.google.com/file/d/1b-XNmjpYvH-L8lY0xA0SYr7XcITVCrVS/view?usp=sharing

Description

: In this video, I have done the following:

1. Displayed recovery logs before: The last recovery logs are ends with 8.

2. Rebooted the device with a recovery key combination. I have already wipe data partition before making this video.

3. The boot loop happens and in the next reboot, I have pressed the recovery key combination to open the recovery mode where logs that end with 9 displayed.

4. Then I have recorded `last_history`, `last_avc_message_recovery`, `last_log.9` and `last_kmsg.9`

5. `last_history` and `last_avc_message_recovery` looks unchanged(same as before boot loop).

6. Then, I just have tried to mount the system but that didn't work.

7. At last, I have just rebooted the system normally without any recovery key combination.

Some Highlighted logs of last_log.9

Is anyone have experience in detecting problems from the kernel logs?