Overview
When installing CTPlus, you may encounter the error:
Failed to create DB, error code 1
This error can have a number of causes, and most commonly occurs due to permission issues, but it can also be related to issues with the database instance, or disk formatting and sector size compatibility, specifically with how the software interacts with non-standard sector sizes. This article covers how to troubleshoot these issues, check the sector size, and if the sector size is incorrect, how to correct it.
Initial checks
Firstly, ensure that you have local administrative permission on your computer. CTPlus requires local administrative access to install successfully.
Then if you are still having issues, follow the troubleshooting steps below.
Disk Sector Size compatibility information
CTPlus is not compatible with disks formatted using a 16,384 bytes per physical sector size (PhysicalBytesPerSectorForPerformance).
Most software expects standard sector sizes such as:
- 512 bytes (Legacy)
- 4,096 bytes (Advanced Format / 4K)
If the drive is using a non-standard 16K sector size, CTPlus may fail to initialize the local SQL database during installation.
This is due to the Microsoft MSSQLLocalDB database used by CTPlus, and Microsoft has confirmed that MSSQLLocalDB requires a 4,096 bytes sector size.
Resolution Steps
1. Check the Sector Size
You can confirm your sector size by running the following command in cmd:
fsutil fsinfo sectorinfo C:]
2. If needed, Force the Sector Size to 4,096 Bytes
NOTE: If the sector size is already correct, you do not need to make the Disk Sector Size compatibility fix, and if you already have local Administrative permissions on your computer, and are still seeing this, proceed to the next section.
Fo change the sector size, use the following command to override the physical sector size to 4,096 bytes for the relevant NVMe storage driver:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t reg_multi_sz /d "* 4095"
Note: 4095 is used instead of 4096 due to registry key format expectations. The system will interpret this correctly.
Restart the computer after applying this change.
You will also usually need to run the following step 3 as well after this.
3. Try Reinitialising MSSQLLocalDB
The next thing to try is using the following commands to reset the LocalDB instance:
sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB
sqllocaldb create MSSQLLocalDB
sqllocaldb start MSSQLLocalDB
You should then see the following:
LocalDB instance "MSSQLLocalDB" started
4. If still failing, Manually Install SQL Server Express 2022
If the Reinitialising above didn't successfully start the "MSSQLLocalDB" instance, the next thing to try is:
Download and install SQL Server Express 2022 separately, and then try again after that.
5. Retry CTPlus Installation
After performing these steps, re-run the CTPlus installer. It should now successfully create the database and complete the setup process.
If you are still having issues after trying these steps, please reach out to your Distributor for further assistance.