ntp won't work on read-only Raspberry Pi

I found this question while facing a similar issue.

The issue turned out to be that systemd's PrivateTmp feature does not work in a read-only configuration.

  1. Be sure to install ntp and ntpdate
    sudo apt install -y ntp ntpdate
    
  2. Copy /lib/systemd/system/ntp.service to /etc/systemd/system/ntp.service

    cp /lib/systemd/system/ntp.service /etc/systemd/system/ntp.service
    
  3. Open /etc/systemd/system/ntp.service and comment out PrivateTmp=true.

    sudo nano /etc/systemd/system/ntp.service
    

Now, it should work correctly!

As an additional step I have also now mounted /var/lib/ntp as tmpfs as recommended here

  1. Open /etc/fstab and add tmpfs /var/lib/ntp tmpfs nosuid,nodev 0 0 at the end of file.
    sudo nano /etc/fstab
    

I didn't find this necessary in my case but there are additional insights into running on a read-only filesystem there.

Tags:

Ntp

Ntpd