lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.53k stars 1.47k forks source link

Unable to install or uninstall Lens on Windows #5887

Closed craph closed 2 years ago

craph commented 2 years ago

Describe the bug I'm unable to install latest version of Lens

To Reproduce Steps to reproduce the behavior:

  1. Download the latest version from the official website for windows
  2. Double click to install it.

Expected behavior I must be able to install Lens

Screenshots image

Environment (please complete the following information):

craph commented 2 years ago

First I try to update from a previous version it was impossible. So I uninstall the old one and try to install the latest one but it doesn't work

Nokel81 commented 2 years ago

it doesn't work

Do you mean that installing the new version fails after manually uninstalling the previous version?

From the screenshot it seems like there is a running instance of Lens somewhere. Are you installing for single user or for all users?

craph commented 2 years ago

Yes, I run the uninstall script from C:\users\{username}\AppData\Local\Programs\Lens after that I restarted my laptop and I have clear all the related folder of Lens in roaming folder too. Then I ran the latest installer and I choose the option single user.

craph commented 2 years ago

how the installer is checking if Lens is running or not ?

craph commented 2 years ago

If I change the directory name where Lens is installed the installation works. (I have rename Lens to Lens2 for the directory)

BUT after that if I try to uninstall it again I can't and the uninstaller says : "Lens cannot be closed. Please close it manually and click Retry to continue" image image image

Nokel81 commented 2 years ago

That sounds like the tray icon is still running. Did you run Lens between the installing and uninstalling in the new location?

craph commented 2 years ago

That sounds like the tray icon is still running. Did you run Lens between the installing and uninstalling in the new location?

Yes I just launched it after the installation. And I closed it just after. I can't see any process running on the machine and I'm unable to uninstall it. I can't see any tray icon running

Where is the code of the installer / uninstaller ? to check what is it looking for

craph commented 2 years ago

@Nokel81, @aleksfront Can you tell me what the installer / uninstaller does to check if Lens is running or not ? Even if with admin right I'm unable to uninstall it

Is it possible that it's an issue with the nsis uninstaller ? or maybe due to Crowdstrike that block something ?

craph commented 2 years ago

@Nokel81 is it possible to have any advice / help about this ?

Nokel81 commented 2 years ago

What is Crowdstrike?

I cannot reproduce this on my windows machine, even if I leave Lens running the "OK" button on the "Lens is still running. Click OK to close" dialogue works and the uninstall process continues and succeeds.

craph commented 2 years ago

Crowdstrike is an EDR I'am unable to install or uninstall Lens. How should I proceed ? It looks like Crowdstrike doesn't like NSIS binary : https://www.crowdstrike.com/blog/blurring-of-commodity-and-targeted-attack-malware/ And in the NSIS site we can see that Crowdstrike is listed. https://nsis.sourceforge.io/NSIS_False_Positives

I think you should sign your application to possibly avoid false positive. Or may be not use nsis and switch to msi for the Windows packaging and sign the application too.

jim-docker commented 2 years ago

I encountered this when trying to install Lens 6.0.0 alpha version (for any user) on top of Lens 5.5.4 (for any user). I had to manually uninstall Lens 5.5.4 first (using uninstaller in C:\Program Files\Lens) @craph did you check there also in case you had previously installed Lens for any user?

craph commented 2 years ago

I encountered this when trying to install Lens 6.0.0 alpha version (for any user) on top of Lens 5.5.4 (for any user). I had to manually uninstall Lens 5.5.4 first (using uninstaller in C:\Program Files\Lens) @craph did you check there also in case you had previously installed Lens for any user?

Hello @jim-docker I have only installed Lens for my user. And in C:\Program Files I don't have any folder called Lens

I can install and uninstall correctly the version 4.2.4 (old version I found on my laptop) But now with the latest version I'm unable to uninstall it

craph commented 2 years ago

I tried to remove all the files and registry keys about Lens manually to try to reinstall it just after and it's the same problem. It always says that Lens is running and should be closed first but it can't close it successfully. image

craph commented 2 years ago

It looks like my issue is like this : https://github.com/electron-userland/electron-builder/issues/6865

craph commented 2 years ago

I also tried to build it locally from the source of version 5.5.4 but I have this error when I run npm run build:win :

npm run build:win

> open-lens@5.5.4 build:win
> yarn run compile && electron-builder --win --dir

yarn run v1.22.19
$ env NODE_ENV=production concurrently yarn:compile:*
ERROR env: CreateProcessA
Done in 0.13s.
  • electron-builder  version=23.0.3 os=10.0.19042
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist\builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=node-pty@0.10.1 platform=win32 arch=x64
  • packaging       platform=win32 arch=x64 electron=14.2.9 appOutDir=dist\win-unpacked
  • file source doesn't exist  from=C:\Users\myuser\Downloads\lens-5.5.4\locales
  • file source doesn't exist  from=C:\Users\myuser\Downloads\lens-5.5.4\binaries\client\windows\x64\kubectl.exe
  • file source doesn't exist  from=C:\Users\myuser\Downloads\lens-5.5.4\binaries\client\windows\x64\lens-k8s-proxy.exe
  • file source doesn't exist  from=C:\Users\myuser\Downloads\lens-5.5.4\binaries\client\windows\x64\helm.exe
  ⨯ Application entry file "static\build\main.js" in the "C:\Users\myuser\Downloads\lens-5.5.4\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.  failedTask=build stackTrace=Error: Application entry file "static\build\main.js" in the "C:\Users\myuser\Downloads\lens-5.5.4\dist\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.
    at error (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\asar\asarFileChecker.ts:7:12)
    at Object.checkFileInArchive (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\asar\asarFileChecker.ts:31:11)
    at WinPackager.checkFileInPackage (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\platformPackager.ts:503:7)
    at WinPackager.sanityCheckPackage (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\platformPackager.ts:551:5)
    at WinPackager.doPack (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\platformPackager.ts:312:5)
    at WinPackager.pack (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\platformPackager.ts:136:5)
    at Packager.doBuild (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\packager.ts:441:9)
    at Object.executeFinally (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\builder-util\src\promise.ts:12:14)
    at Packager._build (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\packager.ts:376:31)
    at Packager.build (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\app-builder-lib\src\packager.ts:337:12)
    at Object.executeFinally (C:\Users\myuser\Downloads\lens-5.5.4\node_modules\builder-util\src\promise.ts:12:14)
craph commented 2 years ago

I tried to remove all the files and registry keys about Lens manually to try to reinstall it just after and it's the same problem. It always says that Lens is running and should be closed first but it can't close it successfully. image

If I ran process monitor at the same time, I can see cmd.exe spawn like this :

tasklist /FI "USERNAME eq %USERNAME%" /FI "IMAGENAME eq Lens.exe" | find "Lens.exe"

In process monitor I can see the command is success. If I run it manually the command return nothing. And if I click ok to close Lens it runs

taskkill /im "Lens.exe" /fi "PID ne 13124" /fi "USERNAME eq %USERNAME%"

I have no idea why the installer tells me that Lens is running.

craph commented 2 years ago

@jim-docker , @Nokel81 This is really weird, I finally installed Lens by selecting install for Anyone who uses this computer (all users) and after that, if I try to uninstall it from the control panel it doesn't work and it's the same if I try from C:\Program Files\Lens... I don't know how to do ? :( image

jim-docker commented 2 years ago

It looks like my issue is like this : electron-userland/electron-builder#6865

You may be right here. Do you have another process running with Lens in its name? I may have had OpenLens running when I encountered this issue. There was also this comment on that issue:

Interestingly if right clicking on the .exe installer and selecting Run as administrator this issue does not come up. So not sure if this is a signing issue? I do not currently have any signing implemented for windows, but will try this.

Did you try install/uninstall running as admin?

craph commented 2 years ago

@jim-docker I have nothing running with Lens in its name. And I also tried to install/uninstall with admin rights. It's the same... Nothing works 😢 as I said previously with an old installer everything works fine (version 4.2.4)

craph commented 2 years ago

@jim-docker , @Nokel81 I just found a workaround to uninstall correctly the latest version 5.5.4 and this confirm that there are an issue with electron-builder and nsis. I have installed "only for my user" the version 4.2.4 of Lens. And then I run the unintaller of the version 4.2.4. In the uninstaller Window, I choose the option to uninstall Lens for all users (because the version 5.5.4 was installed for all users of my machine) this option refers to C:\Program Files\Lens and the uninstall process works correctly.

I think you have to check the version and fixes of electron-builder / nsis version to check if there are some issue with antivirus or EDR tools like Crowdstrike

Nokel81 commented 2 years ago

Closing because we are now using the updated version of electron-builder