windows cygwin 更新导致“错误:无法分叉子进程:资源暂时不可用。”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36399041/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cygwin update cause "Error: could not fork child process: Resource temporarily unavailable."
提问by Charbel
I updated my cygwin using the setup-x86_64.exetool (version 2.873) on Windows 7. I needed to install some additional packages (mostly zip/unzip etc).
我在 Windows 7 上使用setup-x86_64.exe工具(版本2.873)更新了我的 cygwin 。我需要安装一些额外的包(主要是 zip/unzip 等)。
Since then, I am getting the following errors when I try to run the Cygwin Terminal (the shortcut points to C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -):
从那时起,当我尝试运行 Cygwin 终端时出现以下错误(快捷方式指向 C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -):
Error: could not fork child process: Resource temporarily unavailable.
DLL rebasing may be required. See 'rebaseall / rebase --help'.
I searched online how to run the rebaseall command they advise in the message. Essentially the recommendation was to start cygwin/bin/dash.exe and run:bin/rebaseall
I did that a few times, I also used the -v comment, and no errors come back. Still I can't start cygwin.
我在网上搜索了如何运行他们在消息中建议的 rebaseall 命令。基本上建议是启动 cygwin/bin/dash.exe 并运行:bin/rebaseall
我这样做了几次,我也使用了 -v 注释,没有错误返回。我仍然无法启动cygwin。
I also tried running cygwin-x/XWin-server nothing happens.
我也试过运行 cygwin-x/XWin-server 没有任何反应。
I looked at the setup logs in cygwin/var/log/setup.log
I can't see any error.
我查看了设置日志,cygwin/var/log/setup.log
我看不到任何错误。
I tried to run the setup program a few more times reinstalling some of the packages I already had, that didn't help neither. Any ideas how can I get that to work?
我试图再运行几次安装程序,重新安装我已经拥有的一些软件包,这也无济于事。任何想法我怎样才能让它发挥作用?
回答by Svend Hansen
One of my colleagues has similar errors when openening the terminal from SourceTree (Mingw32), and also got errors when trying to pull
, rebase
, etc (anything not local). He solved it by uninstalling Sourcetree, using CCleaner to clean his registries (not sure if this was required), rebooted and installed Sourcetree again.
openening从SourceTree(MINGW32)终端时,我的一个同事也有类似的错误,并试图在也得到了错误pull
,rebase
等(没有任何地方)。他通过卸载 Sourcetree 解决了这个问题,使用 CCleaner 清理他的注册表(不确定是否需要这样做),重新启动并再次安装 Sourcetree。
I know this is slightly different from the problem described by the OP, but it might still be solvable by un/re-installing and cleaning of registries, and this might also help future people finding this question with the Sourcetree issue (like I did).
我知道这与 OP 描述的问题略有不同,但它仍然可以通过取消/重新安装和清理注册表来解决,这也可能有助于未来的人们通过 Sourcetree 问题找到这个问题(就像我一样) .
Edit:Another colleague had the issue as well, and he managed to fix it merely with a restart without any un/re-installation or using CCleaner.
编辑:另一位同事也遇到了这个问题,他仅通过重新启动就解决了这个问题,而没有任何卸载/重新安装或使用 CCleaner。
回答by Gabriel Bercea
Here is the fix.
这是修复。
- Go to you Windows Defender Security Center settings
- Click on App & Browser Control
- At the bottom click on the "Exploit Protection Settings" link
- Go to "Program Settings" and click on the "Add program to customize" -> "Choose exact file path"
- Navigate to "C:\Program Files\Git\usr\bin\sh.exe" and add it
- Override and turn off the following: Mandatory ASLR, Randomize memory allocations (Bottom-up ASLR)
- Click "Apply" and now everything should work fine.
- 转到您的 Windows Defender 安全中心设置
- 单击应用程序和浏览器控制
- 在底部单击“漏洞利用保护设置”链接
- 转到“程序设置”,然后单击“添加要自定义的程序”->“选择确切的文件路径”
- 导航到“C:\Program Files\Git\usr\bin\sh.exe”并添加它
- 覆盖并关闭以下内容:强制 ASLR、随机内存分配(自下而上 ASLR)
- 单击“应用”,现在一切正常。
Also add these other binaries from the same folder: expr.exe, uname.exe, grep.exe, rm.exe
还要从同一文件夹中添加这些其他二进制文件:expr.exe、uname.exe、grep.exe、rm.exe
Good luck,
Gabriel
祝你好运,
加布里埃尔
回答by gavenkoa
From https://chromium.googlesource.com/chromium/src/+/master/docs/cygwin_dll_remapping_failure.md
来自https://chromium.googlesource.com/chromium/src/+/master/docs/cygwin_dll_remapping_failure.md
Handling repeated failures of rebaseall to allow cygwin remaps
处理 rebaseall 的重复失败以允许 cygwin 重新映射
Sometimes DLLs over which cygwin has no control get mapped into cygwin processes at locations that cygwin has chosen for its libraries. This has been seen primarily with anti-virus DLLs. When this occurs, cygwin must be instructed during the rebase to avoid the area of memory where that DLL is mapped.
有时 cygwin 无法控制的 DLL 会在 cygwin 为其库选择的位置映射到 cygwin 进程。这主要是在防病毒 DLL 中看到的。发生这种情况时,必须在 rebase 期间指示 cygwin 避开映射该 DLL 的内存区域。
Background
背景
Some background for this is available on http://www.dont-panic.cc/capi/2007/10/29/git-svn-fails-with-fatal-error-unable-to-remap/
这方面的一些背景可以在http://www.dont-panic.cc/capi/2007/10/29/git-svn-fails-with-fatal-error-unable-to-remap/上 找到
Because of unix fork semantics (presumably), cygwin libraries must be mapped in the same location in both parent and child of a fork. All cygwin libraries have hints in them as to where they should be mapped in a processes address space; if those hints are followed, each library will be mapped in the same location in both address spaces. However, Windows is perfectly happy mapping a DLL anywhere in the address space; the hint is not considered controlling. The remapping error occurs when a cygwin process starts and one of its libraries cannot be mapped to the location specified by its hint.
由于 unix fork 语义(大概),cygwin 库必须映射到 fork 的父级和子级的相同位置。所有 cygwin 库中都有关于它们应该映射到进程地址空间中的位置的提示;如果遵循这些提示,每个库将被映射到两个地址空间中的相同位置。但是,Windows 非常乐意将 DLL 映射到地址空间中的任何位置。提示不被视为控制。当 cygwin 进程启动并且其库之一无法映射到其提示指定的位置时,会发生重新映射错误。
/usr/bin/rebaseall changes the DLL hints for all of the cygwin libraries so that there are no inter-library conflicts; it does this by choosing a contiguous but not overlapping library layout starting at a base address and working down. This process makes sure there are no intra-cygwin conflicts, but cannot deal with conflicts with external DLLs that are in cygwin process address spaces (e.g. anti-virus DLLs).
/usr/bin/rebaseall 更改了所有 cygwin 库的 DLL 提示,以便不存在库间冲突;它通过选择从基地址开始并向下工作的连续但不重叠的库布局来实现这一点。此过程确保没有 cygwin 内部冲突,但无法处理与 cygwin 进程地址空间中的外部 DLL(例如防病毒 DLL)的冲突。
To handle this case, you need to figure out what the problematic non-cygwin library is, where it is in the address space, and do the rebase all so that no cygwin hints map libraries to that location.
要处理这种情况,您需要弄清楚有问题的非 cygwin 库是什么,它在地址空间中的位置,并执行所有变基,以便没有 cygwin 将映射库提示到该位置。
Details
细节
- Download the ListDLLs executable from sysinternals
- Run it as administrator while some cygwin commands are running.
- Scan the output for the cygwin process (identifiable by the command) and for DLLs in that process that do not look like cygwin DLLs (like an AV). Note the location of those libraries (there will usually only be the one).
- Pick an address space location lower than its starting address.
- Quit all cygwin processes.
- Run a windows command shell as administrator
- cd in \cygwin\bin
- Run
ash /usr/bin/rebaseall -b <base address>
(This command can also take a-v
flag if you want to see the DLL layout.)
- 从sysinternals下载 ListDLLs 可执行文件
- 在运行某些 cygwin 命令时以管理员身份运行它。
- 扫描 cygwin 进程(可通过命令识别)和该进程中看起来不像 cygwin DLL(如 AV)的 DLL 的输出。请注意这些库的位置(通常只有一个)。
- 选择一个低于其起始地址的地址空间位置。
- 退出所有 cygwin 进程。
- 以管理员身份运行 Windows 命令外壳
- cd 在 \cygwin\bin
- 运行
ash /usr/bin/rebaseall -b <base address>
(-v
如果您想查看 DLL 布局,此命令也可以带一个 标志。)
That should fix the problem.
那应该可以解决问题。
Failed rebaseall
失败 rebaseall
If you pick a base address that is too low, you may end up with a broken cygwin install. You can reinstall it by running cygwin's setup.exe again, and on the package selection page, clicking the "All" entry to Reinstall. You may have to do this twice, as you may get errors on the first reinstall pass.
如果您选择的基地址太低,则最终可能会导致 cygwin 安装损坏。您可以通过再次运行 cygwin 的 setup.exe 重新安装它,并在包选择页面上,单击“全部”条目重新安装。您可能必须执行此操作两次,因为您可能会在第一次重新安装时遇到错误。
回答by Ed Randall
I've been suffering similar problems a lot recently. I've been unable to determine the cause, whether it's due to a recent Windows7 patch or an update in the latest cygwin. I'm in a tightly controlled corporate environment with only limited elevated rights, a lot of anti-malware and encrypted drives. I'm using 32-bit Cygwin at present.
我最近经常遇到类似的问题。我一直无法确定原因,无论是由于最近的 Windows7 补丁还是最新的 cygwin 中的更新。我在一个严格控制的公司环境中,只有有限的提升权限、大量的反恶意软件和加密驱动器。我目前使用的是 32 位 Cygwin。
Issues for me began after I installed Git and Git-Svn packages, which required Perl and upgraded various other Cygwin packages as well.
在我安装 Git 和 Git-Svn 包之后,我的问题就开始了,这需要 Perl 并升级了各种其他 Cygwin 包。
Rebasing using rebase-trigger or rebaseall did not solve the issue for me. Neither did re-installing and setup repeatedly raised errors in the post-install pahse when trying to do the rebase itself.
使用 rebase-trigger 或 rebaseall 重新定位并没有解决我的问题。在尝试执行 rebase 本身时,重新安装和设置也没有在安装后阶段反复引发错误。
My first success was by downgrading Perl to the previous version, ie. down to 5.22.1.2 from 5.22.2.1. After a couple of weeks the error returned, perhaps after a compulsory windows update and reboot.
我的第一个成功是将 Perl 降级到以前的版本,即。从 5.22.2.1 降至 5.22.1.2。几周后,错误又回来了,可能是在强制 Windows 更新和重新启动之后。
My latest success has been achieved by ignoring the dash/rebaseall script and running rebase.exe directly as follows:-
我最近的成功是通过忽略 dash/rebaseall 脚本并直接运行 rebase.exe 实现的,如下所示:-
- Create a file which lists all cygwin .dlls in the /bin directory except cygwin1.dll and cyglsa.dll ie.
$ cd /bin $ ls -1 *.dll | egrep -v '(cygwin1|cyglsa).*\.dll' >rebasedlls.txt
- Close all cygwin terminals, if you have any services running which use cygwin ensure that those are stopped also. Check TaskManager and kill processes if necessary.
- Open a cmd.exe window (it may help to use whatever elevated rights you can muster), change to the windows path of your cygwin /bin directory (ie. the windows directory of
cygpath -wa /bin
). - Use rebase.exe directly to find the base address of the cygwin1.dll file:
- 创建一个文件,列出 /bin 目录中除 cygwin1.dll 和 cyglsa.dll 之外的所有 cygwin .dll,即。
$ cd /bin $ ls -1 *.dll | egrep -v '(cygwin1|cyglsa).*\.dll' >rebasedlls.txt
- 关闭所有 cygwin 终端,如果您有任何使用 cygwin 的服务正在运行,请确保这些服务也已停止。检查 TaskManager 并在必要时终止进程。
- 打开一个 cmd.exe 窗口(使用您可以召集的任何提升的权限可能会有所帮助),切换到 cygwin /bin 目录的 windows 路径(即 的 windows 目录
cygpath -wa /bin
)。 - 直接使用rebase.exe查找cygwin1.dll文件的基地址:
C:\apps\cygwin\bin> rebase.exe --info cygwin1.dll
/usr/bin/cygwin1.dll base 0x61000000 size 0x00500000
C:\apps\cygwin\bin> rebase.exe --info cygwin1.dll
/usr/bin/cygwin1.dll base 0x61000000 size 0x00500000
- Using that base address and the size as a guide I chose the next whole value up as my rebase base address, 0x62000000. No particular reason for this, just a hunch. (The rebaseall script uses 0x70000000).
- Use rebase.exe to fix all the .dlls listed in the file from step (1):
- 使用该基地址和大小作为指导,我选择了下一个完整的值作为我的变基基地址0x62000000。没有特别的原因,只是一种预感。(rebaseall 脚本使用 0x70000000)。
- 使用 rebase.exe 修复步骤 (1) 中文件中列出的所有 .dll:
C:\apps\cygwin\bin> rebase -b 0x62000000 -4 -n -v -t -T rebasedlls.txt
C:\apps\cygwin\bin> rebase -b 0x62000000 -4 -n -v -t -T rebasedlls.txt
So far, so good, my Cygwin is back to a working state again.
到目前为止,很好,我的 Cygwin 又回到了工作状态。
回答by fxleyu
uninstall it, and install the software for 32-bit.
卸载它,然后安装 32 位软件。
回答by matzeri
There is a rebase utility that triggers the rebase as post-setup phase.
有一个 rebase 实用程序可以在安装后阶段触发 rebase。
From dash or bash:
从破折号或bash:
/usr/bin/rebase-trigger full
close all process and run again setup-x86_64.exe.
关闭所有进程并再次运行 setup-x86_64.exe。
回答by Mladen
I restarted 3 times, and then it was fine. wtf Windows 7
我重启了3次,然后就好了。WTF 视窗 7
回答by philwalk
This exact same error message has various causes, not all of them related to setup-x86_64.exe, although I have seen it in that context as well. But if rebaseall didn't fix your problem, here's a suggestion that might work.
这条完全相同的错误消息有多种原因,并非所有原因都与 setup-x86_64.exe 相关,尽管我也曾在该上下文中看到过。但是如果 rebaseall 没有解决您的问题,这里有一个可能有用的建议。
In the case I saw this morning, it turned out to have been caused by having a couple of processes that continued to run after I exited the mintty terminal emulator. My hunch is that these zombie processes prevent the console from being recycled. In my case, the two processes were determined experimentally, by reviewing a list of running processes for stray processes that are no longer needed. I found the two processes that were blocking me by reviewing the list of running tasks.
在我今天早上看到的情况下,结果证明是由于在我退出 mintty 终端模拟器后有几个进程继续运行造成的。我的预感是这些僵尸进程会阻止控制台被回收。就我而言,这两个进程是通过查看不再需要的杂散进程的正在运行的进程列表来通过实验确定的。通过查看正在运行的任务列表,我发现了阻止我的两个进程。
C:\WINDOWS\system32>tasklist | grep Console
CobraWinLDTP.exe 31844 Console 1 43,600 K
geckodriver.exe 52640 Console 1 32,164 K
C:\WINDOWS\system32>taskkill /F /PID 31844
SUCCESS: The process with PID 31844 has been terminated.
C:\WINDOWS\system32>taskkill /F /PID 52640
SUCCESS: The process with PID 52640 has been terminated.
I saw on some other stackoverflow questions that git is often the zombie process that causes this symptom (for some users). Unfortunately, any residual process that survives after your console session is closed can cause this problem, so you have to experiment.
我在其他一些 stackoverflow 问题上看到,git 通常是导致此症状的僵尸进程(对于某些用户而言)。不幸的是,在您的控制台会话关闭后仍然存在的任何残留进程都可能导致此问题,因此您必须进行试验。
回答by Ronak Patel
- Go to The Task manager
- Kill 'Git for Windows' process
- Reopen your git bash
- 转到任务管理器
- 杀死“Git for Windows”进程
- 重新打开你的 git bash
It seems that all is working fine.
似乎一切正常。
NOTE: In case you don't find 'Git for Windows' process and still have to face the same just kill 'Node.js: Server-side JavaScript' process instead
注意:如果您没有找到“Git for Windows”进程并且仍然必须面对同样的问题,只需杀死“Node.js: Server-side JavaScript”进程即可
回答by Happyblue
I have Administrator access to my PC. For me the solution to this was to run the Cygwin session as Administrator -- right the icon, run as administrator, as shown here:
我有我的 PC 的管理员访问权限。对我来说,解决方案是以管理员身份运行 Cygwin 会话——右键图标,以管理员身份运行,如下所示:
After running as Administrator the first time, new Cygwin sessions started up without hassle.
第一次以管理员身份运行后,新的 Cygwin 会话可以轻松启动。