Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
NetworkManagerDispatcher fails to start ntpd on startup
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
riczan
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2005
Posts: 134
Location: Sicily. Nothing personal...

PostPosted: Sun Feb 22, 2009 7:47 pm    Post subject: NetworkManagerDispatcher fails to start ntpd on startup Reply with quote

This should be a quick fix but I need help. I followed the gentoo wiki on networkmanager.
However, ntpd fails to start when I start-up gentoo. It seems to work after waking up from a hibernate-ram or if I restart the wired connection (in knetworkmanager, click on wired).

So, my guess is that the network is not ready when called by the dispatcher. I have reviewed my logs but I don't get any errors.

rc-update -s
Code:

      NetworkManager | battery      default
 NetworkManagerDispa | battery      default
               acpid | battery      default
           alsasound |         boot
            bootmisc |         boot
             checkfs |         boot
           checkroot |         boot
               clock |         boot
         consolefont |         boot
            cpufreqd | battery      default
               cupsd | battery      default
                dbus | battery      default
              dhcdbd | battery      default
                hald | battery      default
            hostname |         boot
             keymaps |         boot
               local | battery      default nonetwork
          localmount |         boot
             modules |         boot
              net.lo |         boot
            netmount | battery      default
           rmnologin |         boot
                sshd | battery      default
           syslog-ng | battery      default
             urandom |         boot
                 xdm | battery      default


As you can see, net services (net.eth0) have been removed because they are handled by NetworkManager (I'm not sure what netmount does)

here is the dispatcher script I use:
Code:

#!/bin/bash

/etc/init.d/ntpd status | grep -q "started"

if test "$2" == "up" -a "$?" != "0" ; then
#added sleep 2 minutes so the net is ready.
#the dispatcher seems to work only after weaking up after hibernate
# but on a clean boot up.
        rc-config start ntpd
else
        rc-config stop ntpd
fi


If I manually start ntpd it works.

I plan replacing the line rc-config start ntpd by
Code:
sleep 120 && rc-config start ntpd
hoping to give enough time to NetworkManager to get an ip address. This looks ugly though.

Perhaps a cleaner solution would be to change the dependencies on ntpd
Code:
/etc/init.d/ntpd
depend() {
        need net
        use dns logger
        after ntp-client
}

checkconfig() {
        if [ ! -f /etc/ntp.conf ] ; then
                eerror "Please create /etc/ntp.conf"
                eerror "Sample conf: /usr/share/ntp/ntp.conf"
                return 1
        fi
        return 0
}

start() {
        checkconfig || return $?

        ebegin "Starting ntpd"
        start-stop-daemon --start --exec /usr/sbin/ntpd \
            --pidfile /var/run/ntpd.pid \
            -- -p /var/run/ntpd.pid ${NTPD_OPTS}
        eend $? "Failed to start ntpd"
}

stop() {
        ebegin "Stopping ntpd"
        start-stop-daemon --stop \
                --pidfile /var/run/ntpd.pid \
                --exec /usr/sbin/ntpd
        eend $? "Failed to stop ntpd"
}


But I've never messed up with init.d scripts... I usually change the files in conf.d/. However, I don't see anything that I could change in the ntpd.conf file that would help.

Should I change
Quote:
need net to need NetworkManager?
or something like that. However, I think that NetworkManager is started, but I don't have a valid ip and that's what upsets ntpd. This are all wild guesses since as I said, I haven't found any errors in my log files.


Any help is appreciated.
_________________
SAGER 5793
Back to top
View user's profile Send private message
coolsnowmen
Veteran
Veteran


Joined: 30 Jun 2004
Posts: 1479
Location: No.VA

PostPosted: Wed Feb 25, 2009 8:12 am    Post subject: Reply with quote

If you use openrc (baselayout2) you can add dependancies with out editing files in init.d/*
_________________
emerge: there are no ebuilds to satisfy "moo"
Back to top
View user's profile Send private message
riczan
Tux's lil' helper
Tux's lil' helper


Joined: 09 Feb 2005
Posts: 134
Location: Sicily. Nothing personal...

PostPosted: Wed Feb 25, 2009 4:19 pm    Post subject: Reply with quote

Please feel free to elaborate. How do I know if I'm using baselayout2?

How would I add the dependency?
_________________
SAGER 5793
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum