# Slow boot times on Raspberry Pi 3B+



## sailorjerry (Jul 30, 2020)

Hello,
I recently installed FreeBSD 12.1-STABLE on a Raspberry Pi 3B+.  FreeBSD booted fine from a technical perspective, but took about five minutes to get to a login prompt.  I reflashed the SD card with the RELEASE version, and the same thing happened.  I noticed it hung up somewhere near recognizing and loading drivers for my USB Keyboard and Mouse, so I unplugged them and rebooted, and the boot time grew to 8 minutes.  I rebooted with verbose flag and didn't notice any unusual errors, although I did see that GEOM_PART complained that partioned were not aligned with xxxxxxxx bytes appear both several messages before the hangup and then a few times during the hang up. I am not sure if it is relevant.  Any ideas of other things I can check?  This is bare bones stuff, I havent even connected it to internet yet so it should be as minimal as it can get.  Besides enabling logs in the syslog.conf file and various other trivial usability items, I haven't affected anything from installation.  Any help would be greatly appreciated, I like it so far but a 5 to 8 min boot is too long to be usable, especially headless...


----------



## George (Jul 30, 2020)

Loading the kernel from a slow SD card can take some time.


----------



## acheron (Jul 30, 2020)

First boot is *always* slow (or just remove growfs_enable="YES" in rc.conf)


----------



## SirDice (Jul 30, 2020)

I would expect some timeout on DHCP too if it's not connected to a network. That's going to delay the boot also. Although 5 minutes seems quite excessive. My Pi3 boots fairly quick.


----------



## acheron (Jul 30, 2020)

Again *growfs* on 1st boot.


----------



## sailorjerry (Jul 30, 2020)

Regarding first boot: it was slow first boot as expected, because growfs, but it is still slow after maybe ten boots?  I can disable growfs but does that have effect after the first boot?  Regarding DHCP: I thought this too but I would think it would complain in the logs somehow, and I hooked it up to the network and had the same issue (DHCP assigned by my router).  I was expecting 30s to 1 m delay from DHCP any way, not 5m) Kernel: is there a way to prove this?  This seems reasonable but I would think I would see this somewhere or see delays across the whole boot process...


----------



## acheron (Jul 30, 2020)

sailorjerry said:


> Regarding first boot: it was slow first boot as expected, because growfs, but it is still slow after maybe ten boots?  I can disable growfs but does that have effect after the first boot?  Regarding DHCP: I thought this too but I would think it would complain in the logs somehow, and I hooked it up to the network and had the same issue (DHCP assigned by my router).  I was expecting 30s to 1 m delay from DHCP any way, not 5m) Kernel: is there a way to prove this?  This seems reasonable but I would think I would see this somewhere or see delays across the whole boot process...


You can remove it but on it only affect the very first boot. If you have a serial console you can try to press "ctrl t" to see if it's a userland script that slow down the boot.


----------



## George (Jul 30, 2020)

I had a very cheap (and slow..) SD card on my RPI3b. The boot time was like 5 minutes or so as well.. That's why I switched to booting via usb. ;D Really, try a different SD card, one with high read/write speed.


----------



## sailorjerry (Jul 31, 2020)

SD card helped a good deal, thank you for that, I don't know if I would be tried that on my own! I'm down to 2m 30s, but it is still hanging at the same point.  The last message I see is "ums0: 8 buttons and [XYZT] coordinates ID=0" talking about my mouse, and it sits there for about 1m before finally showing the login prompt.  I have a USB drive coming via amazon to try USB boot, but I'm not convinced something isn't wrong, or at least it troubles me that I can't figure out what it's thinking about to know if it is right or wrong.  Ctrl + T did not work, don't know if you can do that while booting or may be keyboard isn't recognized yet, but nothing happened when I tried it...  Thanks again for all the replies and ideas thus far!


----------



## T-Daemon (Jul 31, 2020)

sailorjerry said:


> I recently installed FreeBSD 12.1-STABLE on a Raspberry Pi 3B+


The image you installed, which date is it from? There is a 2020-Jul-30 dated image available:



			Index of /ftp/snapshots/arm64/aarch64/ISO-IMAGES/12.1/
		


Have you tried 12.1-RELEASE or 13.0-CURRENT?


----------



## T-Daemon (Jul 31, 2020)

There is a bug report reporting a PI3B+ slow booting, allegedly "due to incompatibilities with new DTB from Raspberry Pi developers and FreeBSD kernel.".






						243125 – FreeBSD 12.1-STABLE and 13-CURRENT shows No ethernet found and boots system very slow on raspberry pi 3B+
					






					bugs.freebsd.org
				




Most likely it's not at all related to your situations, but I thought it's worth mentioning.


----------



## acheron (Jul 31, 2020)

sailorjerry said:


> SD card helped a good deal, thank you for that, I don't know if I would be tried that on my own! I'm down to 2m 30s, but it is still hanging at the same point.  The last message I see is "ums0: 8 buttons and [XYZT] coordinates ID=0" talking about my mouse, and it sits there for about 1m before finally showing the login prompt.  I have a USB drive coming via amazon to try USB boot, but I'm not convinced something isn't wrong, or at least it troubles me that I can't figure out what it's thinking about to know if it is right or wrong.  Ctrl + T did not work, don't know if you can do that while booting or may be keyboard isn't recognized yet, but nothing happened when I tried it...  Thanks again for all the replies and ideas thus far!


"ctrl t" should work if your keyboard is attached. Maybe the USB is slow to initialize, idk. You can try to put this line in /boot/loader.conf:
hw.usb.no_boot_wait="1"


----------



## sailorjerry (Aug 1, 2020)

I tried 12.1-STABLE after I encountered the problem with RELEASE.  Both exhibit the same issue, I have not tried 13.0 yet so I might give that a shot if I can't get 12.1 working.  I saw that bug report and while a lot of that is Greek to me, (I am planning on using this pi to learn networking so I don't know enough yet to understand what all of that means) I don't have any of the complaints the system is throwing out there so I'm not sure it pertains to me at this point.  I will try the hw.usb.no_boot_wait option once I read up on what that does... Thank you all again, much appreciated!


----------



## mark_j (Aug 1, 2020)

I have experimented with the RPI3 and FreeBSD and have found the USB to be flakey at best. It seems to be very timing dependent and timeouts or waits too long. It's especially so if you're using USB sticks/drives and extension cables. It will flat out refuse to find them.
As I recall this was testing on 11 and 12, but not 13. I see no reason to suspect anything has changed.

If you boot with a monitor attached, right at the very start does it find all your USB devices immediately? I think you'll find it doesn't and this is the cause of the slowness. It's scanning for them.


----------

