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

Choco PS installation broken? #6

Closed
stevozilik opened this issue Feb 10, 2021 · 13 comments
Closed

Choco PS installation broken? #6

stevozilik opened this issue Feb 10, 2021 · 13 comments

Comments

@stevozilik
Copy link

Following the install guide, latest https://chocolatey.org/install.ps1 seems to incorrectly detect Choco already installed in an environment where Choco is not installed:

PowerShell:

PS C:\Users\xyz> choco
choco : The term 'choco' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ choco
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (choco:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\xyz> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
WARNING: An existing Chocolatey installation was detected. Installation will not continue.
For security reasons, this script will not overwrite existing installations.

Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.

This is on Win 10 Enterprise, 19041.685

@stevozilik stevozilik changed the title Choco PS installation broken> Choco PS installation broken? Feb 10, 2021
@ferventcoder ferventcoder transferred this issue from chocolatey/choco Feb 10, 2021
@ferventcoder
Copy link
Member

This is likely a duplicate, so I moved it over to home repo as it is an issue with the Chocolatey community repository - did you create the folder ahead of time?

@ferventcoder
Copy link
Member

Duplicate of #3

@ferventcoder ferventcoder marked this as a duplicate of #3 Feb 10, 2021
@ferventcoder
Copy link
Member

We'll hold this open while you confirm on the folder creation.

@stevozilik
Copy link
Author

Ok so it get's more interesting.

The reason why I'm installing manually, is because DSC failed with that same error. However DSC worked before releasing https://github.com/chocolatey/cChoco/releases/tag/v2.5.0

Now after I deleted the folder created by DSC "C:\ProgramData\Chocolatey", the manual installation works.

However DSC does not (fails with 'An existing Chocolatey installation was detected')

cChocoInstaller installChoco
{
InstallDir = "C:\ProgramData\Chocolatey"
}

Any thoughts?

@pauby
Copy link
Member

pauby commented Feb 10, 2021

With the new install script you can't install Chocolatey to a folder with files in there as a security precaution. If Chocolatey exists in c:\programdata\Chocolatey then you'll need to use another directory.

v2.5.0 of cChoco fixes the issue where the new install script didn't work with it. See this issue.

@stevozilik
Copy link
Author

And that's what I mean - the new install script has broken cChoco DSC

Import-DscResource -Module cChoco 

cChocoInstaller installChoco
{
   InstallDir = "C:\ProgramData\Chocolatey"
}

Does not work, as it tries to download and install choco into the same location InstallDir = "C:\ProgramData\Chocolatey"
(just to be clear this is running into and environment that does not contain choco or the "C:\ProgramData\Chocolatey" folder)

@pauby
Copy link
Member

pauby commented Feb 11, 2021

@stevozilik If I understand what you're saying, this has been fixed in cChoco 2.5.0 so if you're using that version, and it's not working, can you raise an issue? Before you post the issue, can you also try to use a different InstallDir (say c:\cchocotest) and also report the results of that in the issue you raise?

@stevozilik
Copy link
Author

@pauby I'm saying 2.5.0 (install.ps1) has broken Choco DSC

I've raised an issue, this is it no?

(as requested I've tried other InstallDir, same outcome)

@pauby
Copy link
Member

pauby commented Feb 11, 2021

This isn't the place to raise issues for cChoco. Can you raise an issue over at the repository I linked to in my last comment?

@gep13
Copy link
Member

gep13 commented Feb 23, 2021

@stevozilik we haven't heard back from you about this issue, so going to assume that everything is working for you now. If not, reply back, and we can offer additional help.

@gep13 gep13 closed this as completed Feb 23, 2021
@edcarino2
Copy link

I am following this conversation thread. I have issues installing Chocolatey exactly the same as "Chocolatey installation was detected" (error msg indicated above). My c:\ProgramData\Chocolatey directory and Chocolatey footprints in Environment Variables are already deleted. I even rebooted my computer just to be sure the deletion take into effect before I install Chocolatey again. Unfortunately, I still get the same error.

Do you have any updates about this issue or any resolution?

@Danl2620
Copy link

I just ran into this issue as well. I can see the directory tree of chocolatey at c:\ProgramData\chocolatey but no choco.exe. I can't setup the path and I can't (re-)install chocolatey. What are some steps to get past this?

@vexx32
Copy link
Member

vexx32 commented Mar 20, 2021

I am following this conversation thread. I have issues installing Chocolatey exactly the same as "Chocolatey installation was detected" (error msg indicated above). My c:\ProgramData\Chocolatey directory and Chocolatey footprints in Environment Variables are already deleted. I even rebooted my computer just to be sure the deletion take into effect before I install Chocolatey again. Unfortunately, I still get the same error.

Do you have any updates about this issue or any resolution?

The checks the script performs are:

  1. Get-Command choco
  2. Check for the $env:ChocolateyInstall environment variable and the directory it points to exists and is not empty
  3. The default $env:PROGRAMDATA\Chocolatey install location exists and is not empty

If any of those are present, we can't be assured that it will be a clean install, and there are security hazards with allowing the install to proceed in those cases.

Check those on your systems and see what you can find; these are the only checks the script performs, so if it's not working for you it's one of these.

I just ran into this issue as well. I can see the directory tree of chocolatey at c:\ProgramData\chocolatey but no choco.exe. I can't setup the path and I can't (re-)install chocolatey. What are some steps to get past this?

I would recommend clearing out the c:\ProgramData\chocolatey folder entirely and then running the install script. If there is data there from a prior install you need to keep, I would suggest moving it to another location and restoring the data you need to keep after the install script is completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants