From owner-freebsd-stable@freebsd.org Mon Feb 13 19:10:52 2017 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A20BCCDDF7D for ; Mon, 13 Feb 2017 19:10:52 +0000 (UTC) (envelope-from paul@gromit.dlib.vt.edu) Received: from gromit.dlib.vt.edu (gromit.dlib.vt.edu [128.173.126.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gromit.dlib.vt.edu", Issuer "Chumby Certificate Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F1541B21 for ; Mon, 13 Feb 2017 19:10:52 +0000 (UTC) (envelope-from paul@gromit.dlib.vt.edu) Received: from pmather.lib.vt.edu (pmather.lib.vt.edu [128.173.126.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gromit.dlib.vt.edu (Postfix) with ESMTPSA id 0B5DF3A4; Mon, 13 Feb 2017 14:10:45 -0500 (EST) From: Paul Mather Message-Id: <7DD96F71-7A21-4125-BB6B-53458A400FDC@gromit.dlib.vt.edu> Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: how can I make freebsd wait for usb to become active? Or delay mountroot? Date: Mon, 13 Feb 2017 14:10:44 -0500 In-Reply-To: <4d398907-f6ed-e212-824e-f6f8e5aa6b88@zyxst.net> Cc: freebsd-stable@freebsd.org To: tech-lists References: <4d398907-f6ed-e212-824e-f6f8e5aa6b88@zyxst.net> X-Mailer: Apple Mail (2.3259) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 19:10:52 -0000 On Feb 13, 2017, at 2:00 PM, tech-lists wrote: > Hello stable@, >=20 > system: 11-stable r313553 >=20 > In the kernel there is an option for scsi delay. Is there also one for > usb? Perhaps not in the kernel but elsewhere. I can't find it. >=20 > The problem is seen especially where the bootable device is usb. The > boot process starts and dumps me at mountroot where I wait for a short > time until the usb stick is properly detected (bright white writing at > the console). The usb stick is plugged into a usb3 port. For example: >=20 > [snip] >=20 > usbus0: 5.0Gbps Super Speed USB v3.0 > usbus1: 12Mbps Full Speed USB v1.0 > usbus2: 480Mbps High Speed USB v2.0 > usbus3: 12Mbps Full Speed USB v1.0 > ugen0.1: <0x1022 XHCI root HUB> at usbus0 > uhub0: <0x1022 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on = usbus0 > ugen1.1: at usbus1 > uhub1: on usbus1 > ugen2.1: at usbus2 > uhub2: on usbus2 > ugen3.1: at usbus3 > uhub3: on usbus3 > usbus4: 480Mbps High Speed USB v2.0 > ugen4.1: at usbus4 > uhub4: on usbus4 > acpi_tz0: _CRT value is absurd, ignored (255.1C) > ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 > ada0: ACS-2 ATA SATA 3.x device > cd0 at ahcich1 bus 0 scbus1 target 0 lun 0 > cd0: Removable CD-ROM SCSI device > cd0: Serial Number 1415TP277450E0H6H > cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO = 8192bytes) > cd0: Attempt to query device size failed: NOT READY, Medium not = present > - tray open > ada0: Serial Number JA1006103G0ALV > ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes) > ada0: Command Queueing enabled > ada0: 953869MB (1953525168 512 byte sectors) > SMP: AP CPU #3 Launched! > SMP: AP CPU #1 Launched! > SMP: AP CPU #2 Launched! > Timecounter "TSC" frequency 1597045198 Hz quality 1000 > Trying to mount root from ufs:/dev/da0p2 [rw]... > uhub3: 5 ports with 5 removable, self powered > uhub1: 5 ports with 5 removable, self powered > uhub0: 4 ports with 4 removable, self powered > Root mount waiting for: usbus4 usbus2 usbus0 > ugen0.2: at usbus0 > umass0 on uhub0 > umass0: > on usbus0 > umass0: SCSI over Bulk-Only; quirks =3D 0x8100 > umass0:3:0: Attached to scbus3 > uhub2: 5 ports with 5 removable, self powered > uhub4: 5 ports with 5 removable, self powered > ugen0.3: at usbus0 > ukbd0 on uhub0 > ukbd0: on = usbus0 > kbd2 at ukbd0 > Root mount waiting for: usbus4 > ugen4.2: at usbus4 > mountroot: waiting for device /dev/da0p2... > Mounting from ufs:/dev/da0p2 failed with error 19. >=20 > Loader variables: > vfs.root.mountfrom=3Dufs:/dev/da0p2 > vfs.root.mountfrom.options=3Drw >=20 > Manual root filesystem specification: > : [options] > Mount using filesystem > and with the specified (optional) option list. >=20 > eg. ufs:/dev/da0s1a > zfs:tank > cd9660:/dev/cd0 ro > (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /) >=20 > ? List valid disk boot devices > . Yield 1 second (for background tasks) > Abort manual input >=20 > mountroot> Trying to mount root from ufs:/dev/da0p2 []... > mountroot: waiting for device /dev/da0p2... > Mounting from ufs:/dev/da0p2 failed with error 19. >=20 > mountroot> >=20 > [snip] >=20 > Then this happens: >=20 > (probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00 > (probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an = error > (probe0:umass-sim0:0:0:0): Retrying command > da0 at umass-sim0 bus 0 scbus3 target 0 lun 0 > da0: < USB DISK 3.0 PMAP> Removable Direct Access SPC-4 SCSI device > da0: Serial Number 070B4722335D3288 > da0: 400.000MB/s transfers > da0: 30176MB (61800448 512 byte sectors) > da0: quirks=3D0x3 >=20 > so now at the mountroot prompt I enter ufs:/dev/da0p2 (which is a = value > that mountroot already had) and carry on booting: >=20 > mountroot> Trying to mount root from ufs:/dev/da0p2 []... > re0: link state changed to DOWN > re0: link state changed to UP > ums0 on uhub0 > ums0: on = usbus0 > ums0: 16 buttons and [XYZT] coordinates ID=3D2 > uhid0 on uhub0 > uhid0: on = usbus0 >=20 > [...] >=20 > The same sort of thing happens on an 11-stable r313043 desktop, only > this time I'm not booting from usb. The system comes up, I get a login > prompt, then five or ten seconds later usb wakes up having detected = the > usb3 external HD. >=20 > How can I fix this? This topic cropped up on the freebsd-arm mailing list very recently. = One solution is to add this to /boot/loader.conf: kern.cam.boot_delay=3D"10000" That instructs the system to wait 10 seconds (10000 milliseconds) during = boot to give time for the CAM subsystem probes to complete. (USB = storage devices use the CAM subsystem.) It was also noted by Konstantin Belousov in that thread = (https://lists.freebsd.org/pipermail/freebsd-arm/2017-February/015626.html= = ) that a newer option is available: > Right solution after r313350 is to set > vfs.root_mount_always_wait=3D1 > loader tunable. The knob should be merged to 11 in two weeks. Cheers, Paul.