3

I have Samsung S10 5G with root via instructions given by Magisk. I am trying to modify system.img to patch my SELinux policies in the AP file of ROM. When I flashed the AP file with other files using Odin then it fails with a boot loop. To debug the cause I am using pstore which is configured on the device as follows:

  1. In init.rc the pstore is mounted at /sys/fs/pstore as follows:
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
  1. The Kernel config options is as follows:
$ 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
  1. Ramoops configurations is as follows:
./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

Now, I am following the tutorial: Reading kernel logs

but there are no logs in /sys/fs/pstore directory. When I have tried the same step on another device(OnePlus 6T) then I can see the logs.

Also, I have tried to check logs for the real cause of flashing ROM with the following instructions:

  1. Flash ROM that causes a boot loop.
  2. Flash ROM that has root access.
  3. Check the logs within /sys/fs/pstore directory.

This is also not working.

Along with check /sys/fs/pstore directory, I have also tried to mount the pstore at some other location with mount -t pstore - /dev/pstore but there are no logs.

I need a favor in

  • Any way to debug the pstore problem?
  • Any other way to find the kernel logs?
Vatish Sharma
  • 1,536
  • 3
  • 16
  • 35

1 Answers1

1

I have seen that a lot of people are facing the same problem with pstore. Check if you have the following output:

#cat /sys/module/pstore/parameters/backend
(null)

Backend parameter is "Pstore backend to use" (source)

Pstore only supports one backend at a time. If multiple
backends are available, the preferred backend may be
set by passing the pstore.backend= argument to the kernel at
boot time.

from https://www.kernel.org/doc/Documentation/ABI/testing/pstore

Try pstore_blk, mtdpstore, mmcpstore, phram or android ram console if available.

What's your cmdline?

Do you have loaded reed_solomon module? It's needed for ramoops

Pstore_console might need CONFIG_VT to work.

Working command line is "ramoops.mem_address=0x11ff000000 ramoops.mem_size=0x1000000 pstore.backend=ramoops", for blk backend is "pstore_blk.blkdev=179:7 pstore_blk.oops_size=64"

If you want have pstore/blk remember that support for panic_write inside mmc/sdcc/sdhci driver is needed. It's common on android phones. For example you can't have working framebuffer console on android phone. You have MSM FB driver but is doesn't support fbcon.

For more help see https://github.com/gmpy/articles/blob/master/pstore/Test-Pstore-Block.md

and check https://www.openwall.com/lists/kernel-hardening/2019/10/10/3