67

I recently reinstalled Cygwin on my computer in order to get access to several command line elements that I was missing. I have never had previous difficulty with Cygwin, but after this reinstallation, an error message continues to appear after (almost) each command entered. For instance:

-bash-4.1$ wc m1.txt
      3 [main] bash 2216 child_info_fork::abort: data segment start: parent(0x26D000) !=     child(0x38D000)
-bash: fork: retry: Resource temporarily unavailable
2013930  4027950 74968256 m1.txt

Generally, the command still runs (as seen above), but not always. Occasionally, the 'error' message occurs several times in a row (the initial number "3" will then change to a "4" or "2", notably if I start a second Cygwin window.

Also, as soon as I start up Cygwin, I get the following message before the prompt:

      3 [main] bash 6140 child_info_fork::abort: data segment start: parent(0x26D000)     != child(0x36D000)
-bash: fork: retry: Resource temporarily unavailable
-bash: fork: Resource temporarily unavailable
-bash-4.1$

At the moment, I am debating whether to uninstall/reinstall Cygwin again or just live with the error messages, but I was curious if there might be an issue that I am unaware of.

CinCout
  • 9,486
  • 12
  • 49
  • 67
David C
  • 7,204
  • 5
  • 46
  • 65
  • 2
    I found some similar problem [here](http://www.mail-archive.com/cygwin@cygwin.com/msg120549.html) Do yo have and protection software/antivirus installed? If so, did you try to disable it just for test, or even uninstall (see the link). Also take a look [here](http://cygwin.wikia.com/wiki/Rebaseall) and [here](http://superuser.com/questions/231590/running-rebaseall-on-cygwin) – rkosegi Feb 16 '12 at 06:41

13 Answers13

121

(assuming Cygwin is installed at C:\Cygwin):

  1. Open Task Manager and close any processes that look to be Cygwin related.
  2. Open C:\Cygwin\bin in Windows Explorer
  3. Verify that dash.exe, ash.exe, rebase.exe, and rebaseall exist in this folder
    • If any of them are missing, re-run Cygwin setup and select the dash, ash, and rebase packages
  4. right-click your C:\Cygwin folder, uncheck Read-only (if its checked), and press OK.
    • When an error about not being able to switch some files comes up, select "Ignore All". Wait for this process to complete.
  5. Browse to C:\Cygwin\bin in Windows Explorer
  6. Right click dash.exe and click "Run as Administrator". A command Prompt should appear with nothing but a $
  7. Type /usr/bin/rebaseall -v, hit enter, and wait for the process to complete.
    • If you get errors about Cygwin processes running, try Step 1 again. If that still doesn't work, Restart your computer into safe mode and try these steps again.
    • A commenter noted that, depending on your settings, you may have to type cd /usr/bin && ./rebaseall -v instead.
  8. Try opening Cygwin again.

This process worked for me. I hope it works for you guys too.

Source: http://cygwin.wikia.com/wiki/Rebaseall

Cody S
  • 4,744
  • 8
  • 33
  • 64
  • 4
    Awesome. In step 7, because of PATH, I had to enter the directory first: cd /usr/bin` and `./rebaseall -v`. – jjmontes Feb 17 '16 at 13:24
  • 1
    While running rebaseall it still shows me the same fork error. – Sujoy Jun 28 '16 at 16:00
  • If you get errors about Cygwin processes running, you can go to `C:\Cygwin\bin`using windows `cdm` or `powershell` then run `bash.exe /usr/bin/rebaseall -v`. It will launch `bash.exe` and then execute the command **without** oppening another term. – Kruupös Jul 01 '17 at 16:26
  • Had this problem when running cygwin as administrator. Step '4' above fixed it. – Aelian Nov 29 '18 at 21:15
13

I would like to add the following to the above answers, as it is what I had to do after reinstalling Cygwin:

Navigate to the "/usr/bin" directory (usually, C:\cygwin\bin) and right click, Run as Administrator the file: dash.exe Then, at the $ prompt type the following, hitting enter after each line:

cd /usr/bin/
/usr/bin/peflags * -d 1
/usr/bin/rebaseall -v

What it does is, it marks the dll's as "rebase-able," and then rebases them. You have to have peflags.exe in addition to the above files (in previous answers). You may have to restart windows after doing this and you will definitely need to make sure that there are no processes nor services belonging to cygwin running. (Use task manager, kill any related processes, and then under the services tab look for any service starting with CYG and stop it.)

After doing this, I was able to get cygwin to run without any errors about dll's being loaded to the wrong addresses aka fork errors, etc.

I hope that this helps others, as it was a pain to find.

SOURCE: http://www.cygwin.com/faq.html#faq.using.fixing-fork-failures 
and the rebase README file.
CherryCoke
  • 309
  • 3
  • 17
  • I cannot run any command, so this won't work for me. Nevermind which executable I try to execute, I always get the same error – Sebi2020 Dec 23 '21 at 14:35
  • @Sebi2020 Then your environment is messed up. Reinstall Cygwin. The first clue is that you cannot run any command, meaning that either you are not in the environment, or the permissions for the command executables are incorrect. Have you tried 'chmod' to make them executable? (Usually, chmod +x [filename], when ran from the /usr/bin/ directory.) – CherryCoke Jul 05 '22 at 00:51
5

To add on to other answers here, we ran into the same issue but could not run the rebase command from the ash or dash shell. However, when launching the command from the Windows cmd shell, the following worked.

cmd /c "C:\cygwin64\bin\ash.exe /usr/rebaseall -v"

-v is to get verbose output

timato
  • 184
  • 2
  • 12
3

I solved this problem by restarting my computer. Probably installed a driver update and kept using sleep instead of shutting down.

Matt Bond
  • 1,402
  • 12
  • 19
  • I am using babun and i faced problem two times already and followed accepted answer but nothing changes and both times, there was a windows update waiting for restart to apply. restarting my pc solved the problem. – cnu Jul 13 '23 at 03:02
3

I found another information here : http://cygwin.com/ml/cygwin/2014-02/msg00531.html You have to delete the database at /etc/rebase.db* and do in a "ash" windows : peflags * -d 1 rebaseall It works for me on 2 servers.

Charly
  • 31
  • 1
1

Experienced the same issue when loading Cygwin with cygiconv-2.dll forking and not loading successfully in the Cygwin terminal, but after turning off my AntiVirus (it was specifically Ad-aware), the issue resolved, and Cygwin worked properly.

1

In case you are using babun's Cygwin, after rebaseall, try launching Cygwin by executing .babun\cygwin\cygwin.bat in a Windows command prompt or Windows explorer.

This works for me (while launching babun's default console - mintty results in fork error).

songuke
  • 189
  • 1
  • 6
0

I had the error on win10 and i was trying to rebase to c: before install. then i saw that the installer was installing it instead to c:/Users/myuser so i was coping all files from c:/Users/myuser to c:.badun and then restart plus open badun.bat

not shure if this was wise its now duplicated XD... but then it worked again.

0

Rebaseing didn't help in my case. In addition to what other people suggested, I noticed that reducing the length of PATH environment variable fixed the issue for me (and for other people as well as can be seen from this answer).

yugr
  • 19,769
  • 3
  • 51
  • 96
0

This issue is intermittent in nature & I found this issue when there is network is too slow to connect to remote machine on AWS.... I have Shell script that runs through Gitbash shell & it connects to AWS EC2 instance with ssh..... Most of the time, it ran correctly but 2 out 100 times it get into this issue bash: fork: retry: Resource temporarily unavailable .... Killing the MSYS2 terminal from task manager helps to overcome with this issue.... Negative side is you need to run the scripts from the beginning...

Abhishek Jain
  • 3,815
  • 2
  • 26
  • 26
0

I had the same issue on Windows 10 and the mobaxterm app (which uses cygwin) and I tried all of answers listed here however for me, the solution was to simply delete the "CryptoPro CSP" application.

Skully
  • 2,882
  • 3
  • 20
  • 31
kostap
  • 23
  • 8
-1

I started facing this problem after upgrading to windows 10. As of now I do not see that any of the above method working.
What I am noticing is that if you start cygwin with admin right (right click and say "run as admin") then it works fine.
Or you open cmd as administrator and then launch cygwin from there, then also it runs fine.

peeyush
  • 2,841
  • 3
  • 24
  • 43
-3

Just reinstall cygwin and select TCL and activate EXPECT