Sometimes, after updating or installing packages, you'll start to get strange errors related to "fork()" or .dll loading. These errors are usually solved by rebasing your packages.
Installing Required PackagesEdit
To rebase, you first need to install two packages:
- dash (or ash)
Stop Running ServicesEdit
Now that you have the packages you need, you'll need to make sure no cygwin-based services are running (including X11, SSH, etc). If you don't feel up to figuring out how to stop every running Cygwin service, restarting your computer in safe-mode might be an effective hack.
Now that no Cygwin services are running, you can rebase your packages. Open a Windows command prompt (by going to the "Run" menu and entering "cmd"). Once there, type or right-click and paste the following commands. Be patient, this'll take a minute:
\cygwin\bin\dash -c '/usr/bin/rebaseall' exit exit
Under Windows 7 (and possibly Vista), the above may not be able to rebase everything due to permissions. So instead, go to C:\cygwin\bin, and via right-click run the file dash.exe as Administrator, and then at the dash command prompt, type the following commands:
/usr/bin/rebaseall -v exit
Rebasing all your packages will take a few minutes but should resolve the forking errors. Unfortunately, this seems to be machine-specific and can't be done by Cygwin's upstream.
If you want to execute this in an BATCH installation script, you can use:
C:\cygwin\bin\dash.exe -c '/usr/bin/rebaseall -v'
- Note that the need to rebase is in many cases due to incompatible software that messes with Cygwin: see http://cygwin.com/faq/faq.html#faq.using.bloda So, unless you disable/uninstall such software, the fork issues may continue to reoccur after you rebaseall.
- If you run into "rebaseall failed with last error 13", look at the permissions of the file where the error occured. There are two common causes for this error - one is that something is holding an open file handle for the problematic file, and the other is the filesystem has the file marked as "read-only". Unfortunately, the error handling code in rebaseimage (the program that's called by rebaseall to do the dirty work) can't distinguish between these two cases. Worse, rebaseimage works at a very low level in the filesystem interface code, and correctly and transparently recovering from the read-only file case is almost unbelievably complicated.
- In other words, you should fix the file's permissions (turn off "read-only" to allow writing) and run the rebase command again.
Is there any way of indicating how important this tip is, as it cures what appears to be a total cygwin crash?
rebaseall exist to work around limitations in DLL memory management in 32 bit Windows. A 64 bit port of Cygwin should not have these problems. Now, if only someone were working on a 64 bit port...