Setting the Date and Time for The Beaglebone Black
Note 01/31/2023: This is a redo of a previous post published over a year ago.
One of the things I noticed when I first powered-on my BBB and queried the command line for the date and time, was that both were nowhere near the correct date and time. Using web searches and some trial and error, I found what was needed on the BBB was the Network Time Protocol (NTP) server. With the BBB powered on and an Ethernet cable inserted into the jack, I performed the following actions:
Tunneled into the BBB via SSH:
ssh debian@196.168.0.6
Updated the package index and installed Network Time Protocol server (ntp):
sudo apt update && sudo apt install ntp -y
Issued the following command to start the service:
sudo systemctl restart ntp
Checked the status of the service:
debian@BeagleBone:~$ systemctl status ntp
The immediate console output:
● ntp.service - Network Time Service
Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-01-31 20:10:16 MST; 10s ago
Docs: man:ntpd(8)
Process: 1809 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
Main PID: 1815 (ntpd)
Tasks: 2 (limit: 1023)
Memory: 664.0K
CPU: 155ms
CGroup: /system.slice/ntp.service
└─1815 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 107:115
Jan 31 20:10:16 BeagleBone ntpd[1815]: Listen normally on 7 usb0 [fe80::c6f3:12ff:fe9a:6ef3%3]:123
Jan 31 20:10:16 BeagleBone ntpd[1815]: Listening on routing socket on fd #24 for interface updates
Jan 31 20:10:16 BeagleBone ntpd[1815]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Jan 31 20:10:16 BeagleBone ntpd[1815]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Jan 31 20:10:16 BeagleBone systemd[1]: Started Network Time Service.
Jan 31 20:10:17 BeagleBone ntpd[1815]: Soliciting pool server 37.59.63.125
Jan 31 20:10:18 BeagleBone ntpd[1815]: Soliciting pool server 65.19.142.137
Jan 31 20:10:19 BeagleBone ntpd[1815]: Soliciting pool server 138.236.128.36
Jan 31 20:10:19 BeagleBone ntpd[1815]: Soliciting pool server 104.131.155.175
Jan 31 20:10:20 BeagleBone ntpd[1815]: Soliciting pool server 159.89.86.140
Issued the following command to allow the service to start whenever the BBB boots up:
debian@BeagleBone:~$ sudo systemctl enable ntp
Console output immediately following the previous command:
Synchronizing state of ntp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ntp
Then, I set the local time zone data with the following command:
sudo dpkg-reconfigure tzdata
I followed the prompts to set the time zone for my part of the world. When finished, the console out was this:
Current default time zone: 'US/Arizona'
Local time is now: Tue Jan 31 20:11:20 MST 2023.
Universal Time is now: Wed Feb 1 03:11:20 UTC 2023.