RTC synchronization on PineBook Pro and RockPro64
I've noticed the following peculiar error message(s) on my PineBook Pro:
[ 4.909530] systemd-journald[375]: Received client request to flush runtime journal.
[ 4.918086] systemd-journald[375]: File /var/log/journal/d4d9ad9728ef4f7daaeb74a47284f5be/system.journal corrupted or uncleanly shut down, renaming and replacing.
There was no forced shutdown that could've caused this journal file to become corrupted, which made this really suspicious. Upon closer investigation, it turned out to be caused by the systemd's decision to reject journal files that have timestamps from the future. The root cause is that the RTC kernel module (rtc_rk808
) gets loaded too late, causing init (i.e. systemd) to be started without prior initialization of the system clock.
The solution is to add rtc_rk808
at the start of the MODULES
list in /etc/mkinitcpio.conf
. For this purpose I've created manjaro-arm-pinebookpro-post-install.patch and manjaro-arm-rockpro64-post-install.patch patches for the pinebookpro-post-install
and rockpro64-post-install
Manjaro ARM packages. These two patches also include some tidying up and whitespace cleanups, to make everything neat. :)
To complete the fix, the kernel config file also needs to be modified so the kernel saves the time from the system clock periodically to the hardware clock, if the system clock is synchronized to an NTP source. Otherwise, the hardware clock drifts over time and the journal file eventually becomes rejected again on boot. For this purpose, I've created manjaro-arm-linux.patch patch for the linux
Manjaro ARM package.
As a note, the background of the relation between the systemd behavior and the RTC synchronization is explained in more detail in this message from the systemd-devel mailing list.