Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install Visual Studio inside a server core image #540

Open
zillemarco opened this issue Sep 27, 2024 · 14 comments
Open

Cannot install Visual Studio inside a server core image #540

zillemarco opened this issue Sep 27, 2024 · 14 comments
Assignees
Labels
bug Something isn't working Visual Studio Visual Studio + Visual Studio Code

Comments

@zillemarco
Copy link

Describe the bug
I am trying to install VS 2022 build tools inside of a docker container to build an image and use it for our CI builds.
I already had an image working, but now I needed to update a dependency so I had to rebuild it (TL; DR: it worked last time I built it).

However, the installation now fails with error code 1603.

I have extracted the VS installation logs from the container and the main issue seems to be this:

Error Information
AppInsightsEvent Name = vs/setupengine/packagefailure
          Description = The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.
     TelemetrySession = 'aa0725d0-d978-4bf5-bd3c-8f68d3d9702f' Started = True OptIn=True IsInitialized = False Cloned = True
      WatsonEventType = VisualStudioNonFatalErrors2
             UTC time = 2024-09-26T12:17:52

I run an sfc /scannow inside brand new container using the image and it did find some corrupted files, so maybe the image itself has issues?

To Reproduce
You should be able to reproduce this by building the following Dockerfile (based on the example here, where you can also find the Install.cmd file contents):

# escape=`

# Use the Windows Server Core as base image
FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL ["cmd", "/S", "/C"]

COPY Install.cmd C:\TEMP\

ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe
ADD https://aka.ms/vs/17/release/channel C:\TEMP\VisualStudio.chman

RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
     && (call C:\TEMP\Install.cmd vs_buildtools.exe --quiet --wait --norestart --nocache install `
         --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
         --channelUri C:\TEMP\VisualStudio.chman `
         --installChannelUri C:\TEMP\VisualStudio.chman `
         --add Microsoft.VisualStudio.Workload.MSBuildTools `
         --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools `
         --add Microsoft.VisualStudio.Workload.VCTools `
         --add Microsoft.VisualStudio.Component.Windows11SDK.22000 `
         --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
         --add Microsoft.VisualStudio.Component.VC.ATLMFC) `
     && del /q vs_buildtools.exe

ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

Expected behavior
The image builds without issues.

Configuration:

  • Edition: Windows Server
  • Base Image being used: mcr.microsoft.com/windows/servercore:ltsc2019
  • Container engine: Docker
  • Container Engine version: 20.10.15
@zillemarco zillemarco added bug Something isn't working triage New and needs attention labels Sep 27, 2024
Copy link

Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.

@ntrappe-msft
Copy link
Contributor

@zillemarco Hey, thanks for bringing up this Issue. Have you tried to use a recent Windows Server Core LTSC 2022 image? Or only the 2019 version? I ask because we don't provide support for 2019 anymore.

@ntrappe-msft ntrappe-msft added Visual Studio Visual Studio + Visual Studio Code and removed triage New and needs attention labels Oct 2, 2024
@zillemarco
Copy link
Author

Hi @ntrappe-msft, I did not because I don't have any server running win2022 and docker, and it wouldn't be a solution anyway because the server the image I'm trying to build is running win2019 unfortunately.

I also tried installing other software in the image, just to make sure it wasn't only related to Visual Studio, but anything I try to install it fail.

Moreover, the last image for ltsc2019 was built and published less than a month ago, so isn't it still kinda supported?

@madduci
Copy link

madduci commented Nov 18, 2024

On a Windows LTSC 2022 Image, i receive this error:

docker/for-win#14425

Does anyone know how might resolve it?

@ntrappe-msft
Copy link
Contributor

ntrappe-msft commented Dec 9, 2024

On a Windows LTSC 2022 Image, i receive this error:

docker/for-win#14425

Does anyone know how might resolve it?

Hey there! Thanks for sharing the error details. The “not enough space on the disk” message often means that Docker’s storage location (typically on the C: drive by default) is running low on available space.

A few things you can try:

1. Check Available Disk Space:

Open File Explorer, go to “This PC” → “Local Disk (C:)” and verify the remaining free space. If it’s low or in the red, you’ll need to free up some space.

2. Increase VM Disk Size (If Applicable):

If you’re running inside a VM, open Hyper-V Manager, expand the size of the attached .vhdx file, then inside the guest OS, use Disk Management to extend the C drive partition. This can give Docker more breathing room.

3. Clean Up Docker Resources:

Run docker volume ls to see if you have old volumes that can be removed. Unused volumes can eat up a lot of space.
Check %localappdata%\Docker\wsl or your Docker storage location for leftover images or layers. Consider running docker system prune -a --volumes to remove dangling images, containers, and volumes (just be careful—you’ll lose anything that’s not currently in use).

4. Adjust Docker Storage Settings:

Since you mentioned you already tried setting the size=30G and increasing memory, double-check your Docker daemon config or explore the Docker docs for storage driver settings and ensure they’re applied correctly. You can also switch the drive Docker uses to store data if C drive isn't big enough.

Hopefully that helps.

@ntrappe-msft
Copy link
Contributor

@zillemarco When you try to build the image from the Dockerfile, is it failing on a specific line? Or it is dropping that error upon completion?

@ntrappe-msft ntrappe-msft self-assigned this Dec 9, 2024
@zillemarco
Copy link
Author

zillemarco commented Dec 10, 2024

@zillemarco When you try to build the image from the Dockerfile, is it failing on a specific line? Or it is dropping that error upon completion?

Hi @ntrappe-msft, it's not failing on any specific line of the Dockerfile unfortunately. It just quits after the vs_buildtools.exe installation fails, which fails with error code 1603.

I was able to try the same Dockerfile but on a Windows Server 2022 (obviously the docker base image was changed as well) and that worked, so it seems only relater to running the installed on the servercore:ltsc2019 image.

To be clear: I tested on WinServer 2022 just for the sake of making sure it worked there, we still can't deprecate WinServer 2019 unfortunately.


Update: I just noticed that a new image for ltsc2019 was released a few weeks ago and I just tested it, but it still doesn't work and the installer fails with error code 1603.

The image IDs I tested are:

  • e83f833ac0a1 (the one I originally tested and opened this issue for)
  • 6ebe876cb4c3 (the latest one, 5 weeks old, that still doesn't work)

@ericoporto
Copy link

@zillemarco hey, I am having the same issue base on a mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 image, did you find the fix for your issue?

@zillemarco
Copy link
Author

@zillemarco hey, I am having the same issue base on a mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 image, did you find the fix for your issue?

@ericoporto unfortunately no. We are still stuck at not being able to update some of our docker images due to this bug.

@ntrappe-msft do you have any updates on this? Looking back at your suggestions (#540 (comment)), I checked the available space on our server running docker build, and we are in fact running out of space on the OS disk (on the C drive), but docker is set up to use another one which has 700+ GB of available space so I don't think it's a space issue.

@zillemarco
Copy link
Author

For "fun" I tested another Dockerfile we used to generate a Docker image with VS2017 and, ... still the same error.

The windowsservercore-ltsc2019 image is broken.

@madduci
Copy link

madduci commented Jan 10, 2025

For me, the only solution is to clean the whole Docker System every time with

docker system prune

when building an image with Visual Studio

@zillemarco
Copy link
Author

@madduci thanks for the suggestion but it unfortunately did not work for me.

BTW, I also tried upgrading our docker and we are now running 27.4.1, but the issue still persists.

@sabinamiezah-msft
Copy link
Collaborator

sabinamiezah-msft commented Jan 16, 2025

Hi @zillemarco, I wonder if the following approach may help you, Try the following command in an admin level powershell prompt, this explicitly calls the curl command from the Dockerfile to install VS buildtools:

cmd /c "curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe"

@zillemarco
Copy link
Author

Hi @zillemarco, I wonder if the following approach may help you, Try the following command in an admin level powershell prompt, this explicitly calls the curl command from the Dockerfile to install VS buildtools:

cmd /c "curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe"

Hi @sabinamiezah-msft, just to clarify, how would you like me to run that command? Do you mean from inside a container running the ltsc2019 image?

And what's the output you'd be expecting? From inside the container I can't run the installer like that because there's no UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Visual Studio Visual Studio + Visual Studio Code
Projects
None yet
Development

No branches or pull requests

5 participants