I had quite a lot of trouble getting my RTC to work - but did eventually. I’m not sure I have a direct answer to your question but maybe I’ll share my $0.02 - also as a way of verifying with the community that what I did isn’t totally stupid…
Firstly, is your system successfully loading the kernel module for your RTC? If it is, then I assume you’re seeing /dev/rtc0
and /dev/rtc
(a symlink to the former) pop up in your dev directory?
At least in my setup, which is a Raspberry Pi 3 with a Strato Pi board that contains a MCP79410 RTC chip, and the latest beta of Ubuntu Core 16, the /dev/rtc0
device only appeared after loading the kernel module.
With the rtc device in place, I was able to successfully run hwclock
in order to get or set the time from my on-board RTC. Note that without that device module loaded, hwclock
wouldn’t run for me - so I’m not aware of there being a “fake” hwclock as such installed by default - but I may be wrong, and it may depend on your system configuration.
Finally, I manually added a hwclock
service to systemd, which would read the system time from the RTC on boot, and save it on shutdown. I believe you can do this via a snap, though I went a slightly more manual way. I created a hwclock.service
definition file file manually in /writable/system-data/etc/systemd/system
with the following contents:
[Unit]
Description=Hardware clock synchronization
[Service]
Type=oneshot
ExecStart=/sbin/hwclock --hctosys --utc --adjfile=/writable/system-data/etc/adjtime
ExecStop=/sbin/hwclock --systohc --utc --adjfile=/writable/system-data/etc/adjtime
[Install]
WantedBy=multi-user.target
Then I unmasked and enabled the service:
sudo systemctl unmask hwclock
sudo systemctl enable hwclock