{"id":99,"date":"2021-09-07T13:47:31","date_gmt":"2021-09-07T18:47:31","guid":{"rendered":"https:\/\/sourceopen.com\/?p=99"},"modified":"2021-09-07T13:48:33","modified_gmt":"2021-09-07T18:48:33","slug":"freebsd-13-on-raspberry-pi-hangs-at-first-reboot-after-install","status":"publish","type":"post","link":"https:\/\/sourceopen.com\/index.php\/freebsd-13-on-raspberry-pi-hangs-at-first-reboot-after-install\/","title":{"rendered":"FreeBSD 13 on Raspberry Pi Hangs at First Reboot After Install"},"content":{"rendered":"\n<p>I have been putting FreeBSD on a couple of Raspberry Pis. One was an old Raspberry  Pi Model B (256M of RAM&#8211; the first one released). The other was a newer RPI 3B. On the RPI3B I had a 64GB MicroSD card. <\/p>\n\n\n\n<p>I burned the FreeBSD 13.0 disk img with <a rel=\"noreferrer noopener\" href=\"https:\/\/www.etcher.net\/\" data-type=\"URL\" data-id=\"https:\/\/www.etcher.net\/\" target=\"_blank\">Etcher<\/a> 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:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">miibus0: on smsc0 \nsmscphy0: PHY 1 on miibus0 \nsmscphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto \nue0: on smsc0 \nue0: Ethernet address: b8:27:eb:xx:xx:xx<\/pre>\n\n\n\n<p>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 <em>mountroot <\/em>prompt.<\/p>\n\n\n\n<p>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 <em>mountroot <\/em>prompt, but it still would not work.<\/p>\n\n\n\n<p>I had an inkling in the back of my mind that this likely had something to do with <em>growfs<\/em>, 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. <\/p>\n\n\n\n<p><em>gorwfs <\/em>is run automatically from the line in <em>\/etc\/rc.conf<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">growfs_enable=\"YES\"<\/pre>\n\n\n\n<p>I needed to turn this off on the SD card image. So on another FreeBSD machine I unxzipped the Raspberry Pi img: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">unxz FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img.xz<\/pre>\n\n\n\n<p>Next I needed to link the img file to a virtual device so I could mount it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># mdconfig -a -t vnode -f FreeBSD-13.0-RELEASE-arm64-aarch64-RPI.img -u 0<\/pre>\n\n\n\n<p>And then mount it&#8211; note that the root partition is partition 2, and you can find it at <em>\/dev\/md0s2a<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># mount \/dev\/md0s2a \/mnt<\/pre>\n\n\n\n<p>Then I had to disable <em>growfs <\/em>in <em>\/mnt\/etc\/rc.conf<\/em> using sed (or a text editor).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># sed -ibkp 's\/growfs_enable=\"YES\"\/growfs_enable=\"NO\"\/' rc.conf<\/pre>\n\n\n\n<p>Unmount and disable the <em>mdconfig<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">umount \/mnt\nmdconfig -d -u 0<\/pre>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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). <\/p>\n\n\n\n<p>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 <em>\/home<\/em>.<\/p>\n\n\n\n<p>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!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been putting FreeBSD on a couple of Raspberry Pis. One was an old Raspberry Pi Model B (256M of RAM&#8211; the first one released). The other was a newer RPI 3B. On the RPI3B I had a 64GB &hellip; <a href=\"https:\/\/sourceopen.com\/index.php\/freebsd-13-on-raspberry-pi-hangs-at-first-reboot-after-install\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[3,88,83,79,84,82,81,85,87,80,86,24],"_links":{"self":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/99"}],"collection":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/comments?post=99"}],"version-history":[{"count":4,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/99\/revisions\/103"}],"wp:attachment":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/media?parent=99"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/categories?post=99"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/tags?post=99"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}