-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Installation Error: Unable to set system config #2384
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
Basically the same issue as this person had: SuperUser - Reinstalling Git on Windows |
Do you see the same issue with the installer from https://github.com/git-for-windows/git/releases/tag/v2.24.0-rc2.windows.1 i.e. with the latest pre-release (I don't)? |
Yea I just tried it and it's exactly the same. It seems to be installing everything fine, except the files that go in /Git/mingw64/etc like .gitattributes and .gitconfig I can make them manually. But... that doesn't really solve the problem. I updated my son's computer with the official release without issue. Updating mine presents this issue. It's like it doesn't have permission to write those files. |
@dscho Is there a log for installation that i can get and share that will show more of what is happening and whether there is a permissions error and why? |
Might not be related but Cannot read/write system config seems a bit applicable. Because when I go to C:\ProgramData\Git there is a config file there... literally named |
Hmpf. In that StackOverflow post (which I don't monitor for bug reports, as we have a fine bug tracker right here), it suggests that maybe there is an inaccessible |
No, i don't know what the C:.config is about. That comment seems completely out of no where. I only reference the SO post to show that someone else had the issue and some more screen shots of it. |
after installing, and clicking through all the errors, if i open git-bash and type and it's right, there isn't one there, and it's always previously been installed at So then I did It's all very confusing. A brand new installation of 2.23 on a freshly installed computer installed the system config in the |
I think the |
I think it'd be helpful in those error messages if it also said the path of the file it was trying to access to narrow down where it's looking for the file... and then maybe why that file wasn't or couldn't be created. |
I tried installing Git.2.22.0-64 and it gave me the same error. However, when I ran git-bash.exe and entered But when I did the same thing with 2.23 or 2.24, it said as I previously stated. |
Yes, that changed in v2.24.0, and is probably a red herring in this context. |
Understood. So what can I do to help track down the issue? |
@gaetawoo I hope we can get to the bottom of this. The first two things we need to figure out:
To answer the first question, please run the installer again, and when that first error message appears, open an Explorer and look for that folder. To answer the second question, I think it would be enough to run Process Monitor while the installation is running, ideally only accumulating events while the installer is running, right until the error message is shown. There should be something informative in the logs (you can use the Ctrl+F keyboard shortcut to search the logs, I think, and I would look for |
Yes, it does exist before the error is shown and during and after.
I ran Process Monitor and filtered it so only the Git install related events were saved. I've uploaded them to a Drive folder and you can access it here: https://drive.google.com/open?id=1oB62_IT0NtFuDEwUW7h3yt1MnaW8Qg-b In that folder you can find a native Process Monitor formatted log (so you'd need Process Monitor to view it) and the csv version of the same log. I did search by '--system' and the results are interesting. You can see where it's trying to write certain keys to the config file, you can see where it writes out to the .err file "specified path not found" and a few other NAME NOT FOUND errors... Most are towards the end, fyi. I can't see a specific reason why there is an issue but maybe you can. |
In that log, I cannot really see where there was the break in the time line that would reflect a message box being shown... Could you try to see whether there is anything interesting in the files that should have been written by the invocation (e.g. |
Here is a link to a fresh set of event logs: I also included the files that were in the temp directory during the error messages. This is a symbolic link too but of course that doesn't upload. During the install, I was watching the event log in Process Monitor live, and I saw it accessing the Temp directory and writing to files. I went to that directory, inspected the files (permissions, content) and nothing seemed strange except that nothing was getting written into I also waited longer between error message modals so you should be able to see that now. In this case the directory was I hope this helps some how. I really wish I could understand why it's not writing to the .out file. |
Puzzling, very, very puzzling. First of all, as much as I tried, I could not find any trace of the spawned That those The error message "The system cannot find the path specified." is another puzzle. It typically means that Besides, there is a At first I thought that maybe
But then, the Yet more puzzling is that the second But maybe both calls actually failed, with "The system cannot find the path specified"? For the moment, I am out of ideas, except maybe that some overzealous anti-malware might interfere (because that |
I just saw this upgrading to Git 2.24.0.2. The only thing strange about my system compared to previous installs is that I still had a modified "C:\Program Files\Git\mingw64\bin\gitk" and a copy of the old version at "C:\Program Files\Git\mingw64\bin\gitk-bak" from testing the fix for #2390 I noticed that at the end I was prompted to restart my computer -- I don't recall git prompting me to do that after an upgrade before. |
Possibly related, I still had gitk open in notepad++. |
I might have still had one of the directories open in explorer as well. After the reboot git --version showed the .2 update. |
In the csv, line 187177 has the following entry: Is that what you mean or do you mean something else? On line 187267 i see: On line 187265 i see: Line 187278 has: I have no anti-malware other than Windows Defender with is part of the OS. I could try installing with that disabled. But... that'd be crazy if that was the issue. |
I meant something else: this shows only an event from the process that spawned the At this point, I think the only way forward is for you to build a custom installer that tries to call the command "manually", and then play with variations of it to figure out what is going on. Clone https://github.com/git-for-windows/build-extra and then compile with [Setup]
AppName=CmdTest
AppVersion=0.0
WizardStyle=modern
DefaultDirName=C:\My Program
PrivilegesRequired=lowest
#define MINGW_BITNESS 64
[Code]
procedure LogError(Msg:string);
begin
MsgBox(Msg,mbError,MB_OK);
Log(Msg);
end;
var
AppDir:String;
function ShellQuote(Value:String):String;
begin
// Sadly, we cannot use the '\'' trick used throughout Git's
// source code, as InnoSetup quotes those in a way that
// git.exe does not understand them.
//
// So we try to imitate quote_arg_msvc() in Git's
// compat/mingw.c instead: \ => \\, followed by " => \",
// then surround with double quotes.
StringChangeEx(Value,#92,#92+#92,True);
StringChangeEx(Value,#34,#92+#34,True);
Result:=#34+Value+#34;
end;
function ReadFileAsString(Path:String):String;
var
Contents:AnsiString;
begin
if not LoadStringFromFile(Path,Contents) then
Result:='(no output)'
else
Result:=Contents;
if (Length(Result)>0) and (Result[Length(Result)]=#10) then
SetLength(Result,Length(Result)-1);
if (Length(Result)>0) and (Result[Length(Result)]=#13) then
SetLength(Result,Length(Result)-1);
end;
function GitSystemConfigSet(Key,Value:String):Boolean;
var
i:Integer;
OutPath,ErrPath:String;
begin
OutPath:=ExpandConstant('{tmp}\config-set.out');
ErrPath:=ExpandConstant('{tmp}\config-set.err');
if (Value=#0) then begin
if Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config --system --unset '+Key+' >'+#34+OutPath+#34+' 2>'+#34+ErrPath+#34,
AppDir,SW_HIDE,ewWaitUntilTerminated,i) And ((i=0) Or (i=5)) then
// exit code 5 means it was already unset, so that's okay
Result:=True
else begin
LogError('Unable to unset system config "'+Key+'": exit code '+IntToStr(i)+#10+#13+ReadFileAsString(OutPath)+#10+#13+'stderr:'+#10+#13+ReadFileAsString(ErrPath));
Result:=False
end
end else if Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config --system '+ShellQuote(Key)+' '+ShellQuote(Value)+' >'+#34+OutPath+#34+' 2>'+#34+ErrPath+#34,
AppDir,SW_HIDE,ewWaitUntilTerminated,i) And (i=0) then
Result:=True
else begin
LogError('Unable to set system config "'+Key+'":="'+Value+'": exit code '+IntToStr(i)+#10+#13+ReadFileAsString(OutPath)+#10+#13+'stderr:'+#10+#13+ReadFileAsString(ErrPath));
Result:=False;
end;
end;
function InitializeSetup(): Boolean;
begin
AppDir:='C:\Program Files\Git';
if GitSystemConfigSet('cmdtest','success') then
MsgBox('Could set the system config correctly.',mbInformation,MB_OK)
else
MsgBox('Failed to set `cmdtest` in the system config.',mbError,MB_OK);
Result:=False;
end; Oh wait, I get the same error message now! Let me try a few things and I'll come back to you. |
Okay, so the reason I got this error message: was that I had defined So this is somewhat good news! I now have an idea what might be going wrong in your setup: maybe you have a Virtual Store where all the things you "write" into FWIW this is the [Setup]
AppName=CmdTest
AppVersion=0.0
WizardStyle=modern
DefaultDirName=C:\My Program
PrivilegesRequired=none
#define MINGW_BITNESS 'mingw64'
[Code]
procedure LogError(Msg:string);
begin
MsgBox(Msg,mbError,MB_OK);
Log(Msg);
end;
var
AppDir:String;
function ShellQuote(Value:String):String;
begin
// Sadly, we cannot use the '\'' trick used throughout Git's
// source code, as InnoSetup quotes those in a way that
// git.exe does not understand them.
//
// So we try to imitate quote_arg_msvc() in Git's
// compat/mingw.c instead: \ => \\, followed by " => \",
// then surround with double quotes.
StringChangeEx(Value,#92,#92+#92,True);
StringChangeEx(Value,#34,#92+#34,True);
Result:=#34+Value+#34;
end;
function ReadFileAsString(Path:String):String;
var
Contents:AnsiString;
begin
if not LoadStringFromFile(Path,Contents) then
Result:='(no output)'
else
Result:=Contents;
if (Length(Result)>0) and (Result[Length(Result)]=#10) then
SetLength(Result,Length(Result)-1);
if (Length(Result)>0) and (Result[Length(Result)]=#13) then
SetLength(Result,Length(Result)-1);
end;
function GitSystemConfigSet(Key,Value:String):Boolean;
var
i:Integer;
OutPath,ErrPath:String;
begin
OutPath:=ExpandConstant('{tmp}\config-set.out');
ErrPath:=ExpandConstant('{tmp}\config-set.err');
LogError('/C .\{#MINGW_BITNESS}\bin\git.exe config --system '+ShellQuote(Key)+' '+ShellQuote(Value)+' >'+#34+OutPath+#34+' 2>'+#34+ErrPath+#34);
if (Value=#0) then begin
if Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config --system --unset '+Key+' >'+#34+OutPath+#34+' 2>'+#34+ErrPath+#34,
AppDir,SW_HIDE,ewWaitUntilTerminated,i) And ((i=0) Or (i=5)) then
// exit code 5 means it was already unset, so that's okay
Result:=True
else begin
LogError('Unable to unset system config "'+Key+'": exit code '+IntToStr(i)+#10+#13+ReadFileAsString(OutPath)+#10+#13+'stderr:'+#10+#13+ReadFileAsString(ErrPath));
Result:=False
end
end else if Exec(ExpandConstant('{cmd}'),'/C .\{#MINGW_BITNESS}\bin\git.exe config --system '+ShellQuote(Key)+' '+ShellQuote(Value)+' >'+#34+OutPath+#34+' 2>'+#34+ErrPath+#34,
AppDir,SW_HIDE,ewWaitUntilTerminated,i) And (i=0) then
Result:=True
else begin
LogError('Unable to set system config "'+Key+'":="'+Value+'": exit code '+IntToStr(i)+#10+#13+ReadFileAsString(OutPath)+#10+#13+'stderr:'+#10+#13+ReadFileAsString(ErrPath));
Result:=False;
end;
end;
function InitializeSetup(): Boolean;
begin
AppDir:='C:\Program Files\Git';
if GitSystemConfigSet('cmd.test','success') then
MsgBox('Could set the system config correctly.',mbInformation,MB_OK)
else
MsgBox('Failed to set `cmdtest` in the system config.',mbError,MB_OK);
Result:=False;
end; |
Ooooo... I sent you events filtered for only the git-for Windows. But I should include the cmd events too. I'll do that. |
That's strange about the virtual store. I'm running the latest version of Windows 10. There hasn't been another operating system on this machine (except earlier versions of 10). I even ran the installer as admin. Same thing happened. Anyway, I'll try your custom installer as soon as I get a chance. |
It's only a hunch... I am not all that certain that this is the culprit, but it does look as if |
Hi, there. [HKEY_CURRENT_USER\Software\Microsoft\Command Processor] Delete this entry will solve the problem. And, I found that Git v2.21.0 is the last version that can be installed without any trouble when this symptom happened. |
@MagicJack Yep, that worked for me! Amazing. How did you figure that out? |
I guess the best way to fix this would be to see what the git-for-windows installer behavior is different from 2.21 to later with respect to that registry entry... or what happens when the installer is presumably running those commands in a background process and that command process wants to call the autorun value. |
It is not that it does anything with the registry entry; Instead, it runs |
@MagicJack before I forget completely: thank you so much for investigating. |
As per the documentation, usually `AutoRun` steps specified via the registry (e.g. `Software\Microsoft\Command Processor\AutoRun`) are run when calling `cmd.exe`, unless the `/D` option is used: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd This can lead to problems when we use `cmd.exe` for the benefit of redirecting the output to a file: under certain circumstances it can easily produce an error "The system cannot find the path specified." Let's use the `/D` to address this problem. This addresses git-for-windows/git#2384. Signed-off-by: Johannes Schindelin <[email protected]>
Yea that's a good solution. Thank you both! Never would have thought. Really curious how you came about discovering that. |
I kicked off a build with the fix. Could I ask y'all to download and test the |
I tested it. It didn't have any issues. I then installed the 2.28 version and it had the previous issues. I installed the 2.29 over it again and no issues. |
@gaetawoo excellent! This is now fixed, via git-for-windows/build-extra#312. The latest snapshot has the bug fix. |
Setup
defaults?
to the issue you're seeing?
This first happened when I tried to install the downloaded installer on top of my previous version. Then i uninstalled it, and rebooted. Then tried to reinstall. It always gives me the same errors during installation.
Details
MINGW64 Bash
Minimal, Complete, and Verifiable example
this will help us understand the issue.
During installation of downloaded installer, it gave a bunch of "Unable to set system config" errors. For example like this but a bunch more:

Many similar errors.
I expected it to install cleanly without issue, as it has before on other systems and on this system with a previous version.
Constant "Unable to set system config" errors. I even tried running the installer as Admin (even though I'm admin on my account (this is a personal computer)). I tried installing it to other locations. Still the same problems.
URL to that repository to help us with testing?
Not repository related. Just the Git for Windows installation media.
The text was updated successfully, but these errors were encountered: