# bhyve(guest WinSRV 2012 R2 STD) and MSSQL - error installation - Could not find the Database Engine startup handle



## SemFLY (Nov 5, 2019)

Hello!

I try install MSSQL Express 2017 on Windows Server 2012 R2

I have.

*HOST*
OS FreeBSD 11.3-RELEASE-p3
Use bhyve 

*GUEST*
Windows Server 2012 R2

`bhyve -c 4,sockets=1,cores=2,threads=2 \
-s 7,fbuf,tcp=192.168.17.11:5900,w=1600,h=900,wait \
-s 0,hostbridge \
-s 3,ahci-hd,winsrv_sys.hdd \
-s 4,ahci-hd,winsrv_data.hdd \
-s 8,xhci,tablet \
-s 10,virtio-net,tap5 \
-s 31,lpc -l bootrom,/vmdata/BHYVE_UEFI.fd \
-m 6G -H -w winsrv2012_r2_std`

But under bhyve installation stop with error
_“Could not find the Database Engine startup handle”_

I try MSSQL 2012, 2014, 2016 and 2017, the same error.

When i try install and use hypervisor VMWare, ESXi, VitrualBox or physical computer, installation well done in default mode, nothing change options, only next step and finish, but under bhyve always error.

Trying install on physical or VmWare, take image from disk and restore under bhyve in WinSRV2012R2, but no effect, MSSQL doesn't start.

Trying this 








						Problems with the installation of SQL Server 2014 (after the Windows 8.1 Update)
					

I’m not sure if this have something to do with the Windows 8.1 Update but the reality is that I wasn’t able to install SQL Server 2014 on my machine after the Windows 8.1 Update.




					kalcik.net
				



Change Account 
NT AUTHORITY\SYSTEM 
NT AUTHORITY\NETWORK

Read many information already four days.

No effect.

Help please.

Who install MSSQL on Windows Server 2012 R2 (guest bhyve), tell please ?
What moment i don't see for solution under bhyve, tell please ?


----------



## Selin (Sep 1, 2020)

Not sure if it is still actual, but I hit the same issue with MS SQL 2016 and 2017 and found the solution, so just want to share it.
I found different suggestions like change account to be used to run the MS SQL service, etc. but nothing help.
Then I found this topic: https://www.mssqltips.com/sqlserver...hich-required-falling-back-to-synchronous-io/
Had run fsutil on my VM:
`fsutil fsinfo ntfsinfo c:`
and got the following response:

```
...
Bytes Per Sector  :                512
Bytes Per Physical Sector :        4096
Bytes Per Cluster :                4096
Bytes Per FileRecord Segment    :  1024
...
```
Then I updated the vm-bhyve config with the following option:

```
disk0_opts="sectorsize=512"
```
Did stop-start cycle of the VM to let this change take place.
After that fsutil gave me the following:

```
...
Bytes Per Sector  :                512
Bytes Per Physical Sector :        512
Bytes Per Cluster :                4096
Bytes Per FileRecord Segment    :  1024
...
```
As you can see - the *Bytes Per Physical Sector* is changed from *4096* to *512*. 
After that, I was able to install the MS SQL 2017 with all the default parameters. And it finally working!!!


----------



## Selin (Sep 2, 2020)

Small update
Another option works too as well:

```
disk0_opts="sectorsize=4096/4096"
```
But in this case I had to reinstall VM.
In this case `fsutil fsinfo ntfsinfo c:` will show the following:

```
...
Bytes Per Sector  :                4096
Bytes Per Physical Sector :        4096
Bytes Per Cluster :                4096
Bytes Per FileRecord Segment    :  4096
...
```
Also with such setting VM's disk performance is a bit lower: IO/s on disk with 4k sector size ~10-20% less than on disk with 512 sector size. Not sure why... Host uses RAID-1 of two SSD with native 4k sectors. Read/Write speed remains almost the same. (Tested with ATTO Disk Benchmark)

But this might be useful in case when you need a new SQL instance for a cluster where 4k sector is used already - to avoid messages like "There have been ### misaligned log IOs which required falling back to synchronous IO. The current IO is on file xxx."
Details can be found here: https://www.mssqltips.com/sqlserver...hich-required-falling-back-to-synchronous-io/


----------



## Deleted member 63539 (Sep 2, 2020)

Selin said:


> Small update
> Another option works too as well:
> 
> ```
> ...


I recommend to start with this option by default for all of the VMs, not just Windows. As it saved me from much of headache. IMHO, 4096 bytes sector size is recommended over 512 bytes sector size. I use 4096 bytes sector size for all of my VMs.


----------



## distancesprinter (Jan 12, 2021)

I ran into the same problem trying to install SQL Server 2019 on Windows Server 2019 Standard.

I am not using vm-bhyve.  Here's how I updated my configuration:


```
-s 1:0,virtio-blk,/dev/zvol/hyvepool/vm/disks/$vmname \
```

to


```
-s 1:0,virtio-blk,/dev/zvol/hyvepool/vm/disks/$vmname,sectorsize=512 \
```


I did not need to rebuild the OS or reconfigure anything--just had to uninstall the partially installed bits of SQL Server 2019, reboot, and reinstall it.


----------

