mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

Unable to start container - CoInitializeSecurity failure

Open wicksipedia opened this issue 2 years ago • 39 comments

Hey there 👋 Getting odd container startup issues that I haven't experienced before.

Trying to work with 2022-latest, since this hasn't changed in a couple of months, I'm wondering if its a windows/docker regression.

REPOSITORY                                  TAG           IMAGE ID       CREATED         SIZE
mcr.microsoft.com/mssql/server              2022-latest   9e28798be691   2 months ago    1.6GB

When running:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>' `
    -p 1433:1433 `
    --name sql` `
    -h sql1 `
    -d mcr.microsoft.com/mssql/server:2022-latest 

I was getting errors similar to #787

/opt/mssql/bin/permissions_check.sh: line 4: [: : integer expression expected
/opt/mssql/bin/permissions_check.sh: line 59: [: : integer expression expected

I added the CONFIG_EDGE_BUILD variable:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>' -e 'CONFIG_EDGE_BUILD=0' `
    -p 1433:1433 `
    --name sql1 `
    -h sql1 `
    -d mcr.microsoft.com/mssql/server:2022-latest 

Now I am hitting a CoInitializeSecurity failure:

2023-01-23 10:56:00 SQL Server 2022 will run as non-root by default.
2023-01-23 10:56:00 This container is running as user mssql.
2023-01-23 10:56:00 To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
2023-01-23 10:58:43 ERROR: CoInitializeSecurity failure. (HRESULT 0x800706b5)

Note: mssql on docker was working last week before updating to: Windows - 22623.1180 (Beta channel) Docker - 4.16.2 (95914)

wicksipedia avatar Jan 23 '23 00:01 wicksipedia

I've got the same issue this morning. Same image ID, running under Docker-Compose with Docker Desktop 4.16.2 but on Windows 25276.1000 (Dev channel). It doesn't appear to be an issue with the Windows build as I haven't updated.

CraigN avatar Jan 23 '23 08:01 CraigN

I've run into a very similar problem with the mssql-azure-edge image on Windows. Happened friday last week, January 20th. Running Windows 10, Docker 4.16.2.

First I'm met by:

db-mssql-azure-edge  | 2023/01/23 08:19:18 [launchpadd] WARNING: Failed to connect to SQL because: dial tcp 127.0.0.1:1431: getsockopt: connection refused, will reattempt connection.
db-mssql-azure-edge  | 2023/01/23 08:19:19 [launchpadd] WARNING: Failed to connect to SQL because: dial tcp 127.0.0.1:1431: getsockopt: connection refused, will reattempt connection.
db-mssql-azure-edge  | 2023/01/23 08:19:20 [launchpadd] WARNING: Failed to connect to SQL because: dial tcp 127.0.0.1:1431: getsockopt: connection refused, will reattempt connection.
db-mssql-azure-edge  | 2023/01/23 08:19:21 [launchpadd] WARNING: Failed to connect to SQL because: dial tcp 127.0.0.1:1431: getsockopt: connection refused, will reattempt connection.
db-mssql-azure-edge  | 2023/01/23 08:19:22 [launchpadd] WARNING: Failed to connect to SQL because: dial tcp 127.0.0.1:1431: getsockopt: connection refused, will reattempt connection.

Usually I get about 3 warnings before the rest of the system starts. But now there's 5 and a long delay.

Finally it crashed with:

db-mssql-azure-edge  | ERROR: CoInitializeSecurity failure. (HRESULT 0x800706b5)
db-mssql-azure-edge exited with code 1

Very strange.

I have also tried with Docker 4.15 and 4.14 and 4.13 by now, no difference. Same result. Both in powershell win10 and WSL2.

karlmacklin avatar Jan 23 '23 08:01 karlmacklin

My test above was with the azure-edge version. So how does my system do with the 'standard' mssql docker image?

Starting a basic mcr.microsoft.com/mssql/server:2022-latest docker image, using this command: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest

Results in:

/opt/mssql/bin/permissions_check.sh: line 4: [: : integer expression expected
SQL Server 2022 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
/opt/mssql/bin/permissions_check.sh: line 59: [: : integer expression expected
ERROR: CoInitializeSecurity failure. (HRESULT 0x800706b5)

On both Docker Desktop 4.13.1 and 4.16.2 (latest of this writing). My colleague with Windows 11 has no problems. My guess WOULD be that there is something messed up with some recent Windows 10 update. However CraigN's comment above speaks against that theory, so I'm not sure.

Specific Windows info is: Windows 10 Pro, 22H2 OS-version 19045.2546 Windows Feature Experience Pack 120.2212.4190.0

If I use tag 2019-latest it works fine however.

karlmacklin avatar Jan 23 '23 10:01 karlmacklin

I have the same issue today, worked fine on friday. I had no issues for months before.

Windows 11 22H2 (OS Build 22621.1105) Docker 4.16.2

According to windows update history, nothing has been installed over the weekend.

molesinski avatar Jan 23 '23 11:01 molesinski

I have the same issue today, worked fine on friday. I had no issues for months before.

Windows 11 22H2 (OS Build 22621.1105) Docker 4.16.2

According to windows update history, nothing has been installed over the weekend.

I have a colleague running Win 11 Pro OS build 22623.1180 (seems to be same as original poster's) and he can run both azure edge container and mcr.microsoft.com/mssql/server:2022-latest fine using Docker 4.15.x.

karlmacklin avatar Jan 23 '23 12:01 karlmacklin

I found the culprit. Apparently today in the morning Windows Subsystem for Linux store app has auto updated from version 1.0.3 to version 1.1.0, which cause this problem.

Reverting back to version 1.0.3 from here https://github.com/microsoft/WSL/releases solved the issue.

molesinski avatar Jan 23 '23 14:01 molesinski

I found the culprit. Apparently today in the morning Windows Subsystem for Linux store app has auto updated from version 1.0.3 to version 1.1.0, which cause this problem.

Reverting back to version 1.0.3 from here https://github.com/microsoft/WSL/releases solved the issue.

great find, I installed 1.0.3 as well and it works fine

not sure why my system had opted for 1.1.0

karlmacklin avatar Jan 23 '23 15:01 karlmacklin

Rolling back to 1.0.3 worked for me, so I added an issue to the WSL repo

wicksipedia avatar Jan 24 '23 03:01 wicksipedia

Rolling back to 1.0.3 worked for me, so I added an issue to the WSL repo

Same issue and also fixed it for me

JakobRobijns avatar Jan 25 '23 14:01 JakobRobijns

Hello, i have the same issue. Docker 4.16.3, Win 11 22H2 22621.1194, wsl 2. It failed to start docker for sqlserver 2022, but it works well with sqlserver 2019. Uninstall/reinstall docker does not work.

TuanUsense avatar Feb 01 '23 14:02 TuanUsense

Experienced this issue too. Windows OS build 22623.1245 . Using SQL server 2019 seems to work fine.

frasermclean avatar Feb 03 '23 23:02 frasermclean

I am encountering the same issue, SQL server 2019 was working fine at the start but now it just stuck at the upgrade

2023-02-07 16:58:50.73 spid9s      Database 'msdb' running the upgrade step from version 902 to version 903.
2023-02-07 16:58:50.74 spid9s      Database 'msdb' running the upgrade step from version 903 to version 904.

The server get's ready for the connection after like 5-6 minutes don't know what to look into

Windows 11 Version 22H2 Build 25281.1000

WSL version: 1.1.2.0 Kernel version: 5.15.83.1 WSLg version: 1.0.49

DeathNet123 avatar Feb 07 '23 17:02 DeathNet123

Reverting back to version 1.0.3 from here https://github.com/microsoft/WSL/releases solved the issue.

@molesinski how do you reverted the wsl version?

Rolling back to 1.0.3 worked for me, so I added an issue to the WSL repo

@wicksipedia can you please share the issue?

same problem with WSL 1.1.2

cirolosapio avatar Feb 11 '23 12:02 cirolosapio

@molesinski how do you reverted the wsl version?

Data integrity isn’t guaranteed AFAIK. I was able to download 1.0.3 from the WSL repo then run:

$Package = Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemforLinux -AllUsers 
Remove-AppxPackage $Package -AllUsers
Add-AppxPackage .\Microsoft.WSL_1.0.3.0_x64_ARM64.msixbundle

@wicksipedia can you please share the issue?

same problem with WSL 1.1.2

It’s in the comments above but it has been closed as a dupe.

The WSL team are working on https://github.com/microsoft/WSL/issues/9508

wicksipedia avatar Feb 11 '23 22:02 wicksipedia

I checked with WSL 1.1.3 and it seems to work

Versione WSL: 1.1.3.0
Versione kernel: 5.15.90.1
Versione WSLg: 1.0.49
Versione MSRDC: 1.2.3770
Versione Direct3D: 1.608.2-61064218
Versione DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
versione Windows: 10.0.25300.1000

cirolosapio avatar Feb 24 '23 19:02 cirolosapio

Even with WSL 1.1.3 the latest image for sql-server 2022 doesn't work for me. As with others, 2019 does work!

WSL version: 1.1.3.0
Kernel version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.1641

ledjon-behluli avatar Mar 02 '23 20:03 ledjon-behluli

I was having the same problem as @ledjon-behluli that it still didn't work with WSL 1.1.3, but I noted that it had worked for @cirolosapio

I checked my wsl --version:

WSL version: 1.1.3.0
Kernel version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.1574

And saw that I was on the same windows build version 22000 as @ledjon-behluli while @cirolosapio is on build version 25300.

I checked for and applied two windows updates:

  1. 2023-02 Cumulative Update for Windows 11 for x64-based Systems (KB5022905)
  2. Windows 11, version 22H2

The first update took me to 10.0.22000.1641, and sql-server 2022 still didn't work.

The second update took me to 10.0.22621.1265, and at that point it finally worked for me!

SaxonDruce avatar Mar 08 '23 06:03 SaxonDruce

Can confirm @SaxonDruce comment, updating Windows to 22H2 fixes the issue.

wsl --version

WSL version: 1.1.3.0
Kernel version: 5.15.90.1
WSLg version: 1.0.49
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1265

royberris avatar Mar 09 '23 09:03 royberris

I installed 1.1.5 and it works correctly with MSSQL 2022 docker image.

aliasadidev avatar Mar 22 '23 09:03 aliasadidev

I can confirm that upgrading to WSL 1.1.5 solved the issue with the sql-server 2022 image, even while still being on Windows 11 21H2

ledjon-behluli avatar Mar 24 '23 07:03 ledjon-behluli

After updating to WSL 1.1.6 it worked for me, then after installing a windows update and rebooting it stopped working again. Specifically mssql 2022, 2019 works.

xorinzor avatar Mar 30 '23 07:03 xorinzor

the same here. Using 1.1.6 with the latest windows 11 doesn´t work.

pablocastilla avatar Mar 30 '23 11:03 pablocastilla

same here, using 1.1.6 with latest windows 11 = not working.

dazinator avatar Apr 06 '23 13:04 dazinator

I'm running WSL v2 on Win11, attempting to start the latest SQL 2022 image as of today. I also encountered the error:

CoInitializeSecurity failure

I was able to get it working by switching to the Hyper-V based engine in the Docker Desktop settings. (This was my first image on a new install, so there was no impact on existing infrastructure to consider. YMMV.)

InteXX avatar Apr 07 '23 22:04 InteXX

mcr.microsoft.com/mssql/server:2022-latest don't work for me as well 🫤 WSL 1.1.6 & Windows 11

docker logs sq1

SQL Server 2022 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
ERROR: CoInitializeSecurity failure. (HRESULT 0x800706b5)

wsl --vesion

WSL version: 1.1.6.0
Kernel version: 5.15.90.1
WSLg version: 1.0.50
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1413

KerasirovED avatar Apr 08 '23 17:04 KerasirovED

Same here, unable to run sql 22

image

snavarropino avatar Apr 11 '23 08:04 snavarropino

Same here. Remembered the solution from last time - reverted back from (pre-release) WSL 1.2.0.0 to last non-pre-release version 1.1.3 - and voila. Powershell instructions to un/reinstall above thanks to @wicksipedia

EwanMcP avatar Apr 11 '23 14:04 EwanMcP

Other option is switching to hyper-v backend, but you are gonna loose your data

snavarropino avatar Apr 11 '23 14:04 snavarropino

Encountering the same issue, reverting to 2019-latest seems to be working.

BerendWouters avatar Apr 11 '23 19:04 BerendWouters

Encountering the same issue: ERROR: CoInitializeSecurity failure. (HRESULT 0x800706b5) WSL Version: 1.2.0.0 Docker Desktop Version: 4.18.0

Remedy: Revert WSL to version 1.1.6.0

bb-avi avatar Apr 12 '23 14:04 bb-avi