Re: r342378 fails sometimes on boot mounting root (error 2)

From: Ian Lepore <ian_at_freebsd.org>
Date: Fri, 28 Dec 2018 09:07:49 -0700
On Fri, 2018-12-28 at 15:54 +0100, Matthias Apitz wrote:
> Hello,
> 
> I've setup a new r342378 (December 23) for amd64 onto an external
> disk
> with this procedure:
> 
> # grep da0 /var/log/messages
> ...
> Dec 28 14:20:01 c720-r314251 kernel: da0 at umass-sim0 bus 0 scbus1
> target 0 lun 0
> Dec 28 14:20:01 c720-r314251 kernel: da0: <WD Elements SE 25FE 1021>
> Fixed Direct Access SPC-4 SCSI device
> Dec 28 14:20:01 c720-r314251 kernel: da0: Serial Number
> 575854314134383033483150
> Dec 28 14:20:01 c720-r314251 kernel: da0: 400.000MB/s transfers
> Dec 28 14:20:01 c720-r314251 kernel: da0: 953837MB (1953458176 512
> byte sectors)
> Dec 28 14:20:01 c720-r314251 kernel: da0: quirks=0x2<NO_6_BYTE>
> 
> 
> # gpart destroy -F da0
> da0 destroyed
> # gpart create -s gpt da0
> da0 created
> # gpart add -t freebsd-boot -s 512k -a4k -l extboot da0
> da0p1 added
> # gpart bootcode -b /boot/pmbr -p /boot/gptboot -i1 da0
> partcode written to da0p1
> bootcode written to da0
> # gpart add -t freebsd-ufs -l  extrootfs -b 1m -s 256g da0
> da0p2 added
> # gpart add -t freebsd-swap -l extswap -a 1m -s 2g da0
> da0p3 added
> # gpart add -t freebsd-ufs -l  extbackupfs -a 1m da0
> da0p4 added
> 
> # newfs -U /dev/gpt/extrootfs
> # newfs -U /dev/gpt/extbackupfs
> 
> # gpart set -a active da0
> active set on da0
> # gpart show -l da0
> =>        40  1953458096  da0  GPT  (931G)
>           40        1024    1  extboot  (512K)
>         1064         984       - free -  (492K)
>         2048   536870912    2  extrootfs  (256G)
>    536872960     4194304    3  extswap  (2.0G)
>    541067264  1412388864    4  extbackupfs  (673G)
>   1953456128        2008       - free -  (1.0M)
> 
> 
> # mount /dev/gpt/extrootfs /mnt
> 
> # cd /usr/src
> # make installworld  DESTDIR=/mnt
> # make installkernel DESTDIR=/mnt
> # make distrib-dirs  DESTDIR=/mnt
> # make distribution  DESTDIR=/mnt
> 
> # cd ~guru/C720
> 
> # cp -p rc.conf         /mnt/etc
> # cp -p c720.kbd        /mnt/etc
> # cp -p sysctl.conf     /mnt/etc
> # cp -p loader.conf     /mnt/boot/
> # cp -p device.hints    /mnt/boot/
> 
> # cat > /mnt/etc/fstab  <<EOF
> /dev/gpt/extrootfs  / ufs rw,noatime 1 1
> /dev/gpt/extswap none swap sw 0 0
> EOF
> 
> # chroot /mnt passwd root
> Changing local password for root
> New Password:
> 
> # umount /mnt
> 
> The disk now boots sometimes fine, more times it fails with:
> 
> Trying to mount root from ufs:/dev/gpt/extroot [rw, noatime]...
> Mounting from ufs:/dev/gpt/extroot failed with error 2; retrying fpr
> 3 seconds
> Mounting from ufs:/dev/gpt/extroot failed with error 2; retrying fpr
> 2 seconds
> Mounting from ufs:/dev/gpt/extroot failed with error 2; retrying fpr
> 1 seconds
> ...
> 
> I can provide a 'dmesg' output from an successful boot, if this
> helps.
> 
> Any hints? Thanks
> 
> 	matthias
> 

Try setting vfs.mountroot.timeout= in loader.conf to a value long
enough to let the usb drive get probed reliably. The default is 3
seconds, maybe a value like 5 or 10 would work better for you.

-- Ian
Received on Fri Dec 28 2018 - 15:24:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:19 UTC