View Single Post
  #2  
Old 09-30-2007, 09:41 AM
unix unix is offline
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Small embedded system, need working ntpd...

On 2005-06-08, Mark wrote:
> I have a small embedded system (pc/104 board, CF-boot, read-only root
> file system, etc). I am trying to get a ntp daemon to work to keep the
> time accurate. I downloaded and compiled (on the same hardware but
> booting off a HD, which has more space, and is a 'normal' gentoo
> system) openntpd (www.openntpd.org), however I am having trouble
> getting it to work.
>
> There seems to be almost no documentation with it, nothing that really
> explains how to get it to work.


Someone else emailed me about that today, also for an embedded system.
(The "make install" process normally takes care of most installation
tasks on self-hosted systems). The doco has been updated in the latest
snapshot with the details (see the INSTALL file):
http://www.zip.com.au/~dtucker/openn...050626p.tar.gz

> I ran the file (./ntpd) and it said it couldn't find a file,
> /etc/ntpd.conf, I then created that file, then ran it again, now it
> says "unknown user _ntp". I have a "_ntp" user and a "ntp" user (one of
> my linux gurus said it would not be _ntp, another said it would be
> _ntp, so I'm confused).


It defaults to "_ntp" unless you overrode it at configure time with
--with-privsep-user=foo.

> In either case it doesn't work, gives me the
> "unknown user _ntp" and that's as far as I get.


It's possible that the problem isn't in ntpd itself, eg if your flash
filesystem is missing some of the components required for the getpwnam()
function to work (eg /etc/nsswitch.conf or the libnss*.so files if
you're using glibc).

Try the test program at the bottom of this post. If that doesn't work
either then you need to take a closer look at your system.

$ ./a.out _ntp
home dir = /var/empty/ntpd
$ ./a.out root
home dir = /root

> Anyone used this ntpd, and if not, anyone have another simple, small
> ntpd I could throw into this project.


Well, it works for me :-) I have used it on an embedded Linux firewall/
router (300MHz Geode, 64MB RAM, 2.4 kernel, uClibc, busybox plus assorted
other stuff).

[example program]
#include
#include
#include

int main(int argc, char **argv)
{
struct passwd *pw;

if (argc != 2) {
printf("usage: %s username\n", argv[0]);
exit(0);
}
pw = getpwnam(argv[1]);
if (pw == NULL)
printf("getpwnam failed\n");
else
printf("home dir = %s\n", pw->pw_dir);
exit(0);
}

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
Reply With Quote