Gathering kernel logs *after* a crash (Kernel configuration?)

Hello everyone,

probably a develop-targeted question:

I suffer from the infamous random reboots (more specifically: 4-5 second freezes followed by what seems to be a watchdog reset) of the Fairphone 2. I’m using (a self-built) LineageOS on the 16.0 branch.

I know that I can do an adb logcat - however, since I don’t know when the reboots will occur, that’s not so much use for me. I would need to gather the logs after the crash has occurred.

I researched a bit and found that there should either be a /proc/last_kmesg file - which is not there - or a file called /sys/fs/pstore/console-ramoops - which isn’t there either (depending on the Android version, if I got this right; the directory /sys/fs/pstore doesn’t even exist). According to Reading kernel logs — Halium documentation (which is an entirely different project, but since it uses the same kernel? I guess it should also apply) suggest activating

CONFIG_PSTORE=y
CONFIG_PSTORE_CONSOLE=y
CONFIG_PSTORE_PMSG=y
CONFIG_PSTORE_RAM=y

in the (default) kernel config. However, only the option CONFIG_PSTORE is present when I’m doing a menuconfig. (make ARCH=arm menuconfig)

CONFIG_ANDROID_RAM_CONSOLE

is set to y already.

Any developers can give me some pointers to achieve what I try to do? Or doesn’t the FP2 (more specifically, the processor) support permanent storage?

1 Like

Small update: I enabled the CONFIG_PSTORE kernel option in the config and rebuilt LineageOS.

Initially, I only wanted to reflash the kernel / boot.img via fastboot, but that didn’t work, fastboot complained about unsigned or incomplete image

FAILED (remote: bootimage: incomplete or not signed)

I followed the instructions at Signing boot images for fastboot - z3ntu to sign the image, but still, the result was the same. I’m very much interested what went wrong here.

Anyway, I flashed the complete ZIP file. But the directory /sys/fs/pstore is still not present. I also did an adb shell, in which I entered su to become root, followed by

mount -t pstore pstore /sys/fs/pstore

Which resulted in the error message

mount: 'pstore'->'/sys/fs/pstore': No such file or directory

So it looks like I won’t get crash logs any time soon. Any ideas what else I might try?

Another update: ''fastboot boot ‘’ didn’t work, neither with the signed nor with the unsigned image.

''fastboot flash boot ‘’ worked only with the unsigned image. When I attempted to flash the signed boot image, FP2 would always immediately boot into bootloader mode. (The BootSignature.jar would also emit a NOTE about the image being truncated, I’d assume that’s the reason, I don’t know enough about Android development, though).

This still leaves me with the question how to get the kernel log. The needed kernel config options seem to be set.

Why not use MatLog Libre? Works fine for me, I discovered it a few weeks ago completely by chance.

If someone wants to look into the log I got (the last 20 lines may be missing due to the speed of recording): 2021-03-17-14-21-36.txt.ttf (1.5 MB)

1 Like

Wasn’t aware of this project, thanks, I’ll try it out.

I assume it’ll need root access for the system logs, though? (Just updated to LO 17.1 and haven’t configured it yet)

edit: actually it doesn’t, one can grant permissions via adb. Still not quite was I was looking for. The app seems to stop recording after some time or when you return to it?

edit2: Also, with LO 17, I can’t enable the RAMOOPS config anymore, I’ll get a “…incompatible pointer assignment…” warning which is promoted to an error. (Since it’s not the default config anyway, I doubt I’ll get any support with that)

1 Like

I did just have a crash while I had my phone connected via USB.

ADB logcat just crashed with the phone, though, as it seems.

Is there really no way to get the kernel crash log?

If you configured it correctly it shouldn’t I believe. At least it doesn’t for me.

Yes, seems to be the same for me as well.

:man_shrugging:

I played around with adb a bit:

# on PC
$ adb root
$ adb shell
# on fairphone
# what's "panic-y" on the system?
0|FP2:/ # find -iname "*panic*" 2>/dev/null                                                                                                                                                
./sys/kernel/debug/mdp/xlog/panic
./sys/module/kernel/parameters/panic
./system/product/media/audio/notifications/DontPanic.ogg
./proc/sys/kernel/panic
./proc/sys/kernel/panic_on_oops
./proc/sys/vm/panic_on_oom
1|FP2:/ # cat ./proc/sys/vm/panic_on_oom
0
FP2:/ # echo 1 > ./proc/sys/vm/panic_on_oom

With the next crash, I indeed had a /proc/last_kmesg. Which strangely, according to ls -l, always has the current timestamp. I’d attach it, but I can’t attach txt files, so a pastebin will have to do: PrivateBin

These two lines seem to be the cause, though?

[ 1767.501844] Unable to handle kernel NULL pointer dereference at virtual address 00000100
[ 1767.501871] Unable to handle kernel paging request at virtual address c1113434

Does the LineageOS maintainer participate here, or should I rather seek help in IRC?

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.