Cygwin window closes immediately

Solution 1:

I had the same issue after updating my Cygwin installation on Windows 7. The problem wasn't the update itself but the activation of the cygserver service. If you have any Cygwin service installed in your Windows machine try solving the problem by setting these services to either manual start or automatic start but delayed.

The problem is that the service 'cygserver' will cache account information and provide it to other Cygwin applications and services like described in https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-caching. The account data is retrieved from Microsoft LDAP service which needs more time to start than the cygserver service. Setting the cygserver service to delayed automatic start will resolve this problem. But keep in mind that the start of the cygserver service may delayed a couple of minutes after (re)boot of Windows.

Hope this helps :-)

Solution 2:

To expand on Izzet Beltir's answer, you can simply restart the service if you want to get Cygwin working immediately:

  1. Open a command line or PowerShell window - with elevated privileges (Run As Administrator)

  2. Run these commands:

    net stop cygserver
    net start cygserver
    

    (for earlier versions of Cygwin the service name may be cygservice rather than cygserver.)

You should now be able to open a Cygwin terminal just fine.

Solution 3:

for the issue of
Unknown+User@DESKTOP-6SQ80GV

you need to read
https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch

as cygwin seems currently unable to recover from SSID your user profile. As W10 is recent, may be something in your configuration has not yet been considered, so best place for extra support is the main mailing list:
https://www.cygwin.com/cygwin/lists.html
https://www.cygwin.com/ml/cygwin/