-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Errors when running "Git Bash" until it's run as administrator #1449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
These file operations should have been performed as part of the installation, as last step. Did you see the installer "hang"? |
No, the installer did not appear to hang. Once I answered all of the pre-install questions, it displayed a progress bar while extracting files, etc., and then displayed the final page which gave me the option to run Git Bash and/or display the release notes. |
@kraai does this happen even after reinstalling? If so, could you reinstall using the installer option |
Obviously this will work only when run with /LOG=<file>, but it is better than what we have currently. While at it, we now also detect the presence of the post-install.log file correctly, and fix the bug hidden by the erroneous check where we were fooled by a non-zero exit code: post-install.bat deletes itself, so it will *always* have a non-zero exit code. But if it deletes itself successfully, we know it actually succeeded. This patch was written in response to git-for-windows/git#1449 Signed-off-by: Johannes Schindelin <[email protected]>
Right. The |
@dscho No problem. I ran the v2.16.1-post-install-test installer. Here is the log it generated: I think this is the relevant section:
|
Yes, this is the relevant section. It also shows that This is the relevant part in # Create it if necessary
if [ ! -e "${DEVDIR}/shm" ]
then
mkdir -m 1777 "${DEVDIR}/shm"
if [ ! -e "${DEVDIR}/shm" ]
then
echo
echo "Creating ${DEVDIR}/shm directory failed."
echo "POSIX semaphores and POSIX shared memory will not work"
echo
fi
else
chmod 1777 "${DEVDIR}/shm"
fi As you can see, it fails to create the directory for the POSIX semaphores (not sure what uses it, but I could imagine that our OpenSSH as well as our Perl does). So I think that a valid work-around would be to teach the installer to create that directory already... as well as the Are you up for some fun and easy contribution to the Git for Windows project? |
@dscho I'm having trouble installing the SDK. Once I get it installed, I'll try to fix this issue. |
@kraai I think the SDK does not currently work as expected, mostly because BinTray (which we use to host our Pacman packages, a decision I dearly regret now) has blocked services "due to overuse". In the mean-time, you may get unblocked by using https://github.com/git-for-windows/git-sdk-64. I did not get around to define the
You will also want to check out
You can then start the Git SDK Bash using |
@dscho I was able to install the SDK and modify the installer so that it created
I discovered that was able to eliminate all of these errors by running the official release's installer with elevated privileges. I'm not sure what to do. |
So your installer does not elevate automatically? I.e. you do not get that prompt where you are asked whether you are sure you want to run this .exe as administrator? |
@dscho When I double-click on the installer in Windows Explorer, it displays the following dialog: Once I select a reason and enter my password, the installer runs and the error messages appear when I run Git Bash. If I right-click on the installer in Windows Explorer and select "Run with Elevated Privileges", it displays a similar dialog, but once I finish the installation, Git Bash doesn't display the errors. I think this dialog is coming from Avecto Defendpoint. |
Hmm. That's too bad. Apparently, there is something going on where this software allows sort of a "kind of elevated" operation? The best idea I could come up: teach the installer to detect that the post-install script did not, in fact, create, say, the What do you think? |
I've experienced a very similar problem today after updating Git to version 2.24.0.windows.2 via Chocolatey. After the update I would get 4 erros messages on opening Bash, all of them regarding the impossibility to delete some In many years of running Git on Win10 via Chocolatey this was the first time I experienced the problem. Luckily, it was easy to solve. |
Any idea why those files could not be deleted? Maybe an overzealous malware scanning them? |
Unfortunately, I hadn't expanded the log in Chocolatey GUI during the installation, and closed the app after, so I didn't have a change to get the details.
I only use Win 10's native defender; but since they were very small script files I doubt it would be due to long scanning times. One thing I did notice is that there was an update to the Chocolatey Core package, which I carried out after the Git update, although it would have been better to do that one first. But even after the Choco core update trying to reinstall Git for Windows didn't solve the problem. I think that it has something to do with Chocolatey, for it run with admin privileges and this could be the reason why the files couldn't be deleted automatically by Bash at startup. As I said, in many years it only happened once, and since the error reported by Bash was exhaustive it was easy to fix. Still, it would be good to know why this happens from time to time. If it happens again I'll try to keep a detailed log and post it here. |
The problem showed again after updating to git version 2.24.1.windows.2 (via Chocolatey):
Again, nothing serious, just had to manually delete contents of the Do you think that this could lead to problems in Git workings? I've no idea why this creeped in at some point (being using the same Git package for ages, just updating it). Any other users experiencing this? |
@tajmone those files should have been removed as part of the silent install that Chocolatey performs... Strange that they have not been removed... |
Any suggestions to pin point the cause and remove the problem? |
@tajmone I have seen a few reports of the initial Bash run (that is part of the installation) hanging and failing to complete, but there is hardly any useful breadcrumb as to the underlying reason, let alone anything conclusive. |
If the problem boils down to having do delete these files manually, then it's no big deal (also, it doesn't happen at very update, only sometimes, which is weird). My only worry is if there's an underlying wrong-permissions issue that might affect other aspects of Git functionality on Windows. So far I didn't encounter any, but I work mostly with a proprietary Git GUI, and use the Bash version only for certain file and repo info operations. |
FYI: Had same problem while launching the "Git Bash" from the Windows 10 Start Menu icon; opens in home directory. Came to this post looking for answers. Somehow cleared the issue while trying various workarounds.
With my environment now fixed I can not repeat the process, and not 100% sure if running the Explorer launch of the bash shell is what allowed for completion of needed tasks that are generating the warnings/errors being discussed here. Perhaps someone can more carefully try to reproduce this result?
This fix would imply some differences in the Start Menu shortcut versus Explorer shell menu shortcut that is thwarting the proper post install script execution. Once the task completes successfully fixes it everywhere? |
This was still present for me in 2.26.2, updating to 2.27.0 (via choco GUI) did not change it. The mentioned workaround did. Uninstalling and reinstalling 2.27.0 did not reintroduce the issue despite e.g. Is it possible new installs don't suffer from this? Update: I just installed 2.27.0 via Choco GUI on an otherwise fresh Win10 installation and did not encounter the issue. |
Interesting observations @hmccsGitHub, thanks for the tips. I was experiencing this problem through a custom invocation of Bash from an alternative tool to FIle Explorer (Altap Salamander, similar to Total Commander), which invokes the Bash at the current folder. I must try your fix. I was convinced it had to do with the permissions settings of the folder containing the temp files to be deleted (because when I try to fix this problem, after each update, I always get asked for elevated confirmation). I hope all these feedback can help pin-point the problem, so that both current user of this package can see it solved as well as new installers not having to face it. |
Totally possible. It could be a left-over |
Update on @hmccsGitHub's solution — after my previous Chocolatey update for Git I tried the solution proposed by @hmccsGitHub, which worked ... until the next Git update! after updating, the problem came back again: when opening Bash, it can't delete the temporary files. So it seems that the error is persistent, and that it has to do with folders permissions which are preventing the deletion of those temporary files. So, right now, the only quick way to fix the problem after each update seems to be opening the Bash with admin privileges once, which allows the deletion of the temp files — but this is a bit of nagger, and it would be nice to find a way to solve the problem once and for all for those who find themselves in this situation. Maybe a PowerShell script that fixes the permissions on these folders? I personally don't like to fiddle with folders permissions (especially since the Windows preferences to handle them are packed with options and sub-dialogues, which make it easy to mess up things badly), so I'd feel better if there was an officially endorsed script to fix the problem. I still wonder how the problem came into being, and how many users might be affected by this. Also, would it be possible to delete the culprit folders to solve the problem? i.e. hoping that Git will recreate them, this time using the right permissions (unless Chocolatey is causing the permissions problem due to its process being executed with admin privileges). |
I was also getting this error so, I uninstalled Git and re-installed it and it fixed the problem. Try if that's works for you. |
Closing this as stale. |
Setup
defaults?
to the issue you're seeing?
Not that I can think of.
Details
Bash.
Minimal, Complete, and Verifiable example
this will help us understand the issue.
I expected no errors to be displayed before the first prompt.
The following errors were displayed before the first prompt:
URL to that repository to help us with testing?
The problem does not occur with a specific repository.
I found these errors mentioned in #1326, but that issue appears to be related to creating an installer, not with a problem with the official installer. I wasn't able to find post-install.log anywhere on my system. %TEMP% did not contain any subdirectory starting with "is".
The text was updated successfully, but these errors were encountered: