git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.35k stars 2.53k forks source link

Warning whilst installing 2.38.0: "Could not reconfigure Scalar enlistments" #4050

Open LordScree opened 2 years ago

LordScree commented 2 years ago

Setup

v2.38.0 for Windows, 64-bit

$ git --version --build-options

git version 2.38.0.windows.1
cpu: x86_64
built from commit: 0355083fbe5582f6d3f819afc130ed2f2375e0bd
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

Windows 11 Enterprise, 22H2, 64-bit

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.22621.525]

No new options from previous installation

# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path: 
Default Branch Option: main
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
Enable FSMonitor: Disabled

Windows 11 22H2 upgrade is very new.

Details

I had v2.37.3 installed. I downloaded 2.38.0. I ran the installer and confirmed the UAC prompt. I selected "Only new options" on the installer. I hit Install. I saw the following message near the end of the install process:

ErrorUpdatingGit_2 38 0

It reads: Line 3362: Could not reconfigure Scalar enlistments (output: (no output), errors: (no output)).

I did not expect to see a warning during the installation process.

I saw a warning during the installation process.

Not applicable.

dscho commented 2 years ago

@LordScree does this reproduce when you reinstall v2.38.0? If so, could you run the installer from a CMD window, appending /LOG:log.txt after the file name, then look whether the log.txt file contains anything revealing about the bug?

Shne commented 2 years ago

I'm experiencing a similar issue, though my error message says "error launching git: Access is denied." git installer 2 38 error The installer seems to finish up fine after clicking the OK button on the error/warning window. The error happens on the "Initializing Explorer integration" step of the installer, but "Git bash here" in the explorer right-click menu seems to work fine. Is there another explorer integration that I'm unaware of?

It happens on every reinstall, also after a computer restart. I also had the previously latest version of git for windows installed before (I'm guessing that's 2.37.3). Running Git-2.38.0-64-bit.exe /LOG:log.txt in a CMD window doesn't seem to produce a log.txt file, at least not in the same folder.

dscho commented 2 years ago

Running Git-2.38.0-64-bit.exe /LOG:log.txt in a CMD window doesn't seem to produce a log.txt file, at least not in the same folder.

Could you pass an absolute path to a log file? That should produce it in the expected location.

LordScree commented 2 years ago

@LordScree does this reproduce when you reinstall v2.38.0? If so, could you run the installer from a CMD window, appending /LOG:log.txt after the file name, then look whether the log.txt file contains anything revealing about the bug?

Sorry for the delay. Busy week.

Does this reproduce when you reinstall v2.38.0? Yes. If I run the .exe file from Windows Explorer, or from Windows Terminal (using PowerShell 7), I get the same issue. Even when reinstalling 2.38.0 over itself.

Could you run the installer from a CMD window, appending /LOG:log.txt after the file name, then look whether the log.txt file contains anything revealing about the bug? I tried this from Windows Terminal first (using PowerShell 7). I got the same error, but there was no log.txt file. I tried twice to check I hadn't made a mistake the first time. No log.txt file.

I then tried again using an admin CMD prompt (i.e., not Windows Terminal, but actual CMD as you'd requested). Still no log.txt file, BUT I also received no warning via an admin CMD prompt.

LordScree commented 2 years ago

Running Git-2.38.0-64-bit.exe /LOG:log.txt in a CMD window doesn't seem to produce a log.txt file, at least not in the same folder.

Could you pass an absolute path to a log file? That should produce it in the expected location.

Sorry, I just saw this. I tried the following:

Git-2.38.0-64-bit.exe /LOG:log.txt Git-2.38.0-64-bit.exe /LOG:C:\Temp\log.txt Git-2.38.0-64-bit.exe /LOG:"C:\Temp\log.txt" Git-2.38.0-64-bit.exe /log:log.txt Git-2.38.0-64-bit.exe /log:C:\Temp\log.txt Git-2.38.0-64-bit.exe /log:"C:\Temp\log.txt"

None of these produced a log.txt file.

I then tried creating the log.txt file first (thinking perhaps the installer couldn't create the file but might be able to write to it if it already exists). Still no output in the log.txt file.

LordScree commented 2 years ago

To confirm, there is no warning when using an admin prompt. I have confirmed this via CMD and Windows Terminal (with PowerShell 7) now.

Also, there is no warning if running the executable from Windows Explorer via right-click > Run as Administrator.

When running the installer as normal from Windows Explorer (double-click), there is a UAC prompt. But I assume the issue is that some part of the installer is not getting admin rights when it needs it.

dscho commented 2 years ago

D'oh. I ran the installer with /? and the syntax is /LOG=log.txt, i.e. a = instead of a :.

Shne commented 2 years ago

Now I tried running it with /LOG=log.txt, and it did produce a log file, but this time it didn't produce any error. No idea why. Also no error running it from explorer without a shell. I have lots of stuff running, and haven't tried from a fresh reboot. But if there's no error now, and no actual problem found with the error before, I guess the priority of this "issue" is quite low.

LordScree commented 2 years ago

Please see attached my example log.txt file.

log.txt

As I said before, the error did not appear when running the installer from an admin command prompt. I've also run again via an admin command prompt and attached the below log:

log_as_admin.txt

LordScree commented 2 years ago

it did produce a log file, but this time it didn't produce any error.

I found I did not experience the warning when using an admin command prompt / admin PowerShell window.

I guess the priority of this "issue" is quite low.

It seems like a benign warning, but I'm not sure how important scalar enlistments are. I'll leave that assessment up to the experts!

dscho commented 2 years ago

Please see attached my example log.txt file.

log.txt

It would have been sufficient to paste just the part that talks about Scalar, with a little bit of context:

[...]
2022-10-18 14:30:00.392   Saving uninstall information.
2022-10-18 14:30:00.392   Writing uninstaller messages: C:\Program Files\Git\unins001.msg
2022-10-18 14:30:00.392   Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1
2022-10-18 14:30:00.392   Writing uninstall key values.
2022-10-18 14:30:00.393   Detected previous non administrative install? No
2022-10-18 14:30:00.393   Detected previous administrative 32-bit install? No
2022-10-18 14:30:00.420   Installation process succeeded.
2022-10-18 14:30:01.159   Message box (OK):
                          Line 3362: Could not reconfigure Scalar enlistments (output: (no output), errors: (no output)).
2022-10-18 14:30:02.110   User chose OK.
2022-10-18 14:30:02.110   Line 3362: Could not reconfigure Scalar enlistments (output: (no output), errors: (no output)).
2022-10-18 14:30:02.230   Line 3441: Executing C:\Program Files\Git\post-install.bat
2022-10-18 14:30:03.052   Line 3449: post-install scripts run successfully:
                          "running post-install"
                          'C:\WINDOWS\system32\drivers\etc\hosts' -> '/etc/hosts'
                          'C:\WINDOWS\system32\drivers\etc\protocol' -> '/etc/protocols'
                          'C:\WINDOWS\system32\drivers\etc\services' -> '/etc/services'
                          'C:\WINDOWS\system32\drivers\etc\networks' -> '/etc/networks'
2022-10-18 14:30:03.219   Need to restart Windows? No
[...]

I do not see any smoking gun there.

asfarley commented 1 year ago

I'm getting this after updating to 2.38.1: image

dscho commented 1 year ago

@asfarley yes, this is what was reported already. Unfortunately it does not add any information that we did not have before.

AaronKelley commented 1 year ago

I've been getting this error message when upgrading as well. I noticed that in the new-ish Git 2.39.1, the line number has changed:

image

In 2.39.0, it was still reporting line 3362. ...Just in case that helps narrow things down by looking for files that have had a line removed between the two releases.

As reported elsewhere, if I run the installer explicitly "As administrator" (rather than just relying on the automatic UAC prompt), this error message does not pop up.

dscho commented 1 year ago

...Just in case that helps narrow things down by looking for files that have had a line removed between the two releases.

Unfortunately, this does not narrow it down, it's simply the new location of the same call.

traits commented 1 year ago

2.38.? -> 2.40.0: Same message (now at 'Line 3367')

this is what was reported already. Unfortunately it does not add any information that we did not have before.

It did, as it does now: Another new version is affected.

dscho commented 1 year ago

@traits unfortunately, it does not add any information. It is fully expected that the bug won't be fixed until the time when somebody can shed more light into what is happening under the hood. So going forward, I would expect v2.41.0 to fail with the same error message for you. As well as v2.42.0. Or v5.0.0 if that ever materializes.

What would add information that we don't know already would be a report that it actually does not happen. Or information about ownership of the existing Scalar enlistments that has not been reported before. Or if there are stale paths registered in scalar.repo, also something that has not been reported so far. Anything along the lines of "I saw something strange here, maybe that could have something to do with the problem" that has not been reported so far.

I would love to receive such information that would help us better to pinpoint what the bug is, and help us fix it.

But repeating that it still fails does not add any such information. It just adds clutter. We need new information to fix this. Until that time we have no chance to fix it, and no amount of piling onto this ticket will change that.

AaronKelley commented 1 year ago

What would add information that we don't know already would be a report that it actually does not happen.

I can confirm that I have two PCs here (one for home and one for work), and I get this popup error on my home PC but not my work PC. I just ran through the 2.40.0 installer again on both to double-check that this is the case. So, it is conditional on something, not sure how to figure out what. As others have mentioned, the error will not appear if I explicitly run the installer "as administrator" on my home PC.

anagh070 commented 1 year ago

same error occured with me, i have downloaded git for first time ever in my life. i tried reinstalling at the same path, nothing changed. image this error used to come, but i tried running the installer as an administor and the error didnt appear but another error appeared at the end. image can anyone help me pls

LordScree commented 1 year ago

same error occured with me, i have downloaded git for first time ever in my life. i tried reinstalling at the same path, nothing changed. image this error used to come, but i tried running the installer as an administor and the error didnt appear but another error appeared at the end. image can anyone help me pls

Yeah, you can simply run the installer from an admin command prompt as a workaround.

dscho commented 1 year ago

error launching git: Access denied

This is a different error.

ShellExecuteEx failed: error 1155
No application is associated with the specified file for this
operation.

This, too, is an unrelated error. It is most likely due to a missing file association for .html files, which strikes me as such a rare scenario that I do not want to spend time on working around that. @LordScree if you want to work on it, let me know, I will provide you with pointers in that case.

As for the original error message (with unhelpful (no output) messages), I wonder if one of you who can reproduce (because I still can't) is up to the task of experimenting with the installer a bit. In particular, I think we would need to insert a SysErrorMessage(Res) call in the ExecSilentlyAsOriginalUser() function. This will need to be done with a little care, somewhat like this (I did not have a chance to test this, though, you might need to adjust it):

diff --git a/installer/helpers.inc.iss b/installer/helpers.inc.iss
index b91e86105..29a75fb14 100644
--- a/installer/helpers.inc.iss
+++ b/installer/helpers.inc.iss
@@ -208,10 +208,12 @@ var
 begin
     OutPath:=ExpandConstant('{tmp}\')+LogKey+'.out';
     ErrPath:=ExpandConstant('{tmp}\')+LogKey+'.err';
-    if ExecAsOriginalUser(ExpandConstant('{sys}\cmd.exe'),'/D /C "'+Cmd+' >"'+OutPath+'" 2>"'+ErrPath+'""','',SW_HIDE,ewWaitUntilTerminated,Res) and (Res=0) then
-        Result:=True
-    else begin
-        LogError(ErrorMessage+' (output: '+ReadFileAsString(OutPath)+', errors: '+ReadFileAsString(ErrPath)+').');
+    if not ExecAsOriginalUser(ExpandConstant('{sys}\cmd.exe'),'/D /C "'+Cmd+' >"'+OutPath+'" 2>"'+ErrPath+'""','',SW_HIDE,ewWaitUntilTerminated,Res) then begin
+        LogError(ErrorMessage+' (sys error: '+SysErrorMessage(Res)+').');
         Result:=False;
-    end;
+    end else if (Res<>0) then begin
+        LogError(ErrorMessage+' (output: '+ReadFileAsString(OutPath)+', errors: '+ReadFileAsString(ErrPath)+', exit code: '+IntToStr(Res)+').');
+        Result:=False;
+    end else
+        Result:=True;
 end;

If anybody is up to it, here is how to get started:

  1. install Git for Windows' SDK,
  2. sdk cd installer,
  3. edit helper.inc.iss
  4. build a new installer via sdk build installer
  5. run the installer with /LOG=log.txt to see whether it contains any information we haven't seen yet?
danielwagn3r commented 1 year ago

Still there with installer version 2.42.0.2 64bit on Windows 10

dscho commented 1 year ago

Still there with installer version 2.42.0.2 64bit on Windows 10

@danielwagn3r any chance that you can work on this? In the meantime it should not even be necessary to get the Git for Windows SDK, but you should be able to test this in a plain Git Bash: