# Boot hangs



## braddeicide (May 28, 2016)

Hi, could someone help me diagnose what's happening here why my system hangs during boot.  I'm asking here as it's no doubt something to do with the boot process, which should be well known here.

I've recently added a new unconfigured drive, I can't boot the system to configure it as something has gone wrong with boot process.

```
BTX loader 1.00   BTX version is 1.02
Consoles: internal video/keyboard
BIOS drive C:  is disk0
BIOS drive D:  is disk1
BIOS drive E:  is disk2
BIOS drive F:  is disk3
BIOS drive G:  is disk4
BIOS drive H:  is disk5
BIOS drive I:  is disk6
BIOS drive J:  is disk7
BIOS drive K:  is disk8
BIOS drive L:  is disk9
BIOS drive M:  is disk10
|
```
That's it, it freezes with the spinner stopping there.

I'm booting off a two drive ZFS bootpool mirror, so even if the new drive took disk0 position, surely disk1 would still boot.  I've tested booting off each of the drives in the mirror independently to ensure they're both capable of full boot process.

Any hints or direction greatly appreciated.


----------



## tingo (May 29, 2016)

Does the machine boot if you remove the new drive?
I notice that you have a lot of drives...


----------



## braddeicide (May 31, 2016)

Yes it does, but I'm trying to add a new drive 

I boot off two drives in a zfs mirror plugged into the motherboard that register as ada devices, and 8 more on a raid card that register as da.  When i add a third drive to the motherboard, boot freezes at the point displayed above.  I'm suspicious the new drive is taking ada0, but the bootloader should still find ada1 and boot from that rather than hang on an unconfigured drive?


----------



## tingo (May 31, 2016)

Have you tested booting from an usb memory stick (with FreeBSD 10.3 install image, for example)?
Just to rule out that this might be a problem with your hardware, rather than with FreeBSD.


----------



## kpa (May 31, 2016)

There are quite a few possible causes.

- Boot order problem although it shouldn't matter assuming the BIOS handles boot disk selection correctly.
- BIOS bug that triggers a problem in the next item.
- FreeBSD bootloader bug.
- The new disk isn't quite empty and has a boot block or partition table that triggers a bug in either of the above.


----------



## Chris_H (Jun 2, 2016)

+1 to what kpa has already noted above. I might add, the install CD/DVD, and utilizing gpart(8), and newfs(8) to initialize the disk. Might get you past the issue, if even only to use them to _blank_ the disk, as kpa already noted. I mention this, because you already indicated you wanted to add the disk. This method _should_ allow you to do so.

HTH

--Chris


----------



## SirDice (Jun 2, 2016)

If the drives are hot-swap you could attach the drive when the system is fully booted. That should also allow you to clear any conflicting boot partitions. Once cleared I definitely recommend trying to reboot, just to make sure it can now boot properly again.


----------



## braddeicide (Jun 13, 2016)

Sorry for the delayed reply, this system is my iscsi server and i have to shut down _everything_ to work on it 

I booted off the DVD today and it booted fine with the new drive in.  It's nvme so it got a /dev/nvd not an ada which i had suspected earlier.  My two boot ada's were in place and a zfs import showed a healthy boot pool.

I gpart and newfs'd the drive, yet when I try boot off the ada/zfs sata disks, it dies again mid BTX loader.

It's really weird where it freezes, after finding the last bios drive but before the 

```
BIOS 595kB/3654644kB available memory.
```
I assume that line is the last output of the btx loader before it loads /boot/loader.  I'm running 10.3-RELEASE-p3 and the DVD was 10.3-RELEASE, btx loader is the same version on both yet when I boot off DVD it works, but when I boot off sata it hangs ... I believe this is before /boot/loader or /boot/loader.conf is loaded so it's hard to see what's different about booting off the CD or sata at this point.

And of course when i pull the new drive out it all boots happily again.  Any further suggestions?


----------



## braddeicide (Jun 13, 2016)

Actually, no i just found that output in the loader/main.c.  I notice also that the DVD bootstrap loader doesn't say "ZFS enabled" bootstrap loader, that's a difference.


```
169 /*
170 * March through the device switch probing for things.
171 */
172 for (i = 0; devsw[i] != NULL; i++)
173 if (devsw[i]->dv_init != NULL)
174 (devsw[i]->dv_init)();
175 printf("BIOS %dkB/%dkB available memory\n", bios_basemem / 1024, bios_extmem / 1024); [/i][/i][/i]
```
_

I guess it's failing on the dv_init, but again, strange it init's ok when booting from DVD._


----------



## ggulchin (Mar 16, 2019)

Exact same thing happened to me when I upgraded from FreeBSD 11.2 to 12.0. If I boot from memstick of FreeBSD 12, I get exactly same result, however, if I download memstick of 11.2, system boots just fine. I have Supermicro with 8 HDDs, 4 are connected to onboard SATA and the other 4 connected to SAS 9260-4i HBA. On FreeBSD 12, when I remove all drives system boots just fine. Through experiments, I realized if I remove just 2 drives from HBA, system boots fine, I than plug them in and import via mfiutil and online in zfs pool, system works fine, until reboot. 

Curious if:

loader is broken
can I copy the working parts from 11.2 to 12.0

Any help is greatly appreciated!

thanks!


----------



## andrei693 (Oct 15, 2019)

I have the same issue on 12-STABLE, have a boot environment from 11-STABLE that boots just fine, I can even chose the 12-STABLE boot environment at the menu loaded from 11.
The issue started happening when I added a second raidz2 vdev of 4 disks to the already existing one. The system booted fine with the new disks connected but not added to the pool:

```
# zpool status storage02-2
  pool: storage02-2
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
  scan: scrub canceled on Wed Oct  9 12:31:27 2019
config:

        NAME                        STATE     READ WRITE CKSUM
        storage02-2                 ONLINE       0     0     0
          raidz2-0                  ONLINE       0     0     0
            gpt/WD-WCC4M0PZY2DE     ONLINE       0     0     0
            gpt/WD-WCC4M2FYTE67     ONLINE       0     0     0
            gpt/WD-WCC4M2UVTAYN     ONLINE       0     0     0
            gpt/WD-WCC4M4DC6VS9     ONLINE       0     0     0
          raidz2-2                  ONLINE       0     0     0
            gpt/WD-WCC4M4DC6CKC     ONLINE       0     0     0
            gpt/WD-WCC4M3YD32PT     ONLINE       0     0     0
            gpt/WD-WCC4M2FYTHV0     ONLINE       0     0     0
            gpt/WD-WCC4M4DC6Y9U     ONLINE       0     0     0
        logs
          mirror-1                  ONLINE       0     0     0
            gpt/BTYF911302RG240AGN  ONLINE       0     0     0
            gpt/BTYF911302TH240AGN  ONLINE       0     0     0
        cache
          gpt/7M100R51              ONLINE       0     0     0
          gpt/7M100R4V              ONLINE       0     0     0

errors: No known data errors
```

Using GPT on all disks:

```
# gpart show da1
=>        40  3907029088  da1  GPT  (1.8T)
          40        2008       - free -  (1.0M)
        2048  3906617453    1  freebsd-zfs  (1.8T)
  3906619501      409627       - free -  (200M)
```

Really curios in anyone has found a solution to this.
Seems to be the same issue as https://forums.freebsd.org/threads/no-reboot-after-v12-0-release-upgrade.68651/.
Also mentioned here: _View: https://www.reddit.com/r/freebsd/comments/aod9py/freebsd_12_usb_installer_lockup_at_btx_loader/?sort=confidence_
.


----------



## andrei693 (Oct 15, 2019)

What I ended up doing so far was coping /boot/loader* from 11-STABLE over the ones installed on 12. This way the system boots fine, might break freebsd-update on RELEASE.


----------

