Bug 224974 - [fsck] Mounting USB drive at boot time hangs boot
Summary: [fsck] Mounting USB drive at boot time hangs boot
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-07 16:35 UTC by pru13allan
Modified: 2018-01-08 09:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pru13allan 2018-01-07 16:35:17 UTC
Maybe related to Bug 208308.


When mounting USB drive from fstab and the sixth field, (fs_passno), is
set to 2 the boot sequence hangs. Setting fs_passno to 0 work as expected.
Tested with different types of drives (memstick and disk) with different
schemes (MBR, GPT) and all combination of msdosfs and/or ufs.
Adding 'late' to fstab have no effect. (fsck comes before mount)

Steps to reproduce (memstick):

/etc/fstab:
/dev/da0s1      /mnt          msdosfs rw,noatime      0       0

This work OK.

/etc/fstab:
/dev/da0s1      /mnt          msdosfs rw,noatime      0       2

This should start a background fsck and the boot would proceed as normal.

Tested on RaspberryPi3:
Booting hangs after enumerating all USB devices. You have to remove SDHC-card
and mount it on another machine and edit /etc/fstab.
Eventually after fsck of SDHC.

FreeBSD fbsd4 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r327173M: Sun Dec 31 16:04:59
  CET 2017 root@HP2:/usr/crochet-freebsd/work/obj/usr/src/arm64.aarch64
     /sys/GENERIC-NODEBUG  arm64


Tested on HP laptop:
Boot message:
Can't open '/dev/da0s1'
/dev/da0s1: UNEXPECTED INCONSISTENCY: RUN fsck_msdosfs MANUALLY
/dev/ada0s1d: FILE SYSTEM CLEAN: SKIPPING CHECKS
....
....
THE FOLLOWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY:
	msdosfs: /dev/da0s1 (/Video)
Automatic file system check failed: help!
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
Jan  7 12:46:45 init: /bin/sh on /etc/rc terminated abnormally, going to single
user mode
Enter full pathname of shell or RETURN for /bin/sh:

FreeBSD HP2 12.0-CURRENT FreeBSD 12.0-CURRENT #1 r327173M: Tue Dec 26 10:36:15
   CET 2017 root@HP2:/usr/obj/usr/src/i386.i386/sys/GENERIC-NODEBUG  i386
Comment 1 Mark Millard 2018-01-07 22:13:20 UTC
(In reply to pru13allan from comment #0)

Adding USB drives after boot and ending up with
FreeBSD hung up is one part of bugzilla 224330 .
This is tied to head -r326347 in some way, although
-r327347 may have just exposed a problem elsewhere.
The original context was Pine64+ 2GB's.

If you do not mount the USB drive at all via /etc/fstab,
and, do not plug it in until after FreeBSD has booted,
do you still get a hangup when the drive is plugged in?
If not, can you then mount it manually?

Such questions are mostly tied to getting an initial
clue how independent the bugzilla reports are.
Comment 2 pru13allan 2018-01-08 09:49:46 UTC
The problem with the hang is only related to when I want to have the USB-disk
checked at boot (/etc/fstab -> fs_passno = 2).

If I set fs_passno = 0 it works without any problems.
It gets mounted automatcally with the info from /etc/fstab.

I don't get the filesystem checked before mounting though.