running ntpdate to get time

I’m new, so there’s some early step that I’ve overlooked, but I can’t set the time, and I don’t know why. I’m running the Ver C BBB with Debian pre-installed. I have flashed the newest OS version, and have found PuTTY to get me access to the SSH shell. I’ve even got a single LED to light up with some sample code that I’ve found. I now want to apt-get update and install, but I’ve been told to get my date set up first so that the update/install goes smoothly, but …

Both of:
root@beaglebone:~# ntpdate
root@beaglebone:~# sudo ntpdate

get me a response of:

Error resolving Name or service not known (-2)
15 May 07:34:42 ntpdate[5292]: Can’t find host Name or service not known (-2)
15 May 07:34:42 ntpdate[5292]: no servers can be used, exiting

While we’re at it, when should sudo be used or avoided … I’m really not clear on this.


It seems like your name resolver (DNS) may not be set up correctly. Try something like "ping". If that doesn't work, then look at /etc/resolv.conf which should contain the IP addresses of your nameservers.
BTW sudo is only necessary to run a command that needs root privileges from a non-root account. In your case it appears that you are running as root (the "#" prompt).



Reading between the lines, I suspect you're connected via USB, so you
won't have networking on the 'Bone unless you configure your host system
to forward traffic for the 'Bone to the internet or (easier) hook up an
Ethernet cable to the BBB.

Thank you gentlemen!

Pinging did not get an answer. Adding the ethernet cable worked for the Google ping once I halted and rebooted the BBB. The ntpdate then worked just as it should. A little digging should get me a parameter of some sort to add, to tell the ntp system that I’m offset by -8 hours from GMT (or CUT as I hear it more often now).

A nice bonus too is now knowing what that sudo stuff is all about. I’m not new to computing (mainly business management systems), but BBB, Debian, editors, shells, Python all at once is quite a nice challenge. I’ve had quite a few small victories on my own with this, but I don’t doubt that I’ll be back with my hand raised again.

Thanks again

Hey, rjc
Now I’m having the same problem as you did. Like:

root@beaglebone:~# ntpdate
Error resolving Name or service not known (-2)
24 Apr 04:50:13 ntpdate[1143]: Can’t find host Name or service not known (-2)
24 Apr 04:50:13 ntpdate[1143]: no servers can be used, exiting
Can you tell me how exactly you figure your problem before? That will help me a lot.

在 2015年1月3日星期六 UTC+8下午12:46:19,rjc2827写道:

lemme guess you are connected to your bone with USB and you dont have
internet connection sharing enabled ?