LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Dealing with boot dependencies (NIS, user program) (https://www.linuxquestions.org/questions/debian-26/dealing-with-boot-dependencies-nis-user-program-864160/)

jlinkels 02-21-2011 05:49 PM

Dealing with boot dependencies (NIS, user program)
 
Dealing with boot dependencies as Squeeze installs them is not always that easy. After installation of this box I had to install NIS and a user program which runs in the background, but needs credentials obtained thru NIS. The user program should start during boot as well.

The header of the NIS startup script looked like:
Code:

### BEGIN INIT INFO
# Provides:            ypbind ypserv ypxfrd yppasswdd
# Required-Start:      $network $portmap
# Required-Stop:        $portmap
# Default-Start:        2 3 4 5
# Default-Stop:        0 1 6

But NIS would not start at boot time. After a terrible long timeout delay booting would continue. Looking at the on-screen messages, it appeared that network-manager had to run before NIS would start. That is strange, as the virtual dependency $network had to be satisfied as well. Anyway, after modifying the header to this:
Code:

### BEGIN INIT INFO
# Provides:            ypbind ypserv ypxfrd yppasswdd
# Required-Start:      $network $portmap network-manager
# Required-Stop:        $portmap
# Default-Start:        2 3 4 5
# Default-Stop:        0 1 6

That made NIS run, but not my own script. This scripts header was:
Code:

### BEGIN INIT INFO
# Provides:          detect_gate
# Required-Start:    $network $portmap
# Required-Stop:    1
# Default-Start:    2 3 4 5
# Default-Stop:      0 1 6

Because NIS was started later after network-manager was started, my own script failed to start, because the script used credentials only available thru NIS.

This would not help either:
Code:

### BEGIN INIT INFO
# Provides:          detect_gate
# Required-Start:    $network $portmap network-manager
# Required-Stop:    1

as now NIS and my script would start concurrently.

No, this would not do the trick either, as a matter of fact update-rc.d would not even install the script:
Code:

### BEGIN INIT INFO
# Provides:          detect_gate
# Required-Start:    $network $portmap nis
# Required-Stop:    1

because NIS is not a package. Look in the NIS script and look at the Provides line.

The solution was of course the specify the package Provided by NIS:
Code:

### BEGIN INIT INFO
# Provides:          detect_gate
# Required-Start:    $network $portmap ypbind
# Required-Stop:    1

Now everything is fine, and booting is very fast, a significant improvement from the old system. I hope I solved this in the right way. Also I am not sure this is a bug which should be filed against the NIS installation package.

jlinkels

oOarthurOo 02-23-2011 01:01 AM

Another option is to look into the /etc/insserv.conf file, and create your own virtual dependency there. When you look in that file you'll see why network-manager wasn't started even though network is listed. I don't see anything wrong with your solution though.

There is no need to call update-rc.d anymore, just call insserv after making any changes to lsb headers and it will read those headers and use update-rc.d itself.

jlinkels 02-23-2011 01:50 PM

I haven't thought about editing/creating a virtual dependency, but it seems a good idea.

jlinkels


All times are GMT -5. The time now is 08:19 PM.