ntp-server: Cannot find user `ntp'

Klaus Alexander Seistrup kseistrup at gmail.com
Mon Dec 27 14:22:44 UTC 2004


One very weird thing is that the situation mentioned below only
happens under kernel 2.6.9.  If I boot in 2.6.8 ntpd starts from both
init and runsv.

Any suggestions?

On Tue, 21 Dec 2004 19:34:41 +0100, Klaus Alexander Seistrup
<kseistrup at gmail.com> wrote:
> Hi,
> 
> My pc is part of the pool.ntp.org¹ NTP pool, and for that reason I
> want my ntpd to stay in the air.  To accomplish that I have set up
> runit² to supervise the ntpd process and to restart ntpd if it exits.
> This used to work on my Debian/unstable box, but it fails on
> Ubuntu/hoary for reasons I cannot fathom (I'm using the same "run"
> script on Debian and Ubuntu).
> 
> The way it happens is this:  When run by runit, ntpd immediately exits
> and logs a "Cannot find user `ntp'" error message to syslog.  The
> funny thing is that when I run ntpd manually from a root prompt, ntpd
> starts as expected and setuid()'s itself to user ntp -- just the way
> it's supposed to -- but when run by runsv (heck, even when it's run by
> init!), ntp fails to "find user ntp".  First I thought it was a
> chroot() problem, but the behaviour persisted even when I specified
> "-i /".
> 
> My "run" script looks like this:
> 
> <snip>
> #!/bin/sh
> 
> exec 0</dev/null
> exec 2>&1
> 
> exec /usr/bin/chpst -e ./env -o 250 /bin/posh -c '
>   echo "<env>";
>   set;
>   echo "</env>";
>   exec /usr/bin/nice --adjustment="${NICELEVEL}" \
>     /usr/sbin/ntpd -n -p /var/run/ntpd.pid -c /etc/ntp.conf
> '
> 
> # we shouldn't be here
> exit 1
> # eof
> </snip>
> 
> I use posh instead of sh/bash because posh starts up faster, and
> leaves less garbage in the environment.  It has worked like a charm on
> Debian/unstable.
> 
> To reiterate:  I can -- and currently do -- start ntpd manually, using
> exactly the same method as above, but ntpd fails when the same "run"
> script is run by runsv.  Also, ntpd fails in a similar way when init
> runs the /etc/init.d/ntp-server script during startup.
> 
> Do anyone else experience this?  Or do anyone have comments to this
> weird behaviour (or mine, hehe...)?

-- 
Klaus Alexander Seistrup
SubZeroNet · Copenhagen · Denmark




More information about the ubuntu-users mailing list