journalctl -f turns useless after battery reinserted
What problem did you encounter
journalctl -f becomes permanently broken after one boot with a flat battery.
What is the actual behaviour?
The command shows a few lines of an old boot and stops producing new output.
What is the expected behaviour?
The command tracks new events as they happen.
How to reproduce
- Remove battery
- Insert battery
- Ensure clock is correct
sudo journalctl -fin the terminal.
What hardware are you running on?
Relevant OS information
Which kernel are you using?
Happened on all kernels I've tested (2+months old at least).
Which OS are you using?
Any other information that may be helpful?
The root cause is that the value the RTC resets itself to is interpreted as the year 2155. A boot with this clock will cause logs to appear in year 2155.
journalctl -f seems to be jumping to the newest timestamp for its input, so it will never produce any output until the clock is set to the year 2155 again.
This is super annoying, because the only solution is to trash journalctl logs... somehow. Might as well reflash.
For completeness, I'll mention setting the calendar to something over 2155. Of course, this will solve the logging, but now we don't have a working calendar.
A workaround would be to have the default RTC time to be interpreted as something in the past. This has no downsides: boot logs from an empty battery will always be overwritten by next empty boot, no matter which date they are. The selected date being something the user sees directly, it may be a nice easter egg (first unit produced? company founding?).