Since my device was unproperly shut down because the battery stopped functioning (the battery is getting completely discharged at a level higher than 1%), it is rebooting in loops even in safe mode (more exactly it reboots about 3 to 5 seconds after finishing booting).
So it means a file or permission wasn’t properly written in /data.
But in my case, the /data partition is on the sd card thanks to Magisk root, so I have full access to it.
Using a computer, I tried to put an additional Magisk startup script which is executed at boot in order to stream kernel log to a file, but the result isn’t useful as the last line of the log file looks something like this :
[ 72.480828] Ke
So which is the command to execute or file to write in /proc
or /sys
in order to disable automatic reboot after a kernel panic so the kernel finish to flush the log file ?
last_kmsg
orpstore
is the best ways to get kernel panic log. You don't need to write kernel log to a file. Details here: https://android.stackexchange.com/a/213460/218526. But you haven't stated in your question how a malfunctioning battery relates to kernel panics or reboots / bootloop and why you want to get kernel log. // Btw you can control reboot behavior on kernel panic by writing (directly or by usingsysctl
) to different files (includingpanic
andpanic_on_oops
) in/proc/sys/kernel/
. – Irfan Latif Jun 24 '21 at 15:32last_kmsg
andpstore
don’t return the kernel log on my device. And as I said, I suppose it’s because of the improper shutdown since I replaced by the exact same battery model from Samsung. – user2284570 Jun 24 '21 at 16:34