Jump to content
OMRON Forums

HOWTO: Installing NtpDate (Specifically on CK3E)


KEJR
 Share

Recommended Posts

Hello,

 

I don't think this HOWTO is limited to the CK3E but I found a few problems related to the CK3E such as needing to issue an update to the apt package manager and what not. This entire process should be similar if not exact for other PPMACs. I updated my PPC405 PPMAC disk image years ago so I can't remember exactly what it needed.

 

NOTE: you will need to have your PPMAC able to access the internet. Verify by pinging some internet sites prior to starting this process if you haven't done so already!

 

First, fire up PuTTY and connect to your PPMAC as root user. The first step after that is to make the root disk writeable:

 

root@192.168.xx.xx:/# mount -o remount,rw /

 

Now we have to update the package list. For some reason ntpdate is not listed for the CK3E unless we do this next step.

 

root@192.168.xx.xx:/ # apt-get update

 

(update takes several minutes, be patient)

 

Now we issue the command to download and install the packages that ntpdate needs. There will be a handful of packages installed in addition to ntpdate and this is OK.

 

root@192.168.xx.xx:/# apt-get install ntpdate

 

(answer yes to install the packages)

 

Now we need to copy the information that was installed in /etc and /var to the actual disk. Even wtih root as readonly the /var and /etc locations are mirrored in RAM to the tmpfs-mirror locations shown below. Be very careful how you type this and make note of the paths since the copy command is issuing relative paths.

 

root@192.168.xx.xx:/# cd /.readonly/var-tmpfs-mirror/

root@192.168.xx.xx:/.readonly/var-tmpfs-mirror# cp -a * /.readonly/var

root@192.168.xx.xx:/.readonly/var-tmpfs-mirror# cd ../etc-tmpfs-mirror/

root@192.168.xx.xx:/.readonly/etc-tmpfs-mirror# cp -a * ../etc

 

If you want to change from UTC to your local time do this:

 

root@192.168.xx.xx:/opt/ppmac# cp /usr/share/zoneinfo/MyCountry/MyTimeZone /.readonly/etc/localtime

 

Of course, change the zoneinfo path to your appropriate time zone. For me it was /usr/share/zoneinfo/America/New_York since I am on the east coast of the USA

 

Now mount as readonly so we know all the packages are written to disk and just to be super safe.

 

root@192.168.xx.xx:/# mount -o remount, ro /

 

Now we can reboot. You could power off, but just reboot to be safe.

 

root@192.168.xx.xx:/# reboot

 

Issue the date command to verify your setup:

 

root@192.168.xx.xx:/opt/ppmac# date

Thu Aug 17 10:54:59 EDT 2017

root@192.168.xx.xx:/opt/ppmac#

 

That should be it. Please respond if I've missed anything.

 

KEJR

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

This looks more or less correct. I haven't messed with time zones as it seems like the pmac firmware always acquires time in UTC.

 

A few points:

You probably need to change the /etc/apt/sources.list

You probably need to make the date reasonable before you can use apt-get.

date +%Y%m%d -s "20170816"

You probably want ntp as well as ntpdate. ntpdate will acquire time once as soon as a network connection is established, ntp will keep this time accurate.

You don't have to cd before you cp.

cp -a /.readonly/etc-tmpfs-mirror/* /.readonly/etc/

cp -a /.readonly/var-tmpfs-mirror/* /.readonly/var/

I'm not entirely sure yet if CK3E handles running ntp/ntpdate at boot correctly.

Sys.TimeOfDay should show UTC in seconds if linux time was correct at boot, $$$ or $$$***.

 

I'll have app notes on ntp/ntpdate for 460, 465 and arm cpus very soon. I'll make sure to link this thread to them.

Link to comment
Share on other sites

Thanks for the notes Eric.

 

I personally prefer to get the date only at bootup which is why I didn't suggest using NTP. I don't have a good reason for this, just mainly didn't want to mess with the clock in a RTOS system after its booted.

 

NtpDate is being phased out but is still available and configures really easily if you follow these instructions. It should be noted that there are ways to install NTP and configure it to behave like NtpDate (assign time at bootup only), I just haven't had time to experiment with that because NtpDate works for me.

 

This wasn't meant to be a HOWTO for getting atomic clock accuracy, but more of a way to get it to a more reasonable time in the absence of a functional battery backed clock.

 

I didn't have to edit the apt sources on the CK3E. If you are doing this on the PPC405 I recommend the HOWTO that I wrote in 2015 and subsequent contribution from member SHansen.

 

"HOWTO: Changing APT to point to debian archives"

http://forums.deltatau.com/showthread.php?tid=2056

 

Thanks,

KEJR

Link to comment
Share on other sites

Yeah, it doesn't look like I actually had to edit sources.list on either wheezy cpu, I just assumed it was needed the first time through.

 

That's interesting. I did not need to run "apt-get install debian-archive-keyring" on my 460 to install ntp and ntpdate. I'll have to revert to my backup image again and try installing gdb at some point.

 

It seems fine to use ntpdate on these debian 5 and 7 systems, and I didn't have any luck getting ntp to give me it's functionality. Also, I had a much better experience at startup with ntpdate. ntp may run before or after the pmac firmware starts (it can be changed) and it takes so long do acquire the date for the first time you need a sleep time. Ntpdate simply grabs the time as soon as there is a network connection.

Link to comment
Share on other sites

  • 1 month later...
Guest
This topic is now closed to further replies.
 Share


×
×
  • Create New...