Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Feb 2017 14:10:44 -0500
From:      Paul Mather <paul@gromit.dlib.vt.edu>
To:        tech-lists <tech-lists@zyxst.net>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: how can I make freebsd wait for usb to become active? Or delay mountroot?
Message-ID:  <7DD96F71-7A21-4125-BB6B-53458A400FDC@gromit.dlib.vt.edu>
In-Reply-To: <4d398907-f6ed-e212-824e-f6f8e5aa6b88@zyxst.net>
References:  <4d398907-f6ed-e212-824e-f6f8e5aa6b88@zyxst.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 13, 2017, at 2:00 PM, tech-lists <tech-lists@zyxst.net> 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: <AMD OHCI root HUB> at usbus1
> uhub1: <AMD OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
> ugen2.1: <AMD EHCI root HUB> at usbus2
> uhub2: <AMD EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
> ugen3.1: <AMD OHCI root HUB> at usbus3
> uhub3: <AMD OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
> usbus4: 480Mbps High Speed USB v2.0
> ugen4.1: <AMD EHCI root HUB> at usbus4
> uhub4: <AMD EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus4
> acpi_tz0: _CRT value is absurd, ignored (255.1C)
> ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
> ada0: <HGST HTS541010A9E680 JA0OA710> ACS-2 ATA SATA 3.x device
> cd0 at ahcich1 bus 0 scbus1 target 0 lun 0
> cd0: <hp DVD-RAM UJ8DB H.02> 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: <vendor 0x13fe USB DISK 3.0> at usbus0
> umass0 on uhub0
> umass0: <vendor 0x13fe USB DISK 3.0, class 0/0, rev 3.00/1.00, addr 1>
> 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: <Logitech USB Receiver> at usbus0
> ukbd0 on uhub0
> ukbd0: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 2> on =
usbus0
> kbd2 at ukbd0
> Root mount waiting for: usbus4
> ugen4.2: <DDTPD019I5ZMTS HP Truevision HD> 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:
>  <fstype>:<device> [options]
>      Mount <device> using filesystem <fstype>
>      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)
>  <empty line>    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<NO_SYNC_CACHE,NO_6_BYTE>
>=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: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 2> on =
usbus0
> ums0: 16 buttons and [XYZT] coordinates ID=3D2
> uhid0 on uhub0
> uhid0: <Logitech USB Receiver, class 0/0, rev 2.00/12.03, addr 2> 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=
 =
<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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7DD96F71-7A21-4125-BB6B-53458A400FDC>