tbhartman
tbhartman

Reputation: 1355

Cygwin commands from CMD are slow; from bash are fast

I have been using Cygwin commands from my Windows CMD prompt for several months without problems. Within the past few days, every time I call a Cygwin command (ls for example), the command takes several seconds to "load" before it actually runs. If I try the same command from within a bash prompt, it runs ("loads") immediately.

The Cygwin FAQ mentions that network drives in PATH may cause problems, so I've tried some permutations of my PATH variable and network connectivity. Below, "full PATH" means my original path setting; "short PATH" means the path with only the Cygwin bin directory. Times are reported through the time command.

Timing results for ls

Connected to network:

Disconnected from network:

Results for cygcheck

I ran cygcheck -s and noticed:

Warning: There are multiple cygwin1.dlls on your path

although this may be due to running cygcheck from within Cygwin's bin directory. I completely uninstalled and reinstalled Cygwin and still see the same issue.

Results from netstat

I ran netstat -a -n before executing Cygwin's ls and after execution (while it is stalled). I did this several times and found one line from each run that appeared consistently during the delay:

  UDP    127.0.0.1:55030        *:*                    

The port number changed from test to test.

strace results

I ran Cygwin's strace on the ls command. Most of the delay is spent in calls such as:

11685  886560 [main] ls 10020 pwdgrp::fetch_account_from_windows: line: <xxxx>

and

12684  899244 [main] ls 10020 cyg_ldap::fetch_ad_account: No entry for (objectSid=\00\00\00\00) in xxxx DC=xxxx,DC=xxxx,DC=xxxx

Upvotes: 15

Views: 5851

Answers (1)

tbhartman
tbhartman

Reputation: 1355

A section in Cygwin's FAQ addresses slow startup times. Cygwin recently changed to using Active Directory lookups for authentication, rather than using flat files. Changing the defaults in /etc/nsswitch.conf from

passwd:   files db
group:    files db

to

passwd:   files
group:    files

skips the AD lookup. My Cygwin commands are now speedy again.

Upvotes: 27

Related Questions