Exit code 127 in cygwin64

6,646

Solution 1

It looks like clear was the culprit. I diagnosed this by trying to run it with its full path:

$ /usr/bin/clear
$ echo $?
127

I then looked inside /usr/bin and found that clear was somehow missing altogether. So, using cygwin's GUI setup, I forced a fresh reinstall of ncurses, the package which contains clear, and everything seems to be in working order now.

It stands to reason that vim and emacs both make use of clear, hence the problems cascaded to those programs, too.

Solution 2

The exact same thing happened to me after I did a cygwin update, vim won't start, code 127. Adding clear.exe did nothing.

strace vim +q gave sigalstack could not be located in the dll cygwin1.dll The kind folks at the cygwin mailing list said my update probably did not complete becuase i did not close all my cygwin processes. Indeed I had sshd and cygrunsrv going, I killed those, and reinstalled cygwin base (go into setup and manually select reinstall cygwin base) this fixed everything. Good luck friends

Solution 3

For anyone that arrives here from Google - I had an experience where programs were exiting with error code 127 on Cygwin (gcc in particular).

The problem turned out to be I installed into a path with a space in it.

If you install using the GUI, it warns you about this. I installed from the command line and no such warning stopped me from doing the install.

Share:
6,646

Related videos on Youtube

Tim Parenti
Author by

Tim Parenti

About me, huh? Well, I don't like creating a ton of different profiles because I never remember to update them all. So I'll defer this section to https://www.timparenti.com/me/.

Updated on September 18, 2022

Comments

  • Tim Parenti
    Tim Parenti over 1 year

    After years without problems, suddenly several programs in my installation of cygwin64 on 64-bit Windows 7 Professional are failing to run, and instead appear to exit immediately with code 127, which usually means "command not found" in Bash. In particular, programs like vim, emacs, and even clear exhibit this behavior, while others like vi, echo, touch, and date seem to operate normally.

    At first, I figured something might have gone wrong with a previous round of package updates, so I ran another update using cygwin setup's command-line interface, but it didn't seem to help.

    From what I can tell, the affected programs don't work at all. Not even --version flags to the program work, which makes me think that there may be something wrong with cygwin itself or a common dependency:

    $ vim --version
    $ echo $?
    127
    

    (I can provide specific version numbers for various packages if it will help, but since this problem existed both before and after the most recent updates, I doubt it matters much.)

    I double-checked my PATH variable, and it begins with /usr/local/bin:/usr/bin:, as expected. Is there perhaps some new dependency in these programs that isn't being properly resolved by cygwin's package manager or which may not have been automatically added to my PATH?

    Am I missing something else obvious?

    • Kevin Versfeld
      Kevin Versfeld over 9 years
      Did you check your PATH variable?
    • Tim Parenti
      Tim Parenti over 9 years
      @mdpc: Yes, I should have mentioned that. It is 2096 bytes long, and begins with /usr/local/bin and /usr/bin, as expected.
  • Sc0ttyD
    Sc0ttyD over 6 years
    This worked for me after ssh stopped working. Thanks