Windows docker container stops executing certain executables - windows

I have a Windows docker container (servercore) running on Windows, which works as expected. My entrypoint in docker executes a variety of commands in a row. At some point certain executables stop working and return with no output. Is there any chance to debug Docker or find out what is causing this behaviour? Example:
PS C:\tools> .\unzip.exe
PS C:\tools>
I tried executing windbg, but no success. I tried the powershell to access the event log, but I can't think of any proper way to tackle down this problem without having certain UI tools like Process Monitor (which also doesn't work) on cmd although it should (see below):
PS C:\tools> .\Procmon.exe /AcceptEula /Quiet /Minimized /BackingFile c:\temp\log.pml
PS C:\tools>
Python on the other hand works totally fine:
PS C:\tools> .\python.exe --version
Python 3.7.4
Update: The exit code of the applications which don't work is STATUS_DLL_INIT_FAILED (What does ExitCode -1073741502 mean?)
There came another question in today with a similar question and problem: How to start PowerShell (x86) in Windows Docker Container?

I was facing a very similar issue when suddenly MSBuild stopped working and returned exit code -1073741502 (aka 0xC0000142 / STATUS_DLL_INIT_FAILED).
Although probably not a satisfying answer, but at least a summary of the present state:
Windows Server 1909 (OS Build 18363.592) - January 28, 2020 - KB4532695 - works
Windows Server 1909 (OS Build 18363.657) - February 11, 2020 - KB4532693 - does not work
Windows Server 1909 (OS Build 18363.693) - February 27, 2020 - KB4535996 - does not work

Related

How to enter Windows-Subsystem-for-Linux (ubuntu) from PowerShell at the current PowerShell working dir

When running the command bash or ubuntu in PowerShell, the Windows-Subsystem-for-Linux is entered, however, the current working dir for PowerShell is not carried across to BASH. Is there a way to implement this functionality?
From your Windows Powershell or Powershell Core window, type bash (or wsl); for example:
Now, later versions of Windows include WSL.exe, which replaces bash.exe. The behavior of both executable is the same on my system. The official documentation for wsl.exe states:
You can read that documentation here. Net-net,
I'm running Windows 10 Build-17763. If you aren't experiencing the same behavior I am, you might be running an older version of WSL. You can determine the version of WSL from your build number.

trouble debugging error with exit code 3221225781 (missing libraries) in windows docker container

i'm trying to run a docker container on Windows 10 which should execute a windows executable (myprogram.exe). Below you find my dockerfile:
FROM microsoft/windowsservercore
COPY mydir/myprogram.exe /mydir/
CMD ["/mydir/myprogram.exe","someparameter"]
So i build the image with:
docker image build --tag myimage .
and run the container with:
docker run myimage
Unfortunately if I check the status of the container with:
docker ps -a I can see that the container has exited with
exit code 3221225781
, which seems to point to a missing dll.
To debug the problem I run the command:
docker run -it --name debug microsoft/windowsservercore cmd, stopped the container and copied the windows executable in the container file system :
docker cp myprogram.exe debug:c:/myprogram.exe
Now I start the container again using docker start -i debug and enter myprogram.exe myparameter. Unfortunately the program exits immediately (usually it runs about 30 sec) without any output, error code ...
My only explanation for this behavior is that if some cmd program is missing some dll's the corresponding error message is not included in the STDERR but rather in a message dialog. Apparently docker doesn't support this feature???
So what is the best was to solve this problem. Using dependency walker to go through all dll's needed is possible but would take some time and I'm looking for some more elegant solution.
You need to install Visual C++ redistributable.
Download the appropriate version of vc_redist.x64.exe and place it in the folder containing your Dockerfile
Edit your Dockerfile so you preinstall VC++ redistributables when you build your image by adding:
FROM mcr.microsoft.com/windows/sservercore
WORKDIR c:\mydir
COPY "vc_redist.x64.exe" .
RUN vc_redist.x64.exe /install /passive /norestart /log out.txt
COPY mydir/myprogram.exe c:\mydir
CMD ["c:\mydir\myprogram.exe","someparameter"]
Your application should run now.
Note: you need 64-bit build of VC++ redistributable and the appropriate version. You can find some download urls here
This is quite an open-ended question, so it is not possible to give precise answer. Here are a few thoughts:
This is your program that is missing a dependency. Presumably, you as the program author should be aware of what dependencies are required. You need to make sure to include them in your docker image, when you build it.
You are creating your image based on Windows Core, which does not have the whole slew of UI components. This looks like the most obvious thing that could go wrong, given the symptoms. So what I would do is try and make sure that your program can run on Windows Core in principle. Which brings me to the next point.
The most practical way to troubleshoot, in my opinion, is to remove Docker from the equation. You want to run your program on Windows Core. So setup a machine (physical or VM) with Windows Core inside and try to run your program there. There is a good chance that it won't run with the same symptoms. If that's the case, you now have reduced complexity, because you know that your problem has nothing to do with docker (or not).
Finally, when you have your Windows Core machine up and running, you might be able to see a message box pop up with the error immediately (even on Core you can run some programs with UI can run, and message boxes are not an uncommon site), and failing that you can run sysinternals procmon/procexp even on Windows Core, so using those to locate missing dependencies could help. There is also Dependencies.
Note: by "Windows Core" in this answer I mean Core option of Windows Server

Windows 10 - Bash (WSL) | How to run Atom build on bash?

I got a lot of problems when I try to run commands on Atom to "bash.exe".
Step by step
Enable "Bash Ubuntu" for Windows 10.
Setup compiler for my application on "Bash Ubuntu".
Test from "bash.exe" and "powershell.exe". Everything work ok.
Install Atom.
Create an runner on Atom.
Get msg "Erro: 0x80070057"
Possible Solutions
Disable Legacy Mode on Powershell (github.com/Microsoft/BashOnWindows/issues/7)
Use Powershell ISE (github.com/Microsoft/BashOnWindows/issues/430)
I've tried both links above, but nothing works.
Here is my Atom error and my Powershell working:
Atom IDE with Runner
Powershell with same command
Any idea? Thanks
As one of Atom developers said at GitHub issue:
"We support building Atom on Windows using our native Windows environment only. There is no support and no plans to support compiling the Linux version of Atom on Windows using WSL."
You can check at: https://github.com/atom/atom/issues/13774#issuecomment-278741701

CouchDB crashes on Windows 2008 R2 Standard with os_mon error

I am trying to install CouchDB on a Windows 2008 R2 standard version server and it starts the couchdb service running but I am unable to access the couchdb url. And below is the error:
Erlang R15B (erts—5.9) [source] [smp:16:16] [async—threads:0]
Eshell V5.9 (abort with ^G)
1} ("init terminating in do_boot",{{badmatch,(error,{{app_would_not_start,os_mon
}, couch_app.start,[normal,["../etc/couchdb/default.ini","../etc/couchdb/local.i
ni"]]}}}},[{couch,start,0,[{file,"d:/relax/couchdb/src/couchdb/couch.erl"},{line
,18}]},{init,start_it,1,[{file,"init.erl"},{1ine,1041}]},{init,start_em,1,[{fi1e
,"init.erl"},{line.1022}]}]}}
Crash dump was written to: er]_crash.dump
init terminating in do_boot {}
Abnormal termination
When tried on Windows 7 the same installer works fine. Please help on how to fix the issue as it has to run on the Windows 2008 R2 Standard server machine.
First thing to check is if CouchDB starts from a command prompt, without running the service. The installer leaves an icon on the start menu for this, or you can try c:\couchdb\bin\couchdb.bat as well. I recommend installing to a filename without spaces just to ensure Windows is happy.
BTW you don't say what version/release of CouchDB this is, nor where you got it; R15B is not included in the recent official builds. I'd recommend the latest official release from http://couchdb.apache.org/#downloads which uses R16B02 and seeing how you get on.

Node.js - tutorials on getting it to work with Cygwin on a Vista machine

All,
Am trying to get Node.js to work on Vista machine.
I installed Cygwin (as per the Github instructions) which appears to have been installed correctly. However, none of the commands are executing.
Are there any tutorials for the stages after the Cygwin installation?
PROBLEM: When any command is executed, I get 'Bash: command not found' error.
Not even command like 'c:\cygwin\bin' is executing.
When I type 'user' in cygwin command prompt, I get 'ntvdm has encountered an system error. Parameter incorrect'.
I thought the above error may be due to the firewall, disabling the firewall did not have any effect, running the program with admin rights also did not change the results...
Am confused and would love to get some guidance on what steps to go with next on getting Node.js up and running on a Windows Vista machine.
Many thanks,
UPDATE1:
We managed to make a bit more progress. It appears that we had not installed all the relevant files related to Cygwin. Upon re-download and reinstalled, it ran well, however, we have driven into another error. Error we get:
How to compile/install node.js(could not configure a cxx compiler!) (Ubuntu).
We followed the instructions as per the above thread (3rd post from top for Windows machines), however, we are still stuck at the same error.
Any guidance please?
Have you tried just using the Windows self contained binaries? http://node-js.prcn.co.cc/ This way you actually don't need to bother with Cygwin.
At first, i tried it your way too, using Cygwin. After smashing my head for the 10th time against a wall i just stopped trying and found a much cleaner solution.
I'm using VirtualBox running a Debain guest system to locally develop on my Windows 7 machine. Using VirtualBox, you can easily set up shared folders or port forwarding for node apps between your Windows machine and your Debian guest system.
Since you are using a plain Linux-system, all the compiling-pain is blown away.
If you plan to run node.js in production on a windows system: don't. I hardly believe node.js will be ever stable enough on windows-based systems using MINGW/Cygwin...
People seem to run into problems with Cygwin because they think that they are using a Windows machine.
If you install Cygwin, and open a bash shell prompt using the Cygwin icon, you are now in a UNIX environment and everything works the same as it would on UNIX. That includes building node.js.
I think you added some info to the question and I can see your problem. Yes, normally on Cygwin it has been possible to build node.js just as you would on any UNIX system, but that is no longer possible on Windows 7. Before running ./configure you have to:
Close all cygwin apps.
Double-click on C:\Cygwin\bin\ash.exe
Run ./rebaseall and when it completes, run ./perlrebase.
exit from the ash shell window.
At this point Cygwin will be back to normal and you can ./configure and make install.

Resources