Setting the Time on a Once-off Basis
On my current distribution the Beaglebone Black does not come with a working NTP installation in order to set the time. Because the board doesn’t have a battery backup, this means that we need a way to set the time when the board is running. If you wish to set the time you could do it on a once-off basis…
When you boot the Beaglebone black, the time comes up as:
1 2 |
root@beaglebone:~# date Sat Jan 1 12:27:56 GMT 2000 |
Which is quite some time ago! I noticed this because I did a git commit and in the github status it said that I did the update 13 years ago!
To set the date once off you could use something like:
1 2 3 |
root@beaglebone:~# ntpdate -b -s -u pool.ntp.org root@beaglebone:~# date Sat May 18 22:52:56 BST 2013 |
However, if you reboot your Beaglebone the time will be back to the good old year 2000. So, we need a way to update this each time the Beaglebone boots.
Install the NTP Software
Next, we need to install the ntp software on the Beaglebone black – so, at the command prompt (I am using Angstrom here):
1 2 3 |
opkg update opkg list|grep ntp opkg install ntp |
Next, find a NTP server that is close to your location. We need to do this to be good ‘ntp citizens’ as it is not good to use a NTP root server as they are already heavily loaded … it is better to use a NTP pool server that is close to your location in order to help with load balancing.
A Google search for my location “ntp server ireland” returns the website http://www.pool.ntp.org/ which you can search for your location. For Ireland I get:
1 2 3 4 |
server 0.ie.pool.ntp.org server 1.ie.pool.ntp.org server 2.ie.pool.ntp.org server 3.ie.pool.ntp.org |
So, I have edited my /etc/ntp.conf file to contain:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# This is the most basic ntp configuration file # The driftfile must remain in a place specific to this # machine - it records the machine specific clock error driftfile /etc/ntp.drift logfile /var/log/ntpd.log # NTP Servers for Ireland from www.pool.ntp.org server 0.ie.pool.ntp.org server 1.ie.pool.ntp.org server 2.ie.pool.ntp.org server 3.ie.pool.ntp.org # Using local hardware clock as fallback # Disable this when using ntpd -q -g -x as ntpdate or it will sync to itself # server 127.127.1.0 # fudge 127.127.1.0 stratum 14 # Defining a default security setting restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap |
The driftfile specifies the file that is used to store information about previous responses from the NTP servers you are using. This file contains internal information for NTP – leave it at /etc/ntp.drift
If you only want to allow machines within your own network to synchronize their clocks with your server, but ensure they are not allowed to configure the server, set the restrict value as above. In my case, 192.168.1.0
is the IP address of my network and 255.255.255.0
is my network’s netmask.
Important – make sure that you comment out the server and fudge lines or the server will sync to itself!
Setting the logfile above is very useful as it allows you to check the /var/log/ntpd.log file to see what is going wrong if you are having problems.
Set your localtime file according to your time zone
Next you need to set your /etc/localtime file according to your timezone. If you go into the directory /usr/share/zoneinfo you will see a lot of different timezone files, e.g.
1 2 3 4 5 |
root@beaglebone:/usr/share/zoneinfo# ls Africa CET EST5EDT GMT Greenwich MST7MDT PST8PDT UCT WET America CST6CDT Etc GMT+0 HST NZ Pacific UTC Zulu Asia EET Europe GMT-0 MET NZ-CHAT ROC Universal iso3166.tab Australia EST GB GMT0 MST PRC ROK W-SU zone.tab |
You can copy the file directly or use one of the presets. In my case, Irish time is the same as London time. So,
1 2 3 4 5 6 7 8 |
root@beaglebone:/usr/share/zoneinfo# cd Europe/ root@beaglebone:/usr/share/zoneinfo/Europe# ls -al total 20 drwxr-xr-x 2 root root 4096 Mar 18 2013 . drwxr-xr-x 9 root root 4096 Jan 1 11:42 .. -rw-r--r-- 1 root root 3661 Mar 19 2013 London -rw-r--r-- 1 root root 1464 Mar 19 2013 Moscow -rw-r--r-- 1 root root 2945 Mar 19 2013 Paris |
So, I am going to use the London file – back to the /etc directory:
1 2 |
root@beaglebone:/etc# rm localtime root@beaglebone:/etc# ln -s /usr/share/zoneinfo/Europe/London /etc/localtime |
by setting a symbolic link from /etc/localtime to the timezone file. The advantage of this over copying the file is that you can see the timezone that was set when you ls:
1 2 3 4 |
root@beaglebone:/etc# ls -al|grep localtime lrwxrwxrwx 1 root root 33 Jan 1 12:05 localtime -> /usr/share/zoneinfo/Europe/London root@beaglebone:/etc# ls -al localtime lrwxrwxrwx 1 root root 33 Jan 1 12:05 localtime -> /usr/share/zoneinfo/Europe/London |
Okay, next we need to start the services. Follow the steps carefully…
Enabling the NTP Services
Setup the ntpd server by typing:
1 2 |
root@beaglebone:/etc# systemctl enable ntpdate.service root@beaglebone:/etc# systemctl enable ntpd.service |
This installs two services:
1 2 3 4 5 6 7 8 9 10 11 12 |
root@beaglebone:/lib/systemd/system# more ntpd.service [Unit] Description=Network Time Service After=network.target [Service] Type=forking PIDFile=/run/ntpd.pid ExecStart=/usr/bin/ntpd -p /run/ntpd.pid [Install] WantedBy=multi-user.target |
and a second service:
1 2 3 4 5 6 7 8 9 10 11 12 |
root@beaglebone:/lib/systemd/system# more ntpdate.service [Unit] Description=Network Time Service (one-shot ntpdate mode) Before=ntpd.service [Service] Type=oneshot ExecStart=/usr/bin/ntpdate-sync silent RemainAfterExit=yes [Install] WantedBy=multi-user.target |
However, and importantly on the Beaglebone black you have to modify the second service to:
1 2 3 4 5 6 7 8 9 10 11 12 |
root@beaglebone:/lib/systemd/system# more ntpdate.service [Unit] Description=Network Time Service (one-shot ntpdate mode) Before=ntpd.service [Service] Type=oneshot ExecStart=/usr/bin/ntpd -q -g -x RemainAfterExit=yes [Install] WantedBy=multi-user.target |
So, importantly you must replace the line “ExecStart=/usr/bin/ntpdate-sync silent” with the line “ExecStart=/usr/bin/ntpd -q -g -x”. The time will not automatically update unless you make this change. The reason for this is given in the ntpd man page (http://linux.die.net/man/8/ntpd):
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. When the machine is booted, the chip is used to initialize the operating system time. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. This causes ntpd to exit with a panic message to the system log. The -g option overrides this check and the clock will be set to the server time regardless of the chip time. However, and to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set, an error greater than 1000s will cause ntpd to exit anyway.
Finally, reboot and the date/time should be fine:
1 |
root@beaglebone:~# reboot |
Note: If your ssh client ever hangs on a reboot type ~. and it should kill the ssh client session.
When the system comes up:
1 2 |
root@beaglebone:/lib/systemd/system# date Sat May 18 23:27:49 BST 2013 |
And, this could be the case from now on. Enjoy, and remember to remain a good NTP citizen.
Fixing the Hardware Clock
Thanks to Louis Thiery in the comments below – he pointed out that the RTC Time was still out after you perform the steps above. I have made one additional change to the configuration and it seems to do the trick – It is probably a bit of a hack! but it seems to work…
Modify the ntpdate.service file to add one more line:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[Unit] Description=Network Time Service (one-shot ntpdate mode) Before=ntpd.service [Service] Type=oneshot ExecStart=/usr/bin/ntpd -q -g -x ExecStart=/sbin/hwclock --systohc RemainAfterExit=yes [Install] WantedBy=multi-user.target root@beaglebone:/lib/systemd/system# |
that calls the hwclock and requests it to use the system time to set the hardware clock. This appears to work as when you reboot and call timedatectl, you get the following output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
root@beaglebone:/lib/systemd/system# timedatectl Local time: Sun 2013-06-09 01:06:26 BST Universal time: Sun 2013-06-09 00:06:26 UTC RTC time: Sun 2013-06-09 01:06:26 Timezone: Europe/London (BST, +0100) NTP enabled: no NTP synchronized: yes RTC in local TZ: no DST active: yes Last DST change: DST began at Sun 2013-03-31 00:59:59 GMT Sun 2013-03-31 02:00:00 BST Next DST change: DST ends (the clock jumps one hour backwards) at Sun 2013-10-27 01:59:59 BST Sun 2013-10-27 01:00:00 GMT root@beaglebone:/lib/systemd/system# |
You can see here that the RTC time is now the same as Local time and all appears to be in order – And, in case you are concerned, yes, it is actually 1:06am, time for my bed!
Thanks for sharing this.
Just a quick note in the latest BeagleBone black image (2013-05-20) they automatically sync the time. All what you need to do is to override /etc/localtime with your timezone otherwise it is UTC by default
Thanks, that is good news. I would still recommend that people edit /etc/ntp.conf to set the servers to local ntp pools.
Dear Derek,
it worked straight forward, only the RTC synchronization went different because it didn’t worked the way above. Instead of
root@beaglebone:/lib/systemd/system#
I used
hwclock -w
And my RTC was set to the system time
Hello Dev,
are You sure? I just installed the image and it do not work.
Hi Derek
Thanks for writing this up!
First off, I think that the current BBB image still doesn’t do this automatically, so I’m not sure if the previous comment is accurate. The only thing about the new BBB image is that linking is no longer necessary but I see that you already removed that part of the tutorial.
Secondly, I noticed that although this change allows us to synch the OS clock with the ntpd pool, our hwclock is left with a silly time which can be observed by typing: timedatectl (or hwclock)
What I’d like to do is correct the hwclock so that we have it giving an accurate value should we reboot without Internet connectivity. I think that I should create another systemd process that runs when ntpdate.service is successful, which would simply be the command
hwclock --systohc
but I’m still trying to figure how to create that dependancy of processes with system.dAnyway, I just wanted to write up the idea in case someone has good resources on this. I’ll have time to tinker with it tomorrow.
–Louis
Thanks Louis,
Well spotted and described! I have found one solution and added it to the page description. If you find a better solution, please let me know.
Thanks again,
Derek.
Hi Derek,
Ah that’s really easy the way you did it. I was complexifying it and thinking I needed to make another systemd task that would watch for this one to finish. Simple adding another ExecStart line the way you did is a lot easier and makes sense. If we were doing a completely different not clock related task that depended on the clock, a separate service might be appropriate.
Thanks,
Louis
Hi Derek,
and thanks a lot for your excellent blog posts on the Beagleboard Black! Its always a lot of fun to read through them. One question popped to my mind: Is the BBB making actually use of its onboard RTC so you can use the hwclock command?
Thanks for the tutorial however I am on the (currently) latest build 2013-06-06 and when I run:
enable ntpd.service
I get:
-sh: enable: ntpd.service: not a shell builtin
I tried to see if ntpd was something I could install using opkg however no luck. Any suggestions would be greatly appreciated. As silly as it seems my shiny new BBB is completely useless to me until I can get the time to update at boot. Back to the Raspberry Pi until the next update.
Mark, even I had the same problem ntpd.service was not present in my board too. I manuaaly created and modified it. Could you please tell me what the solution could be to this problem?
Just a not on this old comment, you didn’t type the whole command line. it is:
systemctl enable …
not
enable …
Wow! A lot more complex than I would have thought when I set out to get my BBB to set its clock to nist. But it worked perfectly. Thanks Derek.
Correction to above. When I enter:
systemctl enable ntpd.service
I get:
Failed to issue method call: No such file or directory
Hi Mark, I’m afraid I have no idea, Derek.
Derek,
I was having this problem also. I Google d for hours and although there are LOTS of people having this problem with various applications, there were no solutions to be had. When I finally gave up on finding the solution on Google I found that you had fortunately provided the contents of these .service files and where they should reside (/lib/systemd/system).
I have no idea why these files were missing, but I manually created them and was able to get rid of that error message and continue.
I would suggest that you put a notice just before where the service are enabled, such as:
“If you get the error ‘Failed to issue method call: No such file or directory’, look for the files ntpd.service and ntpdate.service in /lib/systemd/system/. If they are not there, you can create them by copying and pasting from (link to original ntpd.service and ntpdate.service) or (link to final ntpd.service and ntpdate.service). If you copied the original files, just continue from (link to Setup the ntpd server) and make the required changes. If you copied the final version of the files, continue from (link to Setup the ntpd server) and just read about the changes that were used to create the final files.”
In the section “Enabling the NTP Services, line #1 is “root@beaglebone:/lib/systemd/system# more ntpd.service”. That is actually what led me to finding the problem. I would suggest to make it a comment such as “# /lib/systemd/system/ntpd.service”. That way, if anyone does apply my solution, they can just cut and paste it and use it as is.
Also, in the section about fixing the hardware clock line #13 is “root@beaglebone:/lib/systemd/system#”. I would suggest removing it and replacing it with a comment at the top.
Thank you very much for sharing this information. I don’t think I would ever figured all this without it.
Jody
Same problem as you, only I can’t find the ntpdate.service or ntpd.service files anywhere. Where did you find yours?
Hi,
I am running
Linux beaglebone 3.8.13 #1 SMP Wed Jun 5 11:21:00 CEST 2013 armv7l GNU/Linux
This command worked
ntpdate -b -s -u pool.ntp.org
I followed instructions to set up the processes and could not get it to run. I got these errors
root@beaglebone:/etc# systemctl status ntpd.service
ntpd.service – Network Time Service
Loaded: loaded (/lib/systemd/system/ntpd.service; enabled)
Active: failed (Result: exit-code) since Fri 1999-12-31 19:03:27 EST; 13 years 5 months ago
Process: 141 ExecStart=/usr/bin/ntpd -p /run/ntpd.pid (code=exited, status=0/SUCCESS)
Main PID: 147 (code=exited, status=255)
CGroup: name=systemd:/system/ntpd.service
root@beaglebone:/etc# systemctl status ntpdate.service
ntpdate.service – Network Time Service (one-shot ntpdate mode)
Loaded: loaded (/lib/systemd/system/ntpdate.service; enabled)
Active: failed (Result: exit-code) since Fri 1999-12-31 19:00:04 EST; 13 years 5 months ago
Process: 130 ExecStart=/sbin/hwclock –systohc (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/ntpdate.service
root@beaglebone:/etc# date
Any suggestions?
Hi Stephen,
Did you do the part where you modify the line to:
ExecStart=/usr/bin/ntpd -q -g -x
Derek
It work great on my BBB when I use it on SSH. But I can not use it on the GUI mode with external monitor and keyboard and mouse after I reboot. It seem hang, but I can still use the SSH.
I have try the 5.27 and 6.6 image it both get hang on GUI.
Derek,
Thanks for these instructions, and the others.
I noticed that installing ntp also created an init file as /etc/init.d/ntpd. Does that not interfere with the systemd installation?
Hi Johan, if memory serves me right, because the beaglebone is using the systemctl system manager, the /etc/init.d/ntpd does not start ntpd. I had started not realising this fact and initially I didn’t understand why changes within init.d were having no effect. Kind regards, Derek.
Finally i know the resaon (i.e. there is no resaon !) the ntp standard linux command does not work on Asus EeePc Xandros o.s. !Anyway, the hint proposed works fine: thanks a lot.
There is a typo on line 3 of the “Install the NTP Software”
okpg install ntp SHOULD BE opkg install ntp
Not a big deal unless you are cutting and pasting like I was 🙂
Thanks for that! Fixed.
i thing there is a bug, look at this:
root@beaglebone:~# date
Tue Jul 23 13:00:38 GMT-7 2013
root@beaglebone:~# timedatectl
Local time: Tue 2013-07-23 13:00:47 GMT-7
Universal time: Tue 2013-07-23 06:00:47 UTC
RTC time: Sat 2000-01-01 00:07:10
Timezone: Etc/GMT-7 (GMT-7, +0700)
NTP enabled: no
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
root@beaglebone:/etc# ls -la localtime
lrwxrwxrwx 1 root root 29 Jul 17 11:51 localtime -> /usr/share/zoneinfo/Etc/GMT-7
i’m in GMT+7 area, but i have to set GMT-7 into beaglebone. ‘GMT+x is flip over with GMT-x’
Thanks for this guide. I was wondering… since “ntpdate -b -s -u pool.ntp.org” updates the time why that couldn’t be set as a system service. At first it didn’t work, but then I configured systemd to restart the process if it fails. My /lib/systemd/system/ntpdate.service looks like this:
[Unit]
Description=Network Time Service (one-shot ntpdate mode)
Before=ntpd.service
[Service]
Type=oneshot
ExecStart=/usr/bin/ntpdate -b -s -u pool.ntp.org
RemainAfterExit=yes
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Is there any reason why I shouldn’t do it this way?
Matt Richardson’s method did the trick for me….
Hi,
I have following the steps on a BBB running the latest image from Angstrom.
Everything looks ok, but the time does not update (connected via Ethernet to the web).
If I try to manually update the time using:
ntpdate pool.ntp.org
I get:
__libc_res-Nquery: Assertion ‘hp != hp”‘ failed.
Which is not very helpful to me.
Using the following:
opkg update
opkg install ntpdate
opkg install ntp
confirms that ntp and ntpdate are both up to date.
Where may I have gone wrong?
I’ve been having problems with my time not being set even after I followed your instructions. I think it has to do with my wireless networking issues immediately after booting. I’m still working on getting my 5.8GHz wireless to be stable and consistent.
I happened to be looking into another problem and was thinking about putting something into the cron jobs to happen and ran the command “crontab -e” while logged in as root. I was surprised to see a command configured to be run every 30 minutes “/usr/bin/ntpdate-sync” so I looked at it’s contents. If you put a list of ntpservers in /etc/default/ntpdate it should keep your Angstrom distribution synced with even less effort than following your instructions.
I followed the instructions and it works. But my question is why does it need both ntpdate and ntp? I thought that ntpdate was deprecated and the functionality is now included in ntp.
I use only ntp on my Beaglebone
ARMv7 Processor rev 2 (v7l)
Linux 3.8.13
The time on my Beaglebone lags considerably behind the true time. This may be related to the new Linux version. Can anybody replicate this?
The following commands will reset the time
/etc/init.d/ntpd stop
ntpd -q -g
/sbin/hwclock –systohc
/etc/init.d/ntpd start
Hi.
Thanks for the writeup. I am not able to find my region listed in the /etc/localtime folder. I am in GMT + 5:30. How do I proceed?
Thank you.
Setting the hardware clock as described seems to ignore the timezone. Here’s my ntp log.
1 Jan 03:18:23 ntpd[255]: DNS 3.ch.pool.ntp.org -> 130.60.204.10
21 Aug 12:04:33 ntpd[135]: ntpd: time set +430386363.526481 s
(here also the hardware clock was set)
21 Aug 12:05:51 ntpd[344]: ntpd exiting on signal 15
21 Aug 14:06:13 ntpd[128]: Deferring DNS for 0.ch.pool.ntp.org 1
21 Aug 12:06:27 ntpd[128]: ntpd: time set -7200.366256 s
After the reboot there is a 2 hour delay (I’m in Paris timezone) which presumably is the hardwareclock. This gets corrected by the ntpd call, but that’s not the goal.
Any idea how to set the hardware clock by taking correctly into account the timezone?
To set the hardware clock with UTC time, use the –utc option.
By the way, why using a ln command to set the time zone.
timedatectl list-timezones and timedatectl set-timezone do the job
Hi,
I need some help. I followed the exact procedure and my timezone is changed but as mentioned by Stefan the the date is Fri 1999-12 31 and NTP Synchronized = NO. Could you please help me? I am not being able to figure out the problem.
Also when I put ntpdate -b -s -u pool.ntp.org I get an error saying cannot resolve pool.ntp.org Name or server not found
Hi Derek
I just updated Angstrom with the latest image and I this is what I get
root@beaglebone:~# opkg update
Collected errors:
* opkg_conf_load: Could not create lock file /var/lib/opkg/lock: Read-only file system.
I cant install any packages
any ideas?
Hey,
Just delete the file. even I had the same error. It works!
Hello, I’m able to synchronize the Beaglebone when it’s connected to my LAN, but if instead I of connecting to that I connect the beagle to a 3G/GPRS router, the beagle is unable to get the date. I can transfer some files across the router, but not to synchronize the board.
I’ve update to the 2013-09-04 image on my BBB and followed the steps and succeeded finally. I am grateful for the detailed explanation and wanna add the following from my experience:
1) NTP is installed on my BBB, i.e. I can call ntp. But somehow the ntpd is not installed. So, I think several problems mentioned above are the same type, that the ntpd is not installed.
2) Following the steps with the ntpd did NOT solve the issue. After reboot the time was simply still the same. I was able to fix it with the reply from Matt Richardson above. So, the question for me after following these lines, if I really need to do the opkg install ntp or not. i.e. Would it have succeed with just the installed image processes or not? After removing the ntpd.service the function was still available. I don’t mind too much since it works now 🙂
3) The trick with the hwclock is the one I like really 😉
4) Does anybody know how to make the above steps as a script? This would be very useful in case of an image-update.
Derek
Your blog is very helpfull and appreciated…
the time and date my new BBB is (finally) correct
but after some fiddling and without the last mod
this message is sent via the BBB driven from a vnc windows box
(1h16 am enougn for tonight 🙂
Hi Derek, hi Matt,
Thanks a lot for your tutorial and, of course, your time to participating on this discussion.
I could get the correct RTC, after your and Matt Richardson directions, but after rebooting and timedatectl command I received the answers:
…..
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
…..
Questions: what means NTP enabled: no? And the others questions?
Best regards,
José Henrique
Observing better the timedatectl answer, I’ve gotten also: RTC time: Sat 2000-01-01 01:09:11.
Thanks again,
JH
I am new to Linux. It’s been time consuming to follow the steps to make my BBB update the date and time. It worked perfectly.
After I try Ubuntu I reloaded the Angstrom OS and the BBB went back the year 2000. I had to repeat all the steps again.
Is it possible build a script to do this?
My regards and thanks
Using 2013-09-04 followed all your steps and time not correct after reboot, followed Matt Richardson’s method and it works now.
Hi Derek,
I just wanted to thank you for your clear & informative posts here and on YouTube.
I’m something of a newbie to Linux so your information is a real lifeline to me. Your students are lucky to have you!
Regards,
Mike
Instead of linking the timezone file into /etc/localtime you can also run
sudo dpkg-reconfigure tzdata
on any Debian-based system. Saves you a lot of hassle IMHO.
I wanted to disable the automatic date sync. I already removed ntp but BBB is getting date when I connected to internet from somewhere that I do not know. Do you what process is syncing when I connect the ethernet cable?
Thank you
Hello all ,
What should I do if I want to set Indian standard time on to BBB.???? I have tried it but i m not able to set IST on to my BBB. Please help]
Hello All,
Sub – While booting Beaglebone Board hangs and shell promt is not coming
I used prebuild bootloader (MLO and u-boot.img) provided with the
board, then I am facing this issue –
systemd-fsck[86]: rootfs: clean, 5551/172832 files, 43656/691200 blocks
1) I checked in three computer . In two , it is working correctly and
shell promt is coming also.
(i checked ls, cd ,uname command)
But in one computer in last at the time beaglebone login it hangs
and message comes like:
systemd-fsck[86]: rootfs: clean, 5551/172832 files, 43656/691200 blocks
Will you please guide
Hi Derek,
I’m using Linux beaglebone 3.8.13 #1 SMP Thu Sep 12 10:27:06 CEST 2013 armv7l GNU/Linux
I just caught this and it might help others. I’ve noticed that the file /etc/resolv.conf is not persistent across the reboot. Adding the nameserver to the file was lost. So I placed the line echo ‘nameserver 8.8.8.8’ >> /etc/resolv.conf into /usr/bin/g-ether-load.sh hoping that would work. It did not and I think the reason is that /etc/resolv.conf is overwritten after g-ether-load.sh executes during boot.
I know this is a leading question but could you tell me where to put it? 😉
Hi,
I have developed an application (running on Beagle bone Black) which uses msmtp as its smtp client. Now, When I run this application from BBB command prompt, application can send email successfully. But after that, I have created a service which will start my application automatically every time BBB boot-up but in this case, application can not send email.
Also, I have added some debug messages in my application. When I run this application manually from command line, I can see debug messages on command window but in case of auto startm these debug messages are not there.
Can you please share your inputs in this regard.
Thanks,
Ashish
Аnother solution for auto update date and hwclock 🙂
1. Open /etc/rc.local
nano /etc/rc.local
2. Enter this commands before exit 0
ntpdate -b -s -u pool.ntp.org
hwclock -w
exit 0
3. That`s it all 🙂
Hint: replace pool.ntp.org whit correct zone. Example: my is bg.pool.ntp.org
P.S. /etc/rc.local script that is executed at the end of startup.
Thanks so much for doing the leg work on this, and then being kind enough to share the fruits of your labor. You’re a prince.
Cheers,
Jeff
Thank You Mr.Derek!
Followed your steps and got the problem solved.
Thanks again.
Hi everybody,
I’ve some problems with installing NTP software – when I type opkg update I get such errors:
Collected errors:
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/machine/beaglebone/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/debug/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/gstreamer/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/all/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/perl/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/python/Packages.gz, wget returned 1.
And after opkg install ntp command I get:
Unknown package ‘ntp’.
Collected errors:
* opkg_install_cmd: Cannot install package ntp.
What should I do with this?
Thank you,
Dima
Dima,
Did you ever find a solution for your BBB? I have been having the same issues.
Hi,
I am working on my own board which I have RTC and the board is 90% reference from BeagleBone Black. I would like to know how can I get the NTP installed (default) in my OS (Wheezy) image when I distribute my boards to customers? I could not afford to install/repeat the process in every single boards.
Thank you!
Yong
Hi all,
I have read that one may connect a rechargeable battery to the power management IC pins on the board (they are unpopulated), then it may be possible to have an almost permanent RTC functionality such as wake up events etc.
I hope to investigate it if I get one of these boards:
http://electronics.stackexchange.com/questions/98553/how-can-i-power-beagle-bone-black-with-3-7v-lipo
http://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone//blog/2013/08/10/bbb–rechargeable-on-board-battery-system
https://groups.google.com/forum/#!topic/beagleboard/vnu8sC9fgYo
Hi Derek I have a problem , How active DST active? In my beagle appear DST active:n/a
greetings from Mexico
Hi Luis,
What’s your timezone? I had the same issue with timezone UTC, changed that to Paris and all works fine now.
Regards,
Bart
I am having the same issue as Dima. When following Derek’s instructions I get the following:
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/machine/beaglebone/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/debug/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/gstreamer/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/all/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/perl/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/python/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Collected errors:
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/base/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/machine/beaglebone/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/debug/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/gstreamer/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/all/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/perl/Packages.gz, wget returned 1.
* opkg_download: Failed to download http://feeds.angstrom-distribution.org/feeds/v2012.12/ipk/eglibc/armv7a-vfp-neon/python/Packages.gz, wget returned 1.
Anybody have a solution to this problem? Any help is greatly appreciated.
I have managed to install the NTP daemon and get it synchronizing to the internet fine by following the instructions above. However, I would like to get the board synced to a GPS time reference. I have inherited a LC2750 GPS time reference from these guys: http://www.TimeToolsGlobal.com. Has anyone used one of these or have any information on how to use GPS for syncing in general?
Thanks for great tutorial….
I have one problem please need help.
problem is I have python program that uses the Tkinter and display frame one after other. Program is running from terminal when I type python .
but I want to start It at boot time that is when my beaglebone black start my program should run automatically.
Please Help me out.
Hi Derek,
Thank you so much for this tutorial! I’m running Debian on my BB right now but I cannot seem to execute the following commands:
root@beaglebone:/etc# systemctl enable ntpdate.service
root@beaglebone:/etc# systemctl enable ntpd.service.
Are there alternate commands for Debian?
You need to manually create those files and then run the enable commands.
I am trying this on Debian too. Did you find any solution? Please let me know. Thanks
I’ve got a problem with I try to enable using $systemctl.
I run $systemctl enable ntpdate.service
$systemctl enable ntpd.service
And I get about the same error using $systemctl status.
It errors with ExecStart for ntpdate.service and ntpd.service. I tried looking in /usr/bin for ntpd but I couldn’t find it. There were ntpq and ntpdc but no ntpd.
Thoughts? Do I need to change my ExecStart statments to use ntpq? If so, how?
With the latest Debian image, all you have to do is:
sudo apt-get install ntp
The service is automatically enabled and will start at boot.
is there a way to setup Chronyd instead of ntpd , an use gpsd to setup BBB datetime from a GPS connected to a TTYxx serial port?
If so, would somebody share the required steps?
Cheers,
JF
Hi,
I am new to beaglebone. I am running a beaglebone with Debian On it. I tried this solution and I could not make it a success with these steps as Debian commands (or some of these steps) can not be executed. Is there a way of getting this done with a Debian on it? Really appreciate your help. Please consider as I am new to this. Thanks
Hi…. I saw your video on Beaglebone- Getting started with USB network adapter setup tutorial.
Im getting
root@beaglebone:~# ./StartUSBNetwork
Setup script for the EE402 module – Derek Molloy
Setting up the default gateway
SIOCADDRT: File exists
Updating the nameserver entry
Setting the time using the Irish ntp pool
./StartUSBNetwork: 10: ./StartUSBNetwork: /usr/bin/ntpdate: not found
When i tried what you had done at 15:36 in your video. The 10th line should be just ntpdate, instead of /usr/bin/ntpdate…… Is there a way to fix this?
i tried ntpdate -b -s -u ie.pool.ntp.org
im getting Error resolving ie.pool.ntp.org: Name or Service not known(-2)
Is there a way to fix this??
i used apt get instead of opkg for debian based bbblack but it showed” no such command found”.can anyone guide how to change the commands so that these can run on debian based beagle bone black
If you are logged in as a user, try again using sudo apt-get
Hi, thanks for the write up!
I get an error with opkg update:
Downloading http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/base/Packages.gz.
wget: bad address ‘feeds.angstrom-distribution.org’
Downloading http://feeds.angstrom-distribution.org/feeds/v2013.06/ipk/eglibc/armv7ahf-vfp-neon/machine/beaglebone/Packages.gz.
it goes on but you get the idea.
I’m stuck. is this because of http://wp.angstrom-distribution.org/feed-server-down-were-working-on-it/ or is there something I can do about it?
1. Is it possible to store the text files in Beaglebone black ?
Beaglebone black is communicate to arduino or some other microcontroller. This arduino is send text files to BBB and these are connected via ethernet. These text files are store to internal storage of BBB.
Hello Derek!
Now my device used without internet. I set up system clock (date -s … ) but in two boards clock lags about 10 min over 1 hour. How do you think, what is it? How i can fix it?
Best Regards, Vladimir!
Hi Derek,
I tried to change my clock on BeagleBoneBlack various time with various ways … using your videos and your commands here but it is still stuck on 2000. I am using Jessie 8.1 …. any ideas what the problem might be ?
Hi, Derek.
I failed at the first step , and the command window shows: root@beaglebone:~# ntpdate -b -s -u pool.ntp.org
Error resolving pool.ntp.org: Name or service not known (-2)
I’m really stuck now. I am using the ubuntu 14.04.
Can you figure me out?
Hi Derek
i Shaw below line in comment, i’m going to develop a product using beagle-bone, what ntp service affect the GUI of beagle-bone?
——————————————————————————————————————————————————————————————
“It work great on my BBB when I use it on SSH. But I can not use it on the GUI mode with external monitor and keyboard and mouse after I reboot. It seem hang, but I can still use the SSH.I have try the 5.27 and 6.6 image it both get hang on GUI.”
——————————————————————————————————————————————————————————————
At this time we are not going to use GUI(SSH preferred) but may be in future it creates problem, please give me replay as soon as possible quick
Derek,
Thank you for your consistently solid, reliable articles on the BBB. This one is another fine example.
Don
Hello! I would like to help out those who are trying to configure Jessie on the BBB. There is this connection manager process that handles network connections (including ntp functionality):
root 383 1 0 02:28 ? 00:00:01 /usr/sbin/connmand -n
The commands I used to configure my eth0 interface are these (Comcast is my service provider, and I am in North America, so change these as you please):
connmanctl config ethernet_544a16e6d646_cable –ipv4 manual 192.168.1.115 255.255.255.0 192.168.1.254
connmanctl config ethernet_544a16e6d646_cable –nameservers 8.8.8.8 8.8.4.4 75.75.75.75 75.75.76.76 2001:558:feed::1 2001:558:feed::2
connmanctl config ethernet_544a16e6d646_cable –timeservers time1.google.com time2.google.com time3.google.com time4.google.com 0.north-america.pool.ntp.org 1.north-america.pool.ntp.org 2.north-america.pool.ntp.org 3.north-america.pool.ntp.org
connmanctl config ethernet_544a16e6d646_cable –domains hsd1.md.comcast.net
My home router is set to serve up DHCP addresses from 192.168.1.120 to 192.168.1.253 (for laptops, smartphones, etc). All addresses below that are meant to be static addresses (for anything serving up a service).
The connman ethernet service will be different for everyone. To see what your ethernet service (including wifi and anything else) is run the command
connmanctl services
On mine I get just the one ethernet service:
root@beaglebone:/etc# connmanctl services
*AO Wired ethernet_544a16e6d646_cable
root@beaglebone:/etc#
Google for “debian connman” (without the quotes) to learn more.
Hello
I’ve always referred to your site for guidance.
Last week I had a need to change the time zone in my BBB.
Just before I started installing NTP as advised here, I stumbled on this post..
http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Jessie_Timezone
It worked really well for me.
Cheers,
Stuart
hello
i am a newbie in coding and trying to configure my BBB to Linux in centos VM. When I end up following the steps i can get the correct date and also get acces to the internet by using the ping function.
But when i disconnect the BBB from the VM and reconnect it the date is again not accurate. Is there a function I need to add to BBB to make it remember the configuration?
sincerely
Qazaz