Short story... My RPi3+ fails to save my edited u-boot environment. ``` U-Boot> editenv usb_pgood_delay edit: 10000 U-Boot> saveenv Saving Environment to FAT... Failed (1) U-Boot> ``` Any suggestions about what I should look at? Long story... I'm trying to get my RPi 3B+ to mount home on an external USB HD, but the external HD spins down just as the filesystems are being checked. The home dir on the HD isn't found, and FreeBSD drops down to single user mode. The HD is found about 3 seconds later, and I can exit single user mode to finish booting. Weirdly, the swap partition on the HD is found and works without problem. I switched to an external SSD, and that works fine. home and the swap are found and mounted without any problems. I started working throught Bob Prohaska's notes as linked in the FreeBSD Arm wiki, and that's when I got to the u-boot saveenv problem. ``` % uname -a FreeBSD gopher 13.0-RELEASE-p11 FreeBSD 13.0-RELEASE-p11 #0: Tue Apr 5 18:58:59 UTC 2022 root@arm64-builder.daemonology.net:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64 ```
(In reply to jollyrogue from comment #0) Going in a potential alternate direction, possibly build u-boot with the likes of (example is from my context): # more /usr/ports/sysutils/u-boot-rpi-arm64/files/patch-include_configs_rpi.h --- include/configs/rpi.h.orig 2022-01-22 06:03:55.862541000 -0800 +++ include/configs/rpi.h 2022-01-22 06:03:05.435341000 -0800 @@ -210,6 +210,8 @@ ENV_DEVICE_SETTINGS \ ENV_DFU_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ + "usb_pgood_delay=2000\0" \ + "usb_ready_retry=5\0" \ BOOTENV and, after installation in FreeBSD, use the installed files to update the boot media's U-Boot.
(In reply to Mark Millard from comment #1) Alright, let me try that.
(In reply to Mark Millard from comment #1) I finally got back to this. The patch doesn't seem to help. :( Steps taken and console output is below. Let me play with the times values to see what happens. Thanks, Ryan Here are the steps I took: - Put down a fresh FreeBSD 13.0-RELEASE image to make sure it was a clean system. - Updated OS to the latest patch level. - Setup the drive in `fstab` and mount everything to make sure it's working. ``` /dev/da0p1 none swap sw 0 0 /dev/da0p2 /mnt/wd250 ufs rw,noatime 1 2 ``` - Installed ports via "portsnap auto". - Created the patch file and fit it to the `rpi.h` file in ports. - `make install` sysutils/u-boot-rpi-arm64 and deps with default options, to make sure I wasn't introducing anything weird. - Copied `/usr/local/share/u-boot/u-boot-rpi-arm64/u-boot.bin` to `/boot/msdos/u-boot.bin`. - Reboot. - End up in single user mode. :\ Console Output: ``` Warning: no time-of-day clock registered, system time will not be set accurately Dual Console: Serial Primary, Video Secondary uhub0: 1 port with 1 removable, self powered Setting hostuuid: 30303030-3030-3030-3163-396364313466. Setting hostid: 0xb003ba5b. swapon: /dev/da0p1: No such file or directory Starting file system checks: /dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ufs/rootfs: clean, 27786002 free (5266 frags, 3472592 blocks, 0.0% fragmentation) Can't stat /dev/da0p2: No such file or directory Can't stat /dev/da0p2: No such file or directory THE FOLLOWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY: ufs: /dev/da0p2 (/mnt/wd250) Warning! Some of the devices might not be available; retrying Waiting 30s for the root mount holders: usbus1ugen1.2: <vendor 0x0424 product 0x9514> at usbus1 uhub1 on uhub0 uhub1: <vendor 0x0424 product 0x9514, class 9/0, rev 2.00/2.00, addr 2> on usbus1 uhub1: MTT enabled .uhub1: 5 ports with 4 removable, self powered ugen1.3: <vendor 0x0424 product 0xec00> at usbus1 smsc0 on uhub1 smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus1 smsc0: chip 0xec00, rev. 0002 miibus0: <MII bus> on smsc0 smscphy0: <SMC LAN8700 10/100 interface> PHY 1 on miibus0 smscphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto ue0: <USB Ethernet> on smsc0 ue0: Ethernet address: b8:27:eb:9c:d1:4f Restarting file system checks: /dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ufs/rootfs: clean, 27786002 free (5266 frags, 3472592 blocks, 0.0% fragmentation) Can't stat /dev/da0p2: No such file or directory Can't stat /dev/da0p2: No such file or directory THE FOLLOWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY: ufs: /dev/da0p2 (/mnt/wd250) Unknown error 3; help! ERROR: ABORTING BOOT (sending SIGTERM to parent)! 2022-06-01T14:20:22.857312+00:00 - init 1 - - /bin/sh on /etc/rc terminated abnormally, going to single user mode Enter full pathname of shell or RETURN for /bin/sh: ugen1.4: <Western Digital External HDD> at usbus1 umass0 on uhub1 umass0: <Western Digital External HDD, class 0/0, rev 2.00/1.75, addr 4> on usbus1 umass0: SCSI over Bulk-Only; quirks = 0x8100 umass0:0:0: Attached to scbus0 da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 da0: <WD 2500BEV External 1.75> Fixed Direct Access SCSI device da0: Serial Number 57442D575845323038433935323330 da0: 40.000MB/s transfers da0: 238475MB (488397168 512 byte sectors) da0: quirks=0x2<NO_6_BYTE> root@:/ # ```
(In reply to jollyrogue from comment #3) Overall it does not look like I'm likely to be of much help. But a valid question would likely be: Does U-Boot see all the drives (before it starts FreeBSD's loader)? If not, which drives are missing as seen in U-Boot? I've machines around that I used the likes of ( in /boot/loader.conf ): kern.cam.boot_delay=10000 vfs.root_mount_always_wait=1 but I've no clue if either is relevant for your context. In fact, I'd guess that vfs.root_mount_always_wait is unlikely to be. Another question would be the power situation relative to the drives and the RPi3* : What drives are bus powered? Are they all independently powered? RPi3*'s are not known for cleanly providing much power over USB. Spinning rust tends to have notable power-on power requirements to get things going, if I understand right.
(In reply to Mark Millard from comment #4) I'm not ruling out this being a crappy drive. I was honestly kind of amazed it worked without tweaking under Linux. `kern.cam.boot_delay=10000` did the trick. :) Both drives are USB powered. I only have one drive plugged in at a time to keep from drawing too much power from the RPi. USB HDs being tricky is what I've heard too. U-Boot does not see the HD. The SSD shows up, but the HD doesn't show up as a USB storage device. HD U-Boot: ``` U-Boot 2022.04 (Jun 01 2022 - 06:51:55 +0000) DRAM: 948 MiB RPI 3 Model B (0xa22082) Core: 69 devices, 10 uclasses, devicetree: board MMC: mmc@7e300000: 2 Loading Environment from FAT... In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. starting USB... Bus usb@7e980000: USB DWC2 scanning bus usb@7e980000 for devices... 3 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 MMC Device 0 not found no mmc device at slot 0 MMC Device 1 not found no mmc device at slot 1 switch to partitions #0, OK mmc2 is current device Scanning mmc 2:1... libfdt fdt_check_header(): FDT_ERR_BADMAGIC Scanning disk mmc@7e300000.blk... Found 3 disks Missing RNG device for EFI_RNG_PROTOCOL No EFI system partition BootOrder not defined EFI boot manager: Cannot load any image Found EFI removable media binary efi/boot/bootaa64.efi 1259212 bytes read in 124 ms (9.7 MiB/s) libfdt fdt_check_header(): FDT_ERR_BADMAGIC Booting /efi\boot\bootaa64.efi ``` SSD U-Boot: ``` U-Boot 2022.04 (Jun 01 2022 - 06:51:55 +0000) DRAM: 948 MiB RPI 3 Model B (0xa22082) Core: 69 devices, 10 uclasses, devicetree: board MMC: mmc@7e300000: 2 Loading Environment from FAT... In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. starting USB... Bus usb@7e980000: USB DWC2 scanning bus usb@7e980000 for devices... 4 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Hit any key to stop autoboot: 0 MMC Device 0 not found no mmc device at slot 0 MMC Device 1 not found no mmc device at slot 1 switch to partitions #0, OK mmc2 is current device Scanning mmc 2:1... libfdt fdt_check_header(): FDT_ERR_BADMAGIC Scanning disk mmc@7e300000.blk... Scanning disk usb_mass_storage.lun0... Found 7 disks Missing RNG device for EFI_RNG_PROTOCOL No EFI system partition BootOrder not defined EFI boot manager: Cannot load any image Found EFI removable media binary efi/boot/bootaa64.efi 1259212 bytes read in 125 ms (9.6 MiB/s) libfdt fdt_check_header(): FDT_ERR_BADMAGIC Booting /efi\boot\bootaa64.efi ```