I have a Raspberry Pi 4 and Installed Ubuntu 20.04 on it. Unfortunately, it will not be connected to the internet all the time meaning the date will be set back to the build time after each reboot. I have added an external RTC module (DS3231 working on the IIC bus) and can read the time with hwclock --show.
After adding dtoverlay=i2c-rtc,ds3231 to /boot/firmware/usercfg.txt, the module rtc_ds1307 is now loaded at boot time. The only problem is that it seems Ubuntu is trying to set the system time from the RTC before the module is loaded (see the dmesg output below). Once booted, I can manually set the time to what is on the RTC by running sudo hwclock --hctosys.
Any suggestions for getting around this problem? Is there any way to get the module to load sooner?
I have tried adding this to the superuser/root crontab:
@reboot sleep 10; hwclock --hctosys
but it does not seem to work.
Output from dmesg | grep rtc:
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=0 bcm2708_fb.fbheight=0 bcm2708_fb.fbswap=1 smsc95xx.macaddr=DC:A6:32:43:2B:86 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 net.ifnames=0 dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=LABEL=writable rootfstype=ext4 elevator=deadline rootwait fixrtc quiet splash
[ 1.726560] hctosys: unable to open rtc device (rtc0)
[ 2.470632] rtc-ds1307 1-0068: registered as rtc0