2

Within a Docker container (image = mcr.microsoft.com/windows/servercore:ltsc2019), I have downloaded the SQL Server Express 2019 installer.

I have successfully downloaded the LocalDB msi with:

SQL2019-SSEI-Expr.exe /Action=Download /MediaType=LocalDB /Quiet

The file is downloaded to:

C:\Users\ContainerAdministrator\Downloads\en-us\SqlLocalDB.msi

However... running msiexec fails without any error messages. After navigating to the path mentioned above, I execute:

msiexec.exe /qb /i .\SqlLocalDB.msi IAcceptSqlLocalDBLicenseTerms=YES

The command immediately drops back to the command line after zero delay. Nothing ever gets installed.

What am I missing?

Edit: I'm trying to use LocalDB because this will eventually be an Azure Pipelines build agent. We use Redgate's "SqlChangeAutomation" powershell tools which uses LocalDB.

Edit 2: Not sure if this is progress yet, however... I mucked around with msiexec logging for a bit and discovered I could run it with the /a flag instead of /i and get it to successfully install.

msiexec.exe /qn /a SqlLocalDB.msi IAcceptSqlServerLicenseTerms=YES /L*V "C:\installers\SQL\install.log"

Unfortunately, however, upon navigating to C:\Program Files\Microsoft SQL Server\150\tools\binn and running SqlLocalDB.exe info, I get this:

Call to LocalDBFormatMessage failed. Error code returned:
2311389462.
Error in LocalDBFormatMessage! Error code returned:
2311389462.
Bryan
  • 258
  • 3
  • 11
  • Not supported on Server Core? – ErikEJ Dec 01 '20 at 19:03
  • I wondered about that, but I've found references online where people are describing the exact thing I'm trying to do. I just tried pulling a clean image of ltsc2019 with nothing else installed -- still no joy. – Bryan Dec 01 '20 at 19:06
  • Still, why LocalDb with Server Core? The Service-Based SQL Express is the better fit. – David Browne - Microsoft Dec 01 '20 at 19:19
  • This is going to be a Azure Pipeline build agent and we have a hard requirement on Redgate's "SqlChangeAutomation" powershell tools -- which use LocalDB – Bryan Dec 01 '20 at 19:20
  • Related: [Service 'Sql Server VSS writer' (SQLWriter) failed to start when installing LocalDB](https://stackoverflow.com/q/61357193/1364007) – Wai Ha Lee May 18 '21 at 10:24

2 Answers2

2

SQL LocalDB requires the Visual C++ redistributables, else many things won't go right (my problem was that SqlWriter service wouldn't create during install at all).

EDIT: it seems that I can use chocolatey to install the vc_redist and a older version of localdb. (Filing ticket to ask for the sqllocaldb package to be updated to 2019) so that would simplify things for most people. Keeping raw arguments/commands below just in case though.

My powershell steps for exact arguments (assuming you collect required files):

  1. start-process .\VC_redist.x64.exe -Wait -ArgumentList @('/install','/norestart','/passive') Note I am using the redist from https://aka.ms/vs/16/release/vc_redist.x64.exe which should be the 2019, but spattering of comments say I should have used either the one in the SQL installer package, or some 2015 version. However neither of those "worked" for me in the containers, but that could have been me invoking them wrong. Besides which, further packages I need to install want 2019 anyways.
  2. start-process msiexec -Wait -ArgumentList @('/i','SqlLocalDB.msi','/qn','/norestart','/L*V','install.log','IACCEPTSQLLOCALDBLICENSETE RMS=YES') Note that "/i" instead of "/a" worked correctly at this point, and the "/norestart" option. This was found from the choco localdb command source.

Useful powershell snippet to get some event logs (change "System" for "Application" for others) that helped me puzzle things out since no event-viewer in container: get-eventlog -LogName System -After (Get-Date).AddMinutes(-5) | ? {-not $_.Source.Contains("DCOM") } |?{-not $_.Message.Contains("depends on the Background Tasks Infrastructure Service")}| Format-List This and inspecting the "install.log" line-by-line from the SqlLocalDB.msi were what eventually led me on the right track.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
admalledd
  • 428
  • 3
  • 11
  • Note, I am still days away from *running* anything in my containers, but you may also need to start the SqlWriter service LocalDB installs (and failed starting for us without redist) as part of the container entrypoint like [this over here](https://stackoverflow.com/a/60982246/494125). – admalledd Jan 17 '21 at 07:09
  • you rock! I had to backburner this project for the time being because I didn't have any more time to devote to it. After experimenting with your suggestions, I successfully rebuilt the image, ran it through a battery of tests, and it performs flawlessly. Thanks for this!! – Bryan Jan 18 '21 at 18:51
0

I was trying to create images for pipelines too, installing via chocolatey, so I simply installed the chocolatey package for the redistributable too and that resolved the issue:

choco install vcredist-all -y
choco install sqllocaldb -y
ste-fu
  • 6,879
  • 3
  • 27
  • 46