By Ne Mo

2019-06-06 18:02:22 8 Comments

I'm trying to diagnose a random reboot on LineageOS 14. last_kmsg is not in /proc, nor it is in /sys/fs/pstore/console-ramoops.


~# mount | grep PSTORE
~# mkdir /mnt/pstore && mount pstore -t pstore /mnt/pstore && ls /mnt/pstore
mount: 'pstore'->'/mnt/pstore': No such device


@Irfan Latif 2019-06-10 05:45:38

Back in 2012, /proc/last_kmsg (1) used to be a dump of kernel console messages, exported after reboots by Android's ram_console functionality (CONFIG_ANDROID_RAM_CONSOLE), which used persistent_ram (CONFIG_ANDROID_PERSISTENT_RAM) to handle a block of RAM that wasn't erased across reboots (2).

persistent_ram was based on Linux upstream RAMOOPS code which logged panic and oops messages to RAM. RAMOOPS was deprecated in favor of PSTORE (3) (memory handling) and PSTORE_RAM (4) (logging panics/oops to pstore/dmesg-ramoops). Later PSTORE_CONSOLE support was added (5, 6) to log not only the panics/oops, but all kernel console messages to pstore/console-ramoops-N which can be read later by mounting pstore (7). So the Android specific RAM_CONSOLE (8, 9) and PERSISTENT_RAM (10) were utterly removed.

Now pstore also offers logging userspace messages (PSTORE_PMSG) (11) and other features (12). Plus it supports multiple backends for persistent storage if supported by hardware, though SoC's on Android devices only support RAM storage (ramoops driver, AFAIK).

So it's not possible to enable last_kmsg on an upstream kernel, instead pstore offers a more versatile functionality.

mount: 'pstore'->'/mnt/pstore': No such device

It shows that your kernel isn't built with pstore support. All you need to do is use a kernel built with CONFIG_PSTORE_CONSOLE and optionally CONFIG_PSTORE_RAM (though buggy). Android's init by-default mounts pstore at /sys/fs/pstore (13) from where dmesg-ramoops (on panics/oops only) and console-ramoops can be read.

You can search forums for a custom ROM shipped with such kernel. Or if you have kernel source, you can build yourself on a Linux machine.

FURTHER READING: Reading kernel logs

@Ne Mo 2019-06-10 09:53:17

Thanks again for the help, very informative

Related Questions

Sponsored Content

0 Answered Questions

How to debug boot loop?

1 Answered Questions

How can I factory-restore a Samsung J5 (2015) SM-500FN?

2 Answered Questions

[SOLVED] How can I run continuous Logcat in the background?

  • 2016-04-12 20:08:01
  • Mars
  • 2670 View
  • 2 Score
  • 2 Answer
  • Tags:   logging

2 Answered Questions

1 Answered Questions

[SOLVED] Cannot mount /system as rw

0 Answered Questions

Use a disk image for Link2SD's 2nd partition

1 Answered Questions

Programmatically, how does "rooting" a device enable access?

2 Answered Questions

[SOLVED] Samsung Galaxy S3 black screen and automatic reboots

Sponsored Content