Category Archives: Uncategorized

Docker for Windows – Port Reservations

I work a lot in the airport Common Use (CUTE / CUPPS / CUSS) world. As such, one of the applications I work with a lot is ARINC’s PCP / PCPNET (now Rockwell Collins). For the past several years I’ve had this service running in my local dev environment to support my own product development built on top of ARINC’s platform (along with several other CUTE / CUPPS providers) and it has “just worked”. As recently as last night I was doing development in my home office and started my local ARINC PCPNET environment with no problems.

This afternoon I tried to fire up my ARINC PCPNET and I noticed the service took a really long time to start and I couldn’t connect to my ATB / BTP printers. Upon investigating the error logs in C:\Logs\Pcpnet\PcpNetCom.Log I noticed a new error:

Problem occurred while listening on port 50005
...
An attempt was made to access a socket in a way forbidden by its access permissions

“Well that’s new”, I thought to myself. My first instinct was that somehow some the ports that I use for PCPNET were being used by another application. So the first thing I did was check for ports in use:

netstat -aon | find "50005"

But that showed that the port was not being used.

Ok. So what did I change this morning that might have affected things. Well this morning I installed Docker for Windows. At first that didn’t seem like it could cause any problems, but doing a bit of digging around led me to the following command:

netsh int ipv4 show excludedportrange protocol=tcp

Which gave me a listing like the following:

That’s interesting. A series of port ranges have been reserved, of which my required ports (ARINC defaults to 50001 and up (typically a maximum of 6 – 10 ports for peripherals) fall right in the middle. And better yet, after each reboot, the port ranges above 49000 all seem to “shift” up or down by 20 or so.

To be fair, this is not really a docker issue. My investigation has pointed back to Hyper-V. Docker for Windows requires Hyper-V be installed before you install Docker for Windows. During my investigation I uninstalled Docker, then removed Hyper-V and the port reservations above 49000 all went away. I then re-enabled Hyper-V on my Win10 Pro machine and the 49000+ port reservations all came back, even before I reinstalled Docker.

So how do we solve this? In theory we should be able to delete a port reservation range with something like the following:

netsh int ipv4 delete excludedportrange protocol=tcp startport=50000 numberofports=50

and then add our own port reservation range with something like the following:

netsh int ipv4 add excludedportrange protocol=tcp startport=50000 numberofports=50

Unfortunately this didn’t work, returning an error indicating we couldn’t make the change.

In the end, we have two possible solutions (there may be others, but this is what I found in my limited time to debug):

  1. Change the port that ARINC PCPNET is using. This can be done in the registry by changing the “Client IP Port” entry for the devices to a value not in the reserved ranges. Restarting the PCP32 or PCPNET services should then use the new ports.
  2. Uninstall Docker and Hyper-V (via the Windows Features tool), reboot, reserve our range using the command listed above, then re-installing Hyper-V and Docker. After doing this Hyper-V is smart enough to start it’s own reserved ranges “around” our pre-reserved ranges (notice in the image below the range from 50000 – 500049 is protected:

PCPNet can now happily start with it’s preferred port range.

MSSQL 2017 Installer Fails: VS Shell installation has failed with exit code 1638

Installing MSSQL 2017 Developer Edition on my relatively clean development VM today I was getting an error part way through the installation:

Error installing Microsoft Visual C++ 2015 Redistributable
VS Shell installation has failed with exit code 1638.

The installer then continued, but at the end I was told that the Database Engine and a couple of other components were not installed correctly.

I tried downloading a newer MSSQL installer, but that still didn’t work.

I tried installing the Microsoft Visual C++ 2013 Redistributable (per several suggestions from others).  That made no difference.

In the end it boiled down to the fact that I already had Visual Studio 2017 installed and that had installed the Microsoft Visual C++ 2017 Redistributable.  I ended up having to remove the Microsoft Visual C++ 2017 Redistributable component using Windows Add/Remove Programs (being sure to uninstall both the x86 and x64 versions).

After a reboot for good measure, the MSSQL 2017 installer ran fine.

I then went back and re-installed the Microsoft Visual C++ 2017 Redistributable x86 and x64 components using the following links:

  • https://download.microsoft.com/download/1/f/e/1febbdb2-aded-4e14-9063-39fb17e88444/vc_redist.x86.exe
  • https://download.microsoft.com/download/3/b/f/3bf6e759-c555-4595-8973-86b7b4312927/vc_redist.x64.exe

And fired up Visual Studio 2017.

GIT Error “Please tell me who you are” in SourceTree

I recently received this error when trying to commit a local GIT repository in SourceTree:

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'username@MACHINENAME.(none)')

This was weird as I had already used the indicated commands to set my commit options.  Running “git config –global -l” in a Git Bash shell (I am running on Windows 10) resulted in the following:

$ git config --global -l
user.name=My Name
user.email="myemail@sixthimpulse.com"
branch.autosetuprebase=always
pull.rebase=true
rebase.autostash=true

After a bit of searching online, I discovered one possible problem was my email address.  Notice the quotation marks around the email address.  When I configured my email address I used the following:

git config --global user.email "myemail@sixthimpulse.com"

All the examples showed the quotation marks.  Instead, I should have left them off like the following:

git config --global user.email myemail@sixthimpulse.com

Now my global GIT config looks like this:

$ git config --global -l
user.name=My Name
user.email=myemail@sixthimpulse.com
branch.autosetuprebase=always
pull.rebase=true
rebase.autostash=true

Unfortunately, that still didn’t work.

A bit more digging and I noticed that when I opened a Terminal window from inside SourceTree and tried to set my user.name, like so:

git config --global user.name "My Name"

I  got an error back:

error: could not lock config file C:/WINDOWS/system32/config/systemprofile/.gitconfig: Permission denied

From there it was pretty simple to deduce that I needed to run SourceTree as an administrator and then I was able to commit just fine.

Not sure how this got changed, but at least I can commit now.