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

WriteErrorException,cyg-get.ps1 #176

Closed
fatso83 opened this issue Feb 25, 2016 · 12 comments
Closed

WriteErrorException,cyg-get.ps1 #176

fatso83 opened this issue Feb 25, 2016 · 12 comments

Comments

@fatso83
Copy link

fatso83 commented Feb 25, 2016

I really have no idea why I am having troubles with cyg-get. It talks about not being able to find a file, but it seems clearly to be present.

I installed choco+cygwin+cyg-get on another machine just hours before this happened. The only difference I can think of is that Cygwin used to be manually installed before trying to install it through Choco.

This is the output straight after installing choco and opening a new admin terminal:

PS C:\Windows\system32> choco install cyg-get
Installing the following packages:
cyg-get
By installing you accept licenses for the packages.

Cygwin v2.4.1
The package Cygwin wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider setting
 'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
Do you want to run the script?
 1) yes
 2) no
 3) print
1
 Downloading Cygwin 64 bit
   from 'https://cygwin.com/setup-x86_64.exe'
 Installing Cygwin...
 Starting cygwin install, version 2.873
 User has backup/restore rights
 Current Directory: C:\ProgramData\chocolatey
 Could not open service McShield for query, start and stop. McAfee may not be installed, or we don't have access.
 root: C:\cygwin64 system
 Selected local directory: C:\ProgramData\chocolatey
 net: Direct
 site: http://mirrors.kernel.org/sourceware/cygwin/
 Changing gid back to original
 running: C:\cygwin64\bin\dash.exe "/etc/postinstall/0p_000_autorebase.dash"
 running: C:\cygwin64\bin\dash.exe "/etc/postinstall/0p_update-info-dir.dash"
 Changing gid to Administrators
 Ending cygwin install
 Cygwin has been installed.
 The install of cygwin was successful.

cyg-get v1.2.1
The package cyg-get wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider setting
 'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
Do you want to run the script?
 1) yes
 2) no
 3) print
1
 Adding C:\ProgramData\chocolatey\bin\cyg-get.bat and pointing it to powershell command C:\ProgramData\chocolatey\lib\cy
g-get\tools\cyg-get.ps1
 The install of cyg-get was successful.

Chocolatey installed 2/2 package(s). 0 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
PS C:\Windows\system32> cyg-get openssh
Attempting to install cygwin packages: openssh
C:\ProgramData\chocolatey\lib\cyg-get\tools\cyg-get.ps1 : Please ensure you have Cygwin installed.
To install please call 'choco install cygwin' (optionally add -y to autoconfirm).
ERROR: This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:1
+ & 'C:\ProgramData\chocolatey\lib\cyg-get\tools\cyg-get.ps1'  openssh
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,cyg-get.ps1

PS C:\Windows\system32>
@fatso83
Copy link
Author

fatso83 commented Feb 25, 2016

This will be fixed by PR #125, if that gets merged.

@taolinqu
Copy link

taolinqu commented Mar 4, 2016

Change the value of $cygwinsetup to the following $cygwinsetup = "$cygRoot\setup-x86_64.exe" in cyg-get.ps1 file

@fatso83
Copy link
Author

fatso83 commented Mar 4, 2016

@tlin-fei : Thanks for the input, but observe my comment above: there is already a pending PR that will fix this issue. I just applied the patch to fix my problem.

@tadeu
Copy link

tadeu commented Apr 14, 2016

I'm having this problem too, and the latest cygwin (v2.5.0) does not seem to have setup-x86_64.exe or cygwinsetup.exe

@cwiggs
Copy link

cwiggs commented Apr 21, 2016

@tadeu I found a workaround for this issue (tested with cygwin 2.5.0)

  1. Download the setup installer on the cygwin website: https://cygwin.com/setup-x86_64.exe
  2. Rename the installer to cygwinsetup.exe
  3. Move the installer to C:\tools\cygwin (or wherever you install cygwin)

@rahulserver
Copy link

@cwiggs your workaround works for me too!

@seankanderson
Copy link

seankanderson commented Sep 15, 2016

cwiggs workaround solved my issue

image

@ghost
Copy link

ghost commented Nov 14, 2016

@cwiggs thanks for posting. Just installed fresh today and still having the same issue your work around fixed it.

@dwbimstr
Copy link

dwbimstr commented Jun 9, 2017

I am still having issues. tried the fix suggested by @cwiggs but did not work. Any suggestions ..?

image

@ferm10n
Copy link

ferm10n commented Jun 22, 2017

@dwbimstr I had the same issue.
I started by removing cyg-get and cygwin, then choco install cyg-get -y (note that I left out cygwin)
then I followed @cwiggs steps. I then was able to
cyg-get openssh

But now I don't know how to install sshd as a service after that. Can anyone offer suggestions?

Side note, I'm really surprised this issue is still present a year later. Wouldn't this be just a simple matter of checking if 32 or 64 bit and downloading the correct installer?

@majkinetor
Copy link
Contributor

This cyg-get script is badly written.

I suggest people remove try / except block and see why it actually fails. While the cygwin package was recently changed to ensure setup is on right location, this is probably some other type of error.

@derekmahar
Copy link

I solved this problem by completely removing Cygwin, deleting registry keys HKLM:\SOFTWARE\Cygwin\setup and HKLM:\SOFTWARE\Wow6432Node\Cygwin\setup (removing Cygwin should remove the former), and then reinstalling Cygwin and cyg-get.

In my case, the cause of the problem was that one of the registry keys HKLM:\SOFTWARE\Cygwin\setup and HKLM:\SOFTWARE\Wow6432Node\Cygwin\setup pointed to an invalid Cygwin root path and script cyg-get.ps1 was using the one which was invalid, preventing it from finding Cygwin. The Chocolatey Cygwin package creates registry key HKLM:\SOFTWARE\Cygwin\setup, but not HKLM:\SOFTWARE\Wow6432Node\Cygwin\setup, so an earlier installation of the regular Cygwin setup must have created this key.

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

10 participants