I have been putting FreeBSD on a couple of Raspberry Pis. One was an old Raspberry Pi Model B (256M of RAM– the first one released). The other was a newer RPI 3B. On the RPI3B I had a 64GB MicroSD card.
I burned the FreeBSD 13.0 disk img with Etcher and it booted up fine. The install process went pretty seamlessly until the first reboot. Then the Pi would hang up right after it showed the Ethernet MAC address:
miibus0: on smsc0 smscphy0: PHY 1 on miibus0 smscphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto ue0: on smsc0 ue0: Ethernet address: b8:27:eb:xx:xx:xx
The PI would just sit there with no error message. I re-did the install a couple of times, tried a different SD card, etc. Eventually, I decided to try FreeBSD 12 instead. This one got to the same place, but then eventually dropped into a mountroot prompt.
At this point I knew it had something to do with the root filesystem not working right. I tried to manually load the root filesystem from the mountroot prompt, but it still would not work.
I had an inkling in the back of my mind that this likely had something to do with growfs, the program that gets run on boot in order to expand the size of the root partition to the size of the entire SD card. After all, in my testing I had tried a couple of times where all I did was install FreeBSD, login as root and reboot immediately.
gorwfs is run automatically from the line in /etc/rc.conf
growfs_enable="YES"
I needed to turn this off on the SD card image. So on another FreeBSD machine I unxzipped the Raspberry Pi img:
unxz FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img.xz
Next I needed to link the img file to a virtual device so I could mount it:
# mdconfig -a -t vnode -f FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img -u 0
And then mount it– note that the root partition is partition 2, and you can find it at /dev/md0s2a
# mount /dev/md0s2a /mnt
Then I had to disable growfs in /mnt/etc/rc.conf using sed (or a text editor).
# sed -ibkp 's/growfs_enable="YES"/growfs_enable="NO"/' rc.conf
Unmount and disable the mdconfig:
umount /mnt mdconfig -d -u 0
After this surgery to the img file you can re-flash the SD card and when you run the installer your root filesystem will not be auto expanded, and your install will not hang after the first reboot.
I am not yet sure what the underlying issue is. I tried manually resizing the partition on the SD card to 32 GB and 16GB and 8GB, and all would not boot. It may be a 4GB limit (which is odd since this is arm64 bit).
In my case I ended up moving the root filesystem to a USB drive anyway. So I did not worry too much about all the wasted space on the SD card. I suppose you could also create another partition and and mount it someplace like /home.
This should at least get you started with the Raspberry Pi 3B on FreeBSD 13 or FreeBSD 12. This bug should be reported, though. I hope to soon, but likely should do some more testing first. Feel free to report it!
I get the same error. But when I tried your patch, it was worse, it got the mountroot issue at initial boot. After pulling out some hair, I found this:
https://youtu.be/WuoMPP_178U
and it works. There are a couple of subtle differences:
1) different download file location link, though it looks like the same file anyway
2) using xz -d rather than unxz
I’ve installed quite a few linux distros on rpi. The auto fs growth is needed!
Thanks for the comment. Glad to hear you got it working. That video is nice. It looks like they must have fixed the grofws problem that I had, or he never would have gotten to a login prompt.
unxz and xz -d should do the same thing, but perhaps some systems don’t have unxz (Both FreeBSD and Ubuntu seem to have it.)
My pi has been humming along for a long while now. FreeBSD seems quite stable on it. Good luck!