Small embedded system, need working ntpd...

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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.

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).  In either case it doesn't work, gives me the
"unknown user _ntp" and that's as far as I get.

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

TIA,
Mark Brodis


Re: Small embedded system, need working ntpd...
Quoted text here. Click to load it

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/openntpd/snapshot/openntpd-20050626p.tar.gz

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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 <stdio.h>
#include <sys/types.h>
#include <pwd.h>

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
We've slightly trimmed the long signature. Click to see the full one.
Re: Small embedded system, need working ntpd...
Thanks for your response!

I had already figured out the majority of the problems, it was with
some library conflicts....doh!!  Once that was resolved, and I got some
help from a brilliant embedded Linux guy, all fell into place...  :)


Site Timeline