NetBSD Problem Report #52143

From clare@csel.org  Thu Apr  6 16:42:05 2017
Return-Path: <clare@csel.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E14EF7A1C0
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  6 Apr 2017 16:42:04 +0000 (UTC)
Message-Id: <20170406164157.E1B3B3F83C@inner.csel.org>
Date: Fri,  7 Apr 2017 01:41:57 +0900 (JST)
From: clare@csel.org
Reply-To: clare@csel.org
To: gnats-bugs@NetBSD.org
Subject: net/quagga does not start on boot
X-Send-Pr-Version: 3.95

>Number:         52143
>Category:       pkg
>Synopsis:       net/quagga does not start on boot
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 06 16:45:00 +0000 2017
>Last-Modified:  Sat Apr 08 02:05:00 +0000 2017
>Originator:     DOYASHIKI Shinichi
>Release:        NetBSD 7.99.65
>Organization:
	at home
>Environment:
System: NetBSD inner.csel.org 7.99.65 NetBSD 7.99.65 (APU1C) #0: Sun Mar 12 20:17:29 JST 2017 clare@inner.csel.org:/export/stage/hack/sys/arch/amd64/compile/APU1C amd64
Architecture: x86_64
Machine: amd64
>Description:
	net/quagga does not start on boot time.
	manual runnning "/etc/rc.d/zebra start" after boot is ok,
	but boot-time /etc/rc ignores starting zebra.
	adding "/etc/rc.d/zebra start" to /etc/rc.local is ok.
>How-To-Repeat:
	1) install net/quagga
	2) set zebra=YES and ospf6d=YES to /etc/rc.conf
	3) copy scripts from /usr/pkg/share/examples/rc.d to /etc/rc.d
	4) reboot
	5) see "ps -ax" and missing daemon process.
>Fix:
	unknown.

>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52143: net/quagga does not start on boot
Date: Fri, 07 Apr 2017 08:48:03 +0700

     Date:        Thu,  6 Apr 2017 16:45:00 +0000 (UTC)
     From:        clare@csel.org
     Message-ID:  <20170406164500.B64CE7A1FE@mollari.NetBSD.org>

   | 	net/quagga does not start on boot time.
   | 	manual runnning "/etc/rc.d/zebra start" after boot is ok,
   | 	but boot-time /etc/rc ignores starting zebra.
   | 	adding "/etc/rc.d/zebra start" to /etc/rc.local is ok.

 The most likely cause of this is that your /usr/pkg is a mounted
 filesystem, which is not listed in critical_filesystems_local (or remote).

 After boot (and before rc.local) gets run, all filesystems will be mounted,
 but won't necessarily happen before (almost) anything else run from /etc/rc.d

 If you are going to start apps from mounted filesystems at boot time, the
 relevant filesystems really need to be listed in one of the "critical" lists.

 That's even more important for apps that should be started relatively early
 in the boot process - you really want routing working before network apps
 try to use the network, so zebra is one of those...

 kre

From: DOYASHIKI Shinichi <clare@csel.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52143: net/quagga does not start on boot
Date: Fri, 7 Apr 2017 23:53:40 +0900

 On Fri,  7 Apr 2017 01:50:01 +0000 (UTC)
 Robert Elz <kre@munnari.OZ.AU> wrote:
 >  The most likely cause of this is that your /usr/pkg is a mounted
 >  filesystem, which is not listed in critical_filesystems_local (or remote).
 >  
 >  After boot (and before rc.local) gets run, all filesystems will be mounted,
 >  but won't necessarily happen before (almost) anything else run from /etc/rc.d
 >  
 >  If you are going to start apps from mounted filesystems at boot time, the
 >  relevant filesystems really need to be listed in one of the "critical" lists.
 >  
 >  That's even more important for apps that should be started relatively early
 >  in the boot process - you really want routing working before network apps
 >  try to use the network, so zebra is one of those...

 Thank you for informations.
 I resolved by following configuration:

 1) patching /etc/rc.d scripts

 --- /usr/pkg/share/examples/rc.d/zebra  2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/zebra     2017-04-07 23:41:01.282754789 +0900
 @@ -3,7 +3,8 @@
  # zebra is the head of the quagga routing beast
  #
  # PROVIDE: zebra
 -# REQUIRE: NETWORKING
 +# REQUIRE: staticroute dhclient dhcpcd ipfilter pf npf
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 --- /usr/pkg/share/examples/rc.d/bgpd   2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/bgpd      2017-04-07 23:30:43.264792518 +0900
 @@ -4,6 +4,7 @@
  #
  # PROVIDE: bgpd
  # REQUIRE: zebra
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 --- /usr/pkg/share/examples/rc.d/ospfd  2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/ospfd     2017-04-07 23:30:03.603849872 +0900
 @@ -4,6 +4,7 @@
  #
  # PROVIDE: ospfd
  # REQUIRE: zebra
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 --- /usr/pkg/share/examples/rc.d/ospf6d 2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/ospf6d    2017-04-07 23:30:24.180836105 +0900
 @@ -4,6 +4,7 @@
  #
  # PROVIDE: ospf6d
  # REQUIRE: zebra
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 --- /usr/pkg/share/examples/rc.d/ripd   2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/ripd      2017-04-07 23:29:37.395844774 +0900
 @@ -4,6 +4,7 @@
  #
  # PROVIDE: ripd
  # REQUIRE: zebra
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin
 --- /usr/pkg/share/examples/rc.d/ripngd 2017-03-13 03:51:28.000000000 +0900
 +++ /etc/rc.d/ripngd    2017-04-07 23:29:52.010087887 +0900
 @@ -4,6 +4,7 @@
  #
  # PROVIDE: ripngd
  # REQUIRE: zebra
 +# BEFORE: NETWORKING
  ##

  PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin

 2) adding "/var" and "/usr" to ciritical_filesystems_local parameter in /etc/rc.conf


 -- 
 DOYASHIKI Shinichi <clare@csel.org>

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/52143: net/quagga does not start on boot
Date: Sat, 08 Apr 2017 09:04:18 +0700

     Date:        Fri,  7 Apr 2017 21:00:02 +0000 (UTC)
     From:        DOYASHIKI Shinichi <clare@csel.org>
     Message-ID:  <20170407210002.2EFBF7A2BC@mollari.NetBSD.org>


   |  I resolved by following configuration:

   |  1) patching /etc/rc.d scripts

   |  2) adding "/var" and "/usr" to ciritical_filesystems_local
   |     parameter in /etc/rc.conf

 Of those, change 2 would have allowed quagga to start at boot time (and
 from this it seems that your /usr/pkg is a part of /usr).  /var is generally
 in critical_filesystems_local by default anyway, but /usr (which is
 sometimes NFS mounted) is in critical_filesystems_remote which needs
 networking operational first - changing that to be in 
 critical_filesystems_local (when it is a local filesystem) is a common need.

 The changes in 1 alter just when it starts relative to other processes.

 Change 1 is another example (we saw another with openvpn just a couple of
 weeks ago) where the network startup ordering in the rc scripts is
 just not quite right (particularly when sites want to add more networking
 daemons from pkgsrc and they need to be started in the right place.)

 I think I will look at rationalising the base netbsd networking rc.d
 scripts (the PROVIDE/BEFORE/REQUIRE lines) before I'd consider adding
 patches to quagga to change its startup order,   The changes that add
 BEFORE NETWORKING are probably what is wanted everywhere, but the change
 to the REQUIRE line in rc.d/zebra (while I expect fine for your usage)
 is just too specific to do it that way, we need (at least one, probably two)
 intermediate pseudo-steps (targets like NETWORKING) which can be used
 instead.

 This also reminds me of an earlier suggestion to allow rc.conf to be
 able to override the REQUIRE/BEFORE steps of (selected) rc.d scripts
 to allow sites to more easily make the ordering match local requirements
 without needing to go edit the scripts themselves (which would make
 system upgrades far easier for those who need this.)

 kre

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.