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
As an alternative method you may also try under Windows 7 going to C:\cygwin\bin, and via right-click running 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'
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...
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?