# ntpd causes massive boot delay

## lo-jay

hi,

am using net-misc/openntpd-3.9_p1-r3. since an update i get a boot delay by the service trying to start before dhcp is up:

here part of  /var/log/rc.log 

```

* Bringing up interface lo

 *   127.0.0.1/8 ...

 [ ok ]

 *   Adding routes

 *     127.0.0.0/8 via 127.0.0.1 ...

 [ ok ]

 *   Running postup ...

 *     ntpd: waiting for net.lo (50 seconds)

 *     ntpd: waiting for net.lo (41 seconds)

 *     ntpd: waiting for net.lo (32 seconds)

 *     ntpd: waiting for net.lo (23 seconds)

 *     ntpd: waiting for net.lo (14 seconds)

 *     ntpd: waiting for net.lo (5 seconds)

 *     ntpd: timed out waiting for net.lo

 *     ERROR: cannot start ntpd as net.lo would not start

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd: invalid option -- 'N'

usage: dhcpcd [-dgknpqwxyADEGHJKLOTV] [-c script] [-f file] [-e var=val]

              [-h hostname] [-i classID ] [-l leasetime] [-m metric] [-o option]

              [-r ipaddr] [-s ipaddr] [-t timeout] [-u userclass]

              [-F none|ptr|both] [-I clientID] [-C hookscript] [-Q option]

              [-X ipaddr] <interface>

 [ !! ]

 [ !! ]

 * ERROR: net.eth0 failed to start

 * Mounting USB device filesystem [usbfs] ...

 [ ok ]

 * Mounting misc binary format filesystem ...

 [ ok ]

 * Activating swap devices ...

 [ ok ]

 * Initializing random number generator ...

 [ ok ]

* Starting D-BUS system messagebus ...

 [ ok ]

 * Starting NetworkManager ...

 [ ok ]

 * Starting Bluetooth ...

 [ ok ]

 *   Starting rfcomm ...

 [ ok ]

 * Starting metalog ...

 * Starting syslog-ng ...

 [ ok ]

 * Starting Hardware Abstraction Layer daemon ...

 [ ok ]

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd: invalid option -- 'N'

usage: dhcpcd [-dgknpqwxyADEGHJKLOTV] [-c script] [-f file] [-e var=val]

              [-h hostname] [-i classID ] [-l leasetime] [-m metric] [-o option]

              [-r ipaddr] [-s ipaddr] [-t timeout] [-u userclass]

              [-F none|ptr|both] [-I clientID] [-C hookscript] [-Q option]

              [-X ipaddr] <interface>

 [ !! ]

 [ !! ]

 [ !! ]

 * ERROR: net.eth0 failed to start

 * Mounting network filesystems ...

 [ ok ]

 * Starting vixie-cron ...

 [ ok ]

 * Starting local

rc default logging stopped at Sat May 21 05:10:55 2011
```

where would i start?

cheers again!

----------

## mikegpitt

What is the value for:

rc_depend_strict (in /etc/rc.conf if you are using baselayout-2)

or 

RC_NET_STRICT_CHECKING (in /etc/conf.d/rc if you are using baselayout-1)

It looks like the ntpd service is starting right after net.lo is started, but before any actual network devices are starting.

----------

## lo-jay

am running sys-apps/baselayout-2.0.2

it is commented out:

```
#rc_depend_strict="YES"
```

cheers!

----------

## mikegpitt

Hmm... no luck there.  I also noticed the dhcpd error in your post:

```
dhcpcd: invalid option -- 'N'
```

Not sure, but maybe this has something to do with the issue.  Is your system up to date?  I was able to find this error in bugzilla, but it points to an older dhcpcd version that is no longer in portage.

Can you post your `emerge --info`?

Not sure if you run other services depending on 'net' (e.g. apache), but if you do, do those start at the correct time?

In a pinch, you might be able to get around this error by using rc_parallel="YES" in your /etc/rc.conf -- but it wouldn't fix the error, only bypass it.

----------

## lo-jay

here we go:

```
emerge --info

Portage 2.1.9.42 (default/linux/amd64/10.0/desktop, gcc-4.4.5, libc-0-r0, 2.6.36-gentoo-r5 x86_64)

=================================================================

System uname: Linux-2.6.36-gentoo-r5-x86_64-Intel-R-_Core-TM-_i3_CPU_M_370_@_2.40GHz-with-gentoo-2.0.2

Timestamp of tree: Fri, 20 May 2011 13:30:01 +0000

app-shells/bash:     4.1_p9

dev-lang/python:     2.7.1-r1, 3.1.3-r1

dev-util/cmake:      2.8.4-r1

sys-apps/baselayout: 2.0.2

sys-apps/openrc:     0.8.2-r1

sys-apps/sandbox:    2.4

sys-devel/autoconf:  2.13, 2.65-r1

sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.5

sys-devel/gcc-config: 1.4.1-r1

sys-devel/libtool:   2.2.10

sys-devel/make:      3.81-r2

sys-kernel/linux-headers: 2.6.36.1

sys-libs/glibc:      2.11.3

virtual/os-headers:  0

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* skype-eula"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=k8 -pipe -O2"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=k8 -pipe -O2"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en de zh_CN"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdr cjk cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gdu gif gpm gtk iconv ipv6 jpeg kde lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3 qt3support qt4 readline sdl session spell sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb vorbis x264 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de zh_CN" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nv nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

thanks a lot!

ps: no other service that i know of

----------

## mikegpitt

Nothing really looks out of the ordinary, but something seems to be messed up with your network services starting.

Can you post the output of `rc-status` and your /etc/conf.d/net?

Also, what version of dhcpcd are you using?

----------

## lo-jay

```
$ rc-status

Runlevel: default

 dbus                                                                                                                    [  started  ]

 udev-postmount                                                                                                          [  started  ]

 metalog                                                                                                                 [  started  ]

 syslog-ng                                                                                                               [  started  ]

 vixie-cron                                                                                                              [  started  ]

 NetworkManager                                                                                                          [  started  ]

 bluetooth                                                                                                               [  started  ]

 hald                                                                                                                    [  started  ]

 netmount                                                                                                                [  stopped  ]

 local                                                                                                                   [  started  ]

Dynamic Runlevel: hotplugged

 net.eth0                                                                                                                [  started  ]

Dynamic Runlevel: needed

 sysfs                                                                                                                   [  started  ]

 udev-mount                                                                                                              [  started  ]

Dynamic Runlevel: manual

```

and

/etc/conf.d/net

```
config_eth0=( "dhcp" )

#dhcpcd_eth0="-N"

dhcp_eth0="nodns"

dns_servers_eth0=( "80.254.79.157" )

postup(){

 grep -e '^server' /etc/ntp.conf > /etc/ntpd.conf ||\

        echo "servers pool.ntp.org" > /etc/ntpd.conf

 /etc/init.d/ntpd restart

 }

```

thanks again!

----------

## mikegpitt

One thing I see right away is that your /etc/conf.d/net isn't set up for baselayout-2.  You will need to remove the parens so it looks like this:

```
config_eth0="dhcp" 

dhcp_eth0="nodns" 

dns_servers_eth0="80.254.79.157"

```

I'm assuming you added the postup, because ntpd wasn't able to start properly...  but you might want to remove it for the time being to ensure that it isn't causing another ill effect.  I'm also assuming the commented out line above was causing the dhcpcd -N error?

----------

## lo-jay

yep - that did the job!

 :Cool:  !

thank you so much!

ps: not sure were the lines came from...

```
grep ntpd /var/log/messages 

```

the last line gives

```
May 21 02:48:39 localhost /etc/init.d/ntpd[7441]: start-stop-daemon: no matching processes found

```

/var/log/rc.log looking better:

```
 * Bringing up interface lo

 *   127.0.0.1/8 ...

 [ ok ]

 *   Adding routes

 *     127.0.0.0/8 via 127.0.0.1 ...

 [ ok ]

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[3150]: version 5.2.12 starting

dhcpcd[3150]: eth0: waiting for carrier

dhcpcd[3150]: eth0: carrier acquired

dhcpcd[3150]: eth0: rebinding lease of 192.168.1.146

dhcpcd[3150]: eth0: acknowledged 192.168.1.146 from 192.168.1.1

dhcpcd[3150]: eth0: checking for 192.168.1.146

dhcpcd[3150]: eth0: leased 192.168.1.146 for 86400 seconds

dhcpcd[3150]: forked to background, child pid 3170

 [ ok ]

 *     received address 192.168.1.146/24

 [ ok ]

 * Mounting USB device filesystem [usbfs] ...

 [ ok ]

 * Mounting misc binary format filesystem ...

 [ ok ]

 * Activating swap devices ...

 [ ok ]

 * Initializing random number generator ...

 [ ok ]

rc boot logging stopped at Sat May 21 02:49:24 2011

```

----------

## mikegpitt

Great!   :Smile:    You can add ntpd to your default run level if you want it to start on each boot, and it should act properly now.

----------

## krinn

 *lo-jay wrote:*   

> 
> 
> ```
> $ rc-status
> 
> ...

 

you're a paranoiac logger ?  :Smile: 

ps: add solve to your thread to help others users with similar problem finding your thread and getting your solve

----------

## zoidie

I've been suffering from the same problem since updating base layout.

```
 * Setting system clock using the hardware clock [Local Time] ...

 [ ok ]

 * Loading module vboxdrv ...

 [ ok ]

 * Loading module vboxnetflt ...

 [ ok ]

 * Loading module vboxnetadp ...

 [ ok ]

 * Autoloaded 3 module(s)

 * Setting up the Logical Volume Manager ...

  No volume groups found

  No volume groups found

  No volume groups found

 [ ok ]

 * Updating /etc/mtab ...

 [ ok ]

 * Mounting local filesystems ...

 [ ok ]

 * Configuring kernel parameters ...

 [ ok ]

 * Creating user login records ...

 [ ok ]

 * Cleaning /var/run ...

 [ ok ]

 * Wiping /tmp directory ...

 [ ok ]

 * Loading ALSA modules ...

WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.

 [ ok ]

 * Restoring Mixer Levels ...

 [ ok ]

 * Setting terminal encoding [UTF-8] ...

 [ ok ]

 * Setting console font [default8x16] ...

 [ ok ]

 * Setting hostname to sal ...

 [ ok ]

 * Setting keyboard mode [UTF-8] ...

 [ ok ]

 * Loading key mappings [us] ...

 [ ok ]

 * Bringing up interface lo

 *   127.0.0.1/8 ...

 [ ok ]

 *   Adding routes

 *     127.0.0.0/8 via 127.0.0.1 ...

 [ ok ]

 *   Running postup ...

 *     ntpd: waiting for net.lo (50 seconds)

 *     ntpd: waiting for net.lo (41 seconds)

 *     ntpd: waiting for net.lo (32 seconds)

 *     ntpd: waiting for net.lo (23 seconds)

 *     ntpd: waiting for net.lo (14 seconds)

 *     ntpd: waiting for net.lo (5 seconds)

 *     ntpd: timed out waiting for net.lo

 *     Starting ntpd ...

 [ ok ]

 * Mounting USB device filesystem [usbfs] ...

 [ ok ]

 * Mounting misc binary format filesystem ...

 [ ok ]

 * Activating swap devices ...

 [ ok ]

 * Initializing random number generator ...

 [ ok ]

* Starting D-BUS system messagebus ...

 [ ok ]

 * Starting syslog-ng ...

 [ ok ]

 * Starting ConsoleKit daemon ...

 [ ok ]

 * Bringing up interface eth0

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[3261]: version 5.2.12 starting

dhcpcd[3261]: eth0: waiting for carrier

dhcpcd[3261]: eth0: carrier acquired

dhcpcd[3261]: eth0: rebinding lease of 192.168.0.100

dhcpcd[3261]: eth0: NAK: from 192.168.0.1

dhcpcd[3261]: eth0: broadcasting for a lease

dhcpcd[3261]: eth0: offered 192.168.0.100 from 192.168.0.1

dhcpcd[3261]: eth0: acknowledged 192.168.0.100 from 192.168.0.1

dhcpcd[3261]: eth0: checking for 192.168.0.100

dhcpcd[3261]: eth0: leased 192.168.0.100 for infinity

dhcpcd[3261]: forked to background, child pid 3294

 [ ok ]

 *     received address 192.168.0.100/24

 [ ok ]

 *   Running postup ...

 *     ntpd: waiting for net.eth0 (50 seconds)

 *     ntpd: waiting for net.eth0 (41 seconds)

 *     ntpd: waiting for net.eth0 (32 seconds)

 *     ntpd: waiting for net.eth0 (23 seconds)

 *     ntpd: waiting for net.eth0 (14 seconds)

 *     ntpd: waiting for net.eth0 (5 seconds)

 *     ntpd: timed out waiting for net.eth0

 *     Starting ntpd ...

 [ ok ]

 * Mounting network filesystems ...

 [ ok ]

 * Setting up kdm ...

 [ ok ]

 * Starting sshd ...

 [ ok ]

 * Starting apache2 ...

 [ ok ]

 * Starting Serviio Media Server ...

 [ ok ]

 * Doing udev cleanups

 * Starting vixie-cron ...

 [ ok ]

 * Starting local
```

rc_depend_strict="YES" is commented out in rc.conf

/etc/.conf.d/net looks like this:

```
# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

# modules=( "dhclient" )

# config_eth0( "dhcp" )

# dhcp_eth0=( "nontp" )

dhcpcd_eth0="-C ntp.conf"

config_eth0="dhcp"

# config_eth1( "dhcp" )

postup(){

 grep -e '^server' /etc/ntp.conf > /etc/ntpd.conf ||\

        echo "servers pool.ntp.org" > /etc/ntpd.conf

 /etc/init.d/ntpd restart

 }
```

Any ideas where to go next with this?

----------

## mikegpitt

I would comment out everything except for the line `config_eth0="dhcp" `.  Any reason why you have the extra options for dhcp and the postup in the file?

----------

## zoidie

That seems to have done it. Thanks! I wish I'd got round to asking about this earlier as it has been like it for a while.

The dhcp bit come from the wiki article:

http://en.gentoo-wiki.com/wiki/NTP#DHCP

No idea about the postup part. I certainly don't remember ever putting it there so assume it is part of the default configuration?

----------

## jlpoole

 *mikegpitt wrote:*   

> I would comment out everything except for the line `config_eth0="dhcp" `.  Any reason why you have the extra options for dhcp and the postup in the file?

 

I had the same problem.  It looks like the postup() was placed in the file by someone ( not me) and that caused the problem.

My /etc/conf.d/net file simply has this:

```
config_eth0=( "dhcp" )

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

... [other rem'd statements which I had put in earlier]

#

# 6/25/2011: below rem'd out by jlpoole

# per http://forums.gentoo.org/viewtopic-t-879043-highlight-ntpd.html

#

#postup(){

# grep -e '^server' /etc/ntp.conf > /etc/ntpd.conf ||\

#        echo "servers pool.ntp.org" > /etc/ntpd.conf

# /etc/init.d/ntpd restart

# }

```

Now I no longer have the same delay as the original post to the thread had.

----------

