Couldn’t reserve space for cygwin’s heap, Win32 error 0

Cygwin and Windows git stopped playing nicely together after a recent Windows update. There’s a variety of recommendations for how to fix this this on StackOverflow and elsewhere, but this post actually makes the most sense. In a nutshell, msys-1.0.dll (installed into your Program Files\Git\bin directory) is not built to be position independent. Use the dll rebaser to get it to load at a new address, like so:

$ rebase.exe -b 0x50000000 msys-1.0.dll

And voila, git goodness restored.

Cygwin SSH just doesn’t call $HOME lately…

With the new version of Cygwin, SSH suddenly doesn’t seem to phone $HOME anymore.  Which is usually going to be set to something like c:\Users\<username>.  In general Cygwin is supposed to look at $HOME first and then use alternative home settings, such as /etc/passwd.

The quick fix is to make sure the relevant entry in /etc/passwd matches what you have in $HOME.

Cygwin More

Everytime I install Cygwin I find myself rooting around for the “more” command. It’s been removed in favor of “less”, however I prefer “more”. It’s more or less (ha! Linux humor!) a simpler pager.

Install the util-linux package for a random collection of older utilities, including “more” and “whereis”.

Remote Desktop over SSH

For a simple and free (and fairly standard!) way to secure your remote desktop sessions — and without having to figure out the crazy, proprietary Microsoft security stuff — take a look at copSSH. copSSH uses a streamlined Cygwin client to setup an SSH sever on your Windows box.

I’ve recently been using copSSH and PuTTY‘s Pageant authentication agent to tunnel RDP through PuTTY/copSSH SSH connections. Works like a charm.

One gotcha: copSSH doesn’t clean-up after itself well. Consider running taskkill from time-to-time.

C:\WINDOWS\Taskkill /F /IM bash.exe /T

Or if you prefer bashing:

$ kill -9 ps | grep ^I.*bash$ | cut -c2-9

Accrue more than 64 zombied PTYs and you’ll find yourself locked out of the server.