msys2 / msys2-installer

The one-click installer for MSYS2
BSD 3-Clause "New" or "Revised" License
612 stars 88 forks source link

Install or extract do not finish in docker, with mcr.microsoft.com/windows/servercore:2009-amd64 #58

Open greenkalx opened 2 years ago

greenkalx commented 2 years ago

Both installer and tarball fail to fully install in docker.

The installer does extract partially, but is missing bash.exe and pacman.exe For the installer, I am running:

Invoke-WebRequest https://github.com/msys2/msys2-installer/releases/download/2022-01-18/msys2-base-x86_64-20220118.sfx.exe -Outfile C:\tools\msys-setup.exe;
Start-Process "C:\tools\msys-setup.exe" -ArgumentList "-y -oC:\ " -Wait

The tarball extracts more, including bash.exe but is missing pacman.exe. For the tarball, I am running:

Invoke-WebRequest http://repo.msys2.org/distrib/msys2-x86_64-latest.tar.xz -Outfile C:\tools\msys2.tar.xz
Start-process "7z" -ArgumentList "e C:\tools\msys2.tar.xz -oC:\tools " -NoNewWindow -Wait
Start-process "7z" -ArgumentList "x C:\tools\msys2.tar -oC:\ " -NoNewWindow -Wait

I have tried running docker 'build' and docker 'run':

docker build --memory 2GB --isolation process --build-arg BASE_TAG=$BASE_TAG --tag $TAG $COMPOSE_DIR

docker run -it --memory 2GB --isolation process docker-virtual.artifactory.york.lan/windows/servercore:2009-amd64 powershell

Wonder if it's due to permissions or antivirus (Carbon Black or Endpoint Protector).

I have tried other installers:

https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.sfx.exe
https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-x86_64-latest.exe

And other tarballs:

https://github.com/msys2/msys2-installer/releases/download/nightly-x86_64/msys2-base-x86_64-latest.tar.xz 

This was running for us with previous Windows versions, 1809-amd64 and 1909-amd64.

greenkalx commented 2 years ago

These other installers are working in the same Docker container: vs_buildtools.exe, winsdksetup.exe, 7z2107-x64.exe, PortableGit-2.27.0-64-bit.7z.exe, python-3.7.8-embed-amd64.zip, cmake-3.18.0-win64-x64.zip, nasm-2.15.03-win64.zip, v1.10.0/ninja-win.zip, strawberry-perl-5.28.2.1-64bit-portable.zip

I will post to MSYS2-packages as well, as I see more 'docker' traffic there.

lazka commented 2 years ago

This repo installs the sfx one every day in docker and tests it at least.

https://github.com/msys2/msys2-installer/actions/runs/3606759674

lazka commented 2 years ago

Can you give the Dockerfile we use in CI a try? https://github.com/msys2/msys2-installer/blob/e3ead38d71e4a760eb78068f00d30331b957bb7b/.ci/Dockerfile.2019

greenkalx commented 2 years ago

I tried with the flags from that Dockerfile,

$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'

But it still only partially installs, it's missing C:\msys64\usr\bin\bash.exe and pacman.exe etc.

PS C:\> Invoke-WebRequest https://github.com/msys2/msys2-installer/releases/download/2022-01-18/msys2-base-x86_64-20220118.sfx.exe -Outfile C:\msys2.exe;
PS C:\> $ErrorActionPreference = 'Stop'
PS C:\> $ProgressPreference = 'SilentlyContinue'

PS C:\> \msys2.exe -y -oC:\

7-Zip SFX 21.03 ZS v1.5.0 R2 (x64) : Copyright (c) 1999-2021 Igor Pavlov, 2016-2021 Tino Reichardt : 2021-10-05

Extracting archive: C:\msys2.exe
--
Path = C:\msys2.exe
Type = 7z

  5% 1946 - msys64\usr\lib\terminfo\61\adm22
lazka commented 1 year ago

Since the above works here and in CI and the extraction isn't really MSYS2 specific I'm out of ideas.

greenkalx commented 1 year ago

I ran the setup without 'Start-Process' and got an exit code:

PS C:\> ./msys2.exe -y -oC:\
7-Zip SFX 21.03 ZS v1.5.0 R2 (x64) : Copyright (c) 1999-2021 Igor Pavlov, 2016-2021 Tino Reichardt : 2021-10-05
Extracting archive: C:\msys2.exe
--
Path = C:\msys2.exe
Type = 7z
  5% 1908 - msys64\usr\lib\terminfo\61\aaa-48-rv
PS C:\> $LastExitCode
-1073741819
greenkalx commented 1 year ago

I think it's working now, by excluding '--isolation process' from the docker run. Need to see my full process working..

relapids commented 1 year ago

Same thing started happening to me yesterday with no changes on my end (been working for months up until now). Was definitely working two days ago since I have a script to force-rebuild my image daily. I see this on multiple machines and OS versions.

Tried both isolation modes (hyperv and process) and neither are currently working for me. One slight difference to the original reporter is that I'm using servercore:ltsc2022.

Still trying to diagnose further but unfortunately it's difficult to get diagnostic information from Windows containers for these sorts of issues. Trying to investigate using the information here: https://learn.microsoft.com/en-us/virtualization/windowscontainers/troubleshooting

EDIT:

Actually, I think I may have misunderstood the original issue in this thread and conflated it with mine. In my case the processes all appear to run successfully and terminate normally, but then the RUN step never finishes and just hangs indefinitely when finalizing the layer. I'm guessing this is probably a distinct issue and I misclassified it as the same as the one here due to the timing.

Strange though that it's happening on multiple machines and seems to coincide with the latest installer release. I tried rolling back to an earlier installer but that didn't help. Likely because whatever is causing the issue gets updated to the same version as in the latest installer anyway, but that's just a guess on my part so far - I need to do additional testing.

lazka commented 1 year ago

@relapids please open a new issue (and just copy what you posted here)