NetBSD Problem Report #37009

From martin@duskware.de  Thu Sep 20 10:11:14 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 9650C63B979
	for <gnats-bugs@gnats.netbsd.org>; Thu, 20 Sep 2007 10:11:14 +0000 (UTC)
Message-Id: <20070919232041.4DC7D63B86C@narn.NetBSD.org>
Date: Wed, 19 Sep 2007 23:20:41 +0000 (UTC)
From: jjhartley@gmail.com
Reply-To: jjhartley@gmail.com
To: netbsd-bugs-owner@NetBSD.org
Subject: unable to use swap partition found on USB drive
X-Send-Pr-Version: www-1.0

>Number:         37009
>Category:       port-i386
>Synopsis:       unable to use swap partition found on USB drive
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 20 10:15:00 +0000 2007
>Closed-Date:    Tue Sep 18 02:24:56 +0000 2018
>Last-Modified:  Tue Sep 18 02:24:56 +0000 2018
>Originator:     James Hartley
>Release:        4.0_RC1
>Organization:
>Environment:
NetBSD lederman 4.0_RC1 NetBSD 4.0_RC1 (GENERIC) #0: Sat Sep 1 15:24:09 PDT 2007  builds@wb42:/home/builds/ab/netbsd-4-0-RC1/i386/200709011431Z-obj/home/builds/ab/netbsd-4-0-RC1/src/sys/arch/i386/compile/GENERIC i386
>Description:
Additional swap partition on an attached USB drive specified in /etc/fstab will not be mounted properly at boot.
>How-To-Repeat:
Create a swap partition on a USB drive, eg. /dev/sd1b & add an entry to this swap partition to /etc/fstab:

/dev/sd1b none swap sw 0 0

Leave the USB drive attached & reboot.

The order of initialization is:
0.  run swapctl -A
1.  mount other partitions defined in /etc/fstab & check via fsck
2.  detect USB devices

Other kinds of partitions on a USB drive can be specified in /etc/fstab, & successfully mounted by adding the following to /etc/rc.conf.d/fsck:

start_precmd=fsck_precmd
fsck_precmd() {
    n=60
    echo "delaying fsck for $n seconds..."
    sleep $n
}

...which delays the actions of fsck long enough for all USB devices to be detected.

I cannot find an equivalent manner of delaying swapctl.
>Fix:
Remove the USB swap partition entry from /etc/fstab & add manually through swapctl -a /dev/sd1b.

>Release-Note:

>Audit-Trail:
From: jnemeth@victoria.tc.ca (John Nemeth)
To: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 03:39:05 -0700

 On Jan 5, 10:22pm, jjhartley@gmail.com wrote:
 }
 } >Number:         37009
 } >Synopsis:       unable to use swap partition found on USB drive
 } >Arrival-Date:   Thu Sep 20 10:15:00 +0000 2007
 } >Originator:     James Hartley
 } >Release:        4.0_RC1
 } >Description:
 } Additional swap partition on an attached USB drive specified in /etc/fstab will not be mounted properly at boot.
 } >How-To-Repeat:
 } Create a swap partition on a USB drive, eg. /dev/sd1b & add an entry to this swap partition to /etc/fstab:
 } 
 } /dev/sd1b none swap sw 0 0
 } 
 } Leave the USB drive attached & reboot.
 } 
 } The order of initialization is:
 } 0.  run swapctl -A
 } 1.  mount other partitions defined in /etc/fstab & check via fsck
 } 2.  detect USB devices
 } 
 } Other kinds of partitions on a USB drive can be specified in /etc/fstab, & successfully mounted by adding the following to /etc/rc.conf.d/fsck:
 } 
 } start_precmd=fsck_precmd
 } fsck_precmd() {
 }     n=60
 }     echo "delaying fsck for $n seconds..."
 }     sleep $n
 } }
 } 
 } ...which delays the actions of fsck long enough for all USB devices to be detected.
 } 
 } I cannot find an equivalent manner of delaying swapctl.

      Try putting the above lines into /etc/rc.conf.d/swap1.

 }-- End of excerpt from jjhartley@gmail.com

From: "James Hartley" <jjhartley@gmail.com>
To: gnats-bugs@netbsd.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 14:08:08 -0700

 On 9/20/07, John Nemeth <jnemeth@victoria.tc.ca> wrote:
 > The following reply was made to PR port-i386/37009; it has been noted by GNATS.
 > ...
 >       Try putting the above lines into /etc/rc.conf.d/swap1.

 $ cd /etc/rc.conf.d
 $ ls -l
 total 4
 -rw-r--r--  1 root  wheel  120 Sep 13 14:57 fsck
 -rw-r--r--  1 root  wheel  117 Sep 20 13:57 swap1
 $ cat swap1
 start_precmd=swapctl_precmd
 swapctl_precmd() {
     n=60
     echo "delaying swapctl for $n seconds..."
     sleep $n
 }
 $

 After creating the above file & rebooting, I see the same errant
 behavior.  During initialization, the following messages scroll by
 before fsck checks all partitions defined in /etc/fstab.

 swapctl: adding /dev/sd0b as swap device at priority 0
 swapctl: /dev/sd1b: Device not configured

 Yes, I can manually add the swap partition later through swapctl -a,
 but the fundamental question still remains as to how to delay swapctl
 initially as I can with fsck.

 Jim

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: jjhartley@gmail.com
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 16:24:24 -0500 (CDT)

 On Thu, 20 Sep 2007, James Hartley wrote:

 >  After creating the above file & rebooting, I see the same errant
 >  behavior.  During initialization, the following messages scroll by
 >  before fsck checks all partitions defined in /etc/fstab.

 Do you see your custom "delaying swapctl for 60 seconds..." message?

 >  swapctl: adding /dev/sd0b as swap device at priority 0
 >  swapctl: /dev/sd1b: Device not configured

From: "James Hartley" <jjhartley@gmail.com>
To: "Jeremy C. Reed" <reed@reedmedia.net>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 14:40:09 -0700

 On 9/20/07, Jeremy C. Reed <reed@reedmedia.net> wrote:
 > On Thu, 20 Sep 2007, James Hartley wrote:
 > >  After creating the above file & rebooting, I see the same errant
 > >  behavior.
 >
 > Do you see your custom "delaying swapctl for 60 seconds..." message?

 No.

From: "James Hartley" <jjhartley@gmail.com>
To: "Jeremy C. Reed" <reed@reedmedia.net>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 15:07:39 -0700

 On 9/20/07, Jeremy C. Reed <reed@reedmedia.net> wrote:
 > Looks like both /etc/rc.d/swap[12] scripts have:
 >
 >  load_rc_config swap
 >
 > I thnk they should be:
 >
 > load_rc_config swap1
 >
 > and
 >
 > load_rc_config swap2
 >
 > So either fix those rc.d scripts or name your rc.conf.d script as swap
 > (not swap1).

 Renaming the script to "swap" does delay swapctl from adding swap
 partitions until all USB devices have been detected.  Afterwards, all
 swap partitions defined in /etc/fstab appear initialized:

 $ swapctl -l
 Device      512-blocks     Used    Avail Capacity  Priority
 /dev/sd0b      4096150    10528  4085622     0%    0
 /dev/sd1b      2048000    10592  2037408     1%    0
 Total          6144150    21120  6123030     0%
 $

 Tangentially, I also see the following messages at the end of the
 boot-time initializations:

 ...
 Mounting all filesystems...
 Clearing /tmp.
 Creating a.out runtime link editor directory cache.
 Checking quotas: done.
 delaying swapctl for 60 seconds...               <<<<<
 Starting virecover.
 Starting local daemons:.
 Updating motd.
 Starting sshd.
 postfix/postfix-script: starting the Postfix mail system
 Starting inetd.
 Starting cron.
 Thu Sep 20 14:52:31 PDT 2007
 NetBSD/i386 (*****) (console)

 login:

 Why is /etc/rc.conf.d/swap being called a second time?

 Thanks.

 Jim

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: jjhartley@gmail.com
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 16:30:24 -0500 (CDT)

 Looks like both /etc/rc.d/swap[12] scripts have:

  load_rc_config swap

 I thnk they should be:

 load_rc_config swap1

 and

 load_rc_config swap2

 So either fix those rc.d scripts or name your rc.conf.d script as swap 
 (not swap1).

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: jjhartley@gmail.com
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 16:40:48 -0500 (CDT)

 In regards to the filename change in my last email:

 -------
 src/etc/rc.d/swap2 revision 1.4
 date: 2000-07-17 05:27:04 -0700;  author: lukem;  state: Exp;  lines: +2 -2;
 use "load_rc_config swap" for swap1 and swap2
 -------

 I don't know why though ...

From: "Jeremy C. Reed" <reed@reedmedia.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-i386/37009: unable to use swap partition found on USB drive
Date: Thu, 20 Sep 2007 17:34:37 -0500 (CDT)

 On Thu, 20 Sep 2007, James Hartley wrote:

 >  Why is /etc/rc.conf.d/swap being called a second time?

 Ask lukem (per my comment in the previous email).

 I think this should be fixed like you see.

   Jeremy C. Reed

State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Tue, 18 Sep 2018 02:24:56 +0000
State-Changed-Why:
USB disk detection is generally handled before mountroot now days, so
this should also be fixed.  also, reported against 4.0.



>Unformatted:

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.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.