Subject: port-i386/37009: unable to use swap partition found on USB drive
To: None <port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <jjhartley@gmail.com>
List: netbsd-bugs
Date: 09/20/2007 10:15:03
>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 20 10:15:00 +0000 2007
>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.