Here's how to install a real time clock (RTC) module on MoodleBox, so that time and date are always correct.
Edit: This tutorial was tested on 2024-02-10 and works correctly as is.
For the sake of this guide, I'll use the DS3231 Real Time Clock Module 3.3V/5V. Very cheap (less than 2 USD) and works well.
Step 1. Install i2c bus support
sudo apt-get update && sudo apt-get install -y i2c-tools
sudo sed -i -e 's/^#*\(dtparam=i2c_arm=on\)/\1/' /boot/firmware/config.txt
sudo touch /etc/modprobe.d/raspi-blacklist.conf
printf "i2c-dev\n" | sudo tee /etc/modules
sudo dtparam i2c_arm=on
sudo modprobe i2c-dev
Step 2. Enable rtc-ds3231 support
sudo sed -i '/#dtoverlay/a dtoverlay=i2c-rtc,ds3231' /boot/config.txt
Step 3. Enable clock synchronization at boot
sudo apt-get remove fake-hwclock -y
sudo update-rc.d -f fake-hwclock remove
sudo rm /etc/cron.hourly/fake-hwclock
sudo rm /etc/init.d/fake-hwclock
sudo rm /etc/fake-hwclock.data
then edit file /lib/udev/hwclock-set
, commenting the lines:
#if [ -e /run/systemd/system ] ; then
# exit 0
#fi
See https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=85683&start=50 for reference
Step 4. Reboot and enjoy!