Skip to content
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

Win11 Uninstaller does not work from Apps #799

Open
2 tasks done
dokempf opened this issue May 16, 2024 · 7 comments
Open
2 tasks done

Win11 Uninstaller does not work from Apps #799

dokempf opened this issue May 16, 2024 · 7 comments
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@dokempf
Copy link

dokempf commented May 16, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

Under Windows 11, when triggering an uninstallation from the Apps settings, the installer runs, but shows error messages as below:

323280638-486f03f3-640e-4e62-965e-899215ce8282

When the uninstaller exits, no uninstallation has actually happened.

Executing the uninstaller exe manually works, as does installing through apps on Windows 10.

Conda Info

Constructor version is 3.7.0 (if you suspect this to be a regression, I happily test with older versions).

The project can be found here: https://github.com/ssciwr/helios-installer

Pre-built installers for testing can be found here: https://heibox.uni-heidelberg.de/d/5672545fba1b4185a3be/

Conda Config

No response

Conda list

No response

Additional Context

No response

@dokempf dokempf added the type::bug describes erroneous operation, use severity::* to classify the type label May 16, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning May 16, 2024
@marcoesters
Copy link
Contributor

I just tried the 2.0.0a1 Windows installer on a Windows 11 Cloud PC and cannot reproduce your problem. It installed and uninstalled just fine from Apps. During the installation, I chose "Just me" and I chose not to create shortcuts.

Can you tell me more about how you installed the application?

If this happens repeatedly for you, can you show me what you see when you click on "Show details"?

At last, you can open regex and check inside Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\. This should contain your aplication. If it's not there, you will find it under Computer\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\. Check the values there and see if everything looks okay, The UninstallString, for example, should point to the uninstaller without any options.

@jaimergp
Copy link
Contributor

Does your helios uninstaller have pre uninstall scripts defined? What happens if you click on Ignore?

@dokempf
Copy link
Author

dokempf commented May 24, 2024

I am currently on holiday and will give you feedback in the week of June 3rd.

@dokempf
Copy link
Author

dokempf commented Jun 5, 2024

@marcoesters @jaimergp I came around to test this again and the problem persists on my testing system.

  • My installation is also "Just Me" and it does not matter whether I create shortcuts or not.
  • The registry entries look fine
  • The installer does not use custom preinstall logic. You find the full construct.yaml (modulo some templating) here: https://github.com/ssciwr/helios-installer/blob/main/construct.yaml.j2
  • Clicking "Ignore" does result in the uninstaller proceeding and eventually claiming it to be successful, but the files are not actually removed.
  • Under "Show Details", I see lines like this: ::error:: Failed to run pre_uninstall (same for rmpath and rmreg)
  • Manually running the uninstaller exe does the correct job.

@dokempf
Copy link
Author

dokempf commented Jun 5, 2024

Right after writing up my feedback, I had one more idea and it turned out to be a big hit: This only happens if I change the default installation path in the installer. When I keep the suggested default, everything works fine. That seems to hint at a wrong path somewhere in the uninstaller generation.

@jaimergp
Copy link
Contributor

jaimergp commented Jun 5, 2024

Hm, I wonder if there's something off with how $INSTDIR gets exported as an env var for the subprocesses, or maybe the PATH manipulation. See this part of the logic:

Section "Uninstall"
${LogSet} on
# Remove menu items, path entries
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_ROOT_PREFIX", "$INSTDIR")".r0'
@UNINSTALL_MENUS@
# ensure that MSVC runtime DLLs are on PATH during uninstallation
ReadEnvStr $0 PATH
# set PATH for the installer process, so that MSVC runtimes get found OK
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("PATH", \
"$INSTDIR;$INSTDIR\Library\mingw-w64\bin;$INSTDIR\Library\usr\bin;$INSTDIR\Library\bin;$INSTDIR\Scripts;$INSTDIR\bin;$0;$0\system32;$0\system32\Wbem").r0'
# our newest Python builds have a patch that allows us to control the PATH search stuff much more
# carefully. More info at https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#solution
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("CONDA_DLL_SEARCH_MODIFICATION_ENABLE", "1").r0'
# Read variables the uninstaller needs from the registry
StrCpy $R0 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
StrLen $R1 "Uninstall-${NAME}.exe"
IntOp $R1 $R1 + 3
StrCpy $0 0
loop_path:
EnumRegKey $1 SHCTX $R0 $0
StrCmp $1 "" endloop_path
StrCpy $2 "$R0\$1"
ReadRegStr $4 SHCTX $2 "UninstallString"
StrLen $5 $4
IntOp $5 $5 - $R1
StrCpy $4 $4 $5 1
${If} $4 == $INSTDIR
StrCpy $INSTALLER_NAME_FULL $1
ReadRegStr $INSTALLER_VERSION SHCTX $2 "DisplayVersion"
goto endloop_path
${EndIf}
IntOp $0 $0 + 1
goto loop_path
endloop_path:
# Extra info for pre_uninstall scripts
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("PREFIX", "$INSTDIR").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_NAME", "${NAME}").r0'
StrCpy $0 ${VERSION}
${If} $INSTALLER_VERSION != ""
StrCpy $0 $INSTALLER_VERSION
${EndIf}
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_VER", "$0").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_PLAT", "${PLATFORM}").r0'
System::Call 'kernel32::SetEnvironmentVariable(t,t)i("INSTALLER_TYPE", "EXE").r0'
!insertmacro AbortRetryNSExecWaitLibNsisCmd "pre_uninstall"
!insertmacro AbortRetryNSExecWaitLibNsisCmd "rmpath"
!insertmacro AbortRetryNSExecWaitLibNsisCmd "rmreg"
DetailPrint "Removing files and folders..."
nsExec::Exec 'cmd.exe /D /C RMDIR /Q /S "$INSTDIR"'
# In case the last command fails, run the slow method to remove leftover
RMDir /r /REBOOTOK "$INSTDIR"
${If} $INSTALLER_NAME_FULL != ""
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$INSTALLER_NAME_FULL"
${EndIf}
# If Anaconda was registered as the official Python for this version,
# remove it from the registry
StrCpy $R0 "SOFTWARE\Python\PythonCore"
StrCpy $0 0
loop_py:
EnumRegKey $1 SHCTX $R0 $0
StrCmp $1 "" endloop_py
ReadRegStr $2 SHCTX "$R0\$1\InstallPath" ""
${If} $2 == $INSTDIR
StrCpy $R1 $1
DeleteRegKey SHCTX "$R0\$1"
goto endloop_py
${EndIf}
IntOp $0 $0 + 1
goto loop_py
endloop_py:
SectionEnd

What could have changed in Win11 to break that? 🤔

@marcoesters
Copy link
Contributor

I still can't reproduce it on my Win11 CloudPC, even when installing into %USERPROFILE%\helios_non_default. Here is my OS information via systeminfo:

systeminfo | findstr /B /C:"OS Name" /C:"OS Versi
on"
OS Name:                   Microsoft Windows 11 Enterprise

OS Version:                10.0.22631 N/A Build 22631

Could you tell us the full path as best you can? Do you have any special characters in the path like umlauts or ß or anything like that?

I do agree though that $INSTDIR is somehow not set correctly because the file removal process (via RMDIR) didn't work either. However, $INSTDIR is not set using environment variables, so I'm not sure that's the reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants