On a Librem 13 running PureOS byzantium, kernel log messages appear in two places:
- in the systemd journal, viewable using the
journalctl
command - in the
/var/log/syslog
file
It seems to work like that on some other Debian-based systems also, log messages from the kernel can be viewed using journalctl
but are also available in the /var/log/syslog
file.
However, on the Librem 5 running PureOS byzantium, there is no /var/log/syslog
file, so it seems the only way to view kernel log messages is to go via systemd using the journalctl
command.
I would like to change it so that things are logged to /var/log/syslog
also, in the same way as on the Librem 13. How can this be done?
The reason I want this is that under some circumstances the phone suddenly turns itself off and after starting it again there are no clues in the log shown by sudo journalctl
. My hope is that if kernel log messages can be logged directly to file instead of going via systemd, then maybe some kernel message could be written to /var/log/syslog
before the sudden shutdown even if it was not recorded in the systemd journal. I’m thinking that could happen if systemd tried to be clever, perhaps buffering the message in memory to write it do disk later to save resources, then it could happen that the phone shut down before systemd got around to writing the log message to file. Then it would be better to have the kernel write the log directly without involving systemd.
So: is it possible to get kernel log messages written to file directly without involving systemd?
Any other suggestions about how to debug when the device seems to suddenly turn itself off?
Edit: trying to clarify what I mean by the device suddenly turning itself off, the behavior seem to be like what happens when the charger is not connected and you just suddenly pull out the battery: it just dies without any explanation seen in any log file, probably because the power just disappears suddenly, the kernel then never has any chance to do anything about it. The problem I want to investigate is that the phone seems to turn itself off in that way, as if the battery had been removed, but the battery was not removed so the question is why did it really shut down. Maybe the kernel was involved but the device shut down so quickly that the relevant kernel log messages were not yet written to disk. Then I would like to have kernel log messages written to file as quickly as possible, to increase the chances of getting some info saved to file about what happened before the device dies.