Startup is really slow for all Cygwin applications

前端 未结 4 2018
执笔经年
执笔经年 2021-01-29 22:55

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

相关标签:
4条回答
  • 2021-01-29 22:57

    Here's what worked for me.

    1. Launch Cygwin terminal and then run the following two strings.

      mkpasswd -c > /etc/passwd
      mkgroup -c > /etc/group
      
    2. Edit your "/etc/nsswitch.conf" file to contain the following two lines.

      passwd:   files # db
      group:    files # db
      
    3. Relaunch Cygwin.

    Cygwin opens quickly.

    0 讨论(0)
  • 2021-01-29 23:08

    If you are on a network with a large AD directory mkpasswd will take a lot of time (several days in my case). So consider using:

    mkpasswd -c -l > /etc/passwd
    mkgroup -c -l > /etc/group
    
     -l,--local [machine]    Print local user accounts of \"machine\",
                             from local machine if no machine specified.
                             Automatically adding machine prefix for local
                             machine depends on settings in /etc/nsswitch.conf.
    
    0 讨论(0)
  • 2021-01-29 23:09

    Adding 'C:\cygwin64\bin' to the path worked for me.

    0 讨论(0)
  • 2021-01-29 23:19

    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.

    1. Start mintty.exe and wait till it opens
    2. Run mkpasswd -c and save its output to etc/passwd file (you will have to create it, output should be one line)
    3. Run mkgroup -c and save its output to etc/group file (you will have to create it, output should be one line)
    4. Open etc/nsswitch.conf and write

    nsswitch.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.

    • Install MS Network Monitor as it is able to show traffic from a specific process. Run it as administrator.
    • Create New capture tab and click Start (you don't have to add any filters or anything).
    • Start mintty and you will see its connections in netmon: netmon-screenshot
    • You will see list of mintty connections in the tree view on the left and TCP and LDAP frames on the right after selecting on of those connections.
    • Additionally, you can get name of those remote machines by IP address. Run 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.

    0 讨论(0)
提交回复
热议问题