Start of any Cygwin application takes more than a minute on Windows 8.1 x64. It doesn't matter, either I'm starting mintty
from shortcut or cygwin.bat
or ls.exe
or bash.exe
from bin folder. Each of them will be slow.
After Bash or mintty is started they are working fairly quick:
$ time for i in {1..10} ; do bash -c "echo Hello" ; done Hello ... Hello real 0m1.273s user 0m0.060s sys 0m1.181s
Steps, which I've tried:
127.0.0.1 localhost cygdrive wpad
to hosts as in same reply /etc/bash_completion.d
folder)etc/profile.d
folderetc/bash.bashrc
fileHow else can I find root cause?
P.S. - I have two different systems, laptop and desktop both with Windows 8.1 64 bit. This issue it 100% reproducible on both.
Also, if I start Bash a few seconds after login it starts immediately.
Trim down your Windows PATH (to the bare bones like %SystemRoot%\system32;%SystemRoot%) Remove things you don't need from bashrc and bash_profile. Move things you only need in your terminal window from bashrc to bash_profile. One surprisingly large time suck in Cygwin is Bash completion.
Cygwin is excruciatingly slow to do any operation. Disabling the Avast shield makes Cygwin very fast.
Eventually I found what causes this issue, but I'm still not sure why. Cygwin works for other people in same environment very well.
Cause: On the start of every Cygwin application it tries to get credentials as it is described in etc/nsswitch.conf
file. For some reason, it takes a lots of time for my account as it contacts with several Active Directory domain controllers via LDAP.
Solution 1: You can save the current user and group in etc/passwd
and etc/group
files and set Cygwin to check them before Active Directory.
mintty.exe
and wait till it opensmkpasswd -c
and save its output to etc/passwd
file (you will have to create it, output should be one line)mkgroup -c
and save its output to etc/group
file (you will have to create it, output should be one line)etc/nsswitch.conf
and writensswitch.conf contents:
passwd: files # db group: files # db
Now your Cygwin should start immediately.
Solution 2: There is special CygServer application, shipped with Cygwin, which can be started as an NT service or as a simple process (just run usr/sbin/cygserver.exe
). It caches credentials and propagates them to every next Cygwin process while cygserver is running.
Add it to startup or start it before your Cygwin session and you're good — cygserver startup will take time, but every next Cygwin process will start immediately.
Is it your case? I want to share my investigation steps, so you could check, if your case is same to mine.
mintty
and you will see its connections in netmon: mintty
connections in the tree view on the left and TCP and LDAP frames on the right after selecting on of those connections.nbtstat -a 8.8.8.8
in command line (replace 8.8.8.8 by one of IP addresses from netmon).Going deeper: I'm still playing with etc/nsswitch.conf file to get local credentials or maybe cached ones so it will run faster without cygserver. But no luck yet.
Here's what worked for me.
Launch Cygwin terminal and then run the following two strings.
mkpasswd -c > /etc/passwd mkgroup -c > /etc/group
Edit your "/etc/nsswitch.conf" file to contain the following two lines.
passwd: files # db group: files # db
Relaunch Cygwin.
Cygwin opens quickly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With