Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error installing msys2 with stack 0.1.5.0 on Windows #1046

Closed
rkarp opened this issue Sep 24, 2015 · 11 comments
Closed

Error installing msys2 with stack 0.1.5.0 on Windows #1046

rkarp opened this issue Sep 24, 2015 · 11 comments

Comments

@rkarp
Copy link

rkarp commented Sep 24, 2015

This happens when I run stack setup on Windows:

downloading perl-TermReadKey-2.33-1-x86_64.pkg.tar.xz...
downloading git-2.5.2-1-x86_64.pkg.tar.xz...
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
Exit code ExitFailure 1 while running ["pacman","-Sy","--noconfirm","git"] in C:\Users\rolf\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\
@snoyberg
Copy link
Contributor

Does this happen deterministically? Or could this perhaps be a random
download failure?

On Fri, Sep 25, 2015, 12:39 AM Rolf Karp notifications@github.com wrote:

This happens when I run stack setup on Windows:

downloading perl-TermReadKey-2.33-1-x86_64.pkg.tar.xz...
downloading git-2.5.2-1-x86_64.pkg.tar.xz...
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
Exit code ExitFailure 1 while running ["pacman","-Sy","--noconfirm","git"] in C:\Users\rolf\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\


Reply to this email directly or view it on GitHub
#1046.

@rkarp
Copy link
Author

rkarp commented Sep 25, 2015

Yes, it always happens in the same spot. If I try to call stack setup again afterwards, I get this error:

Preparing to download 7z.exe ...
Already downloaded.
Could not delete existing msys directory: C:\Users\rolf\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\
removeDirectoryRecursive: permission denied (Zugriff verweigert)

This might be because some files in there have the "system file" attribute, so even Windows Explorer asks for confirmation before deleting them. Doing rm -rf msys2-20150512 from Git bash works, though.

After I delete the directory, stack setup will again abort with the first error. If I try to call pacman myself afterwards, this happens:

rolf@xeon MINGW32 /c/users/rolf/appdata/local/programs/stack/x86_64-windows/msys2-20150512
$ pacman -Sy --noconfirm git
bash: pacman: command not found

@rkarp
Copy link
Author

rkarp commented Sep 25, 2015

I've just tried it again after deleting the msys2 folder and now it works, even though I got the original error just minutes ago. I guess the download of the git tar didn't work and they just fixed it?

@borsboom
Copy link
Contributor

I saw this happen a couple times a while back, but haven't seen it since.

@snoyberg
Copy link
Contributor

Forgot to put this comment in earlier.

Combining this with the fact that we're not even certain preinstalling git is a good idea (due to the CRLF issue), should we just skip that step in the setup process?

@borsboom
Copy link
Contributor

+1 on skipping git.

@borsboom
Copy link
Contributor

Cool. Probably no longer relevant, but I've been running stack setup repeatedly on (wiping out the local programs between runs), and this did eventually happen again:

[...]
 git-2.5.2-1-i686                                 3.4 MiB   102K/s 00:34 [#######################################] 100%
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.
Exit code ExitFailure 1 while running ["pacman","-Sy","--noconfirm","git"] in C:\Users\emanu\AppData\Local\Programs\stack\i386-windows\msys2-20150512\

And then running stack setup again:

C:\Users\emanu\AppData\Local\Programs>stack setup
Run from outside a project, using implicit global config
Using resolver: lts-3.6 from global config file: C:\Users\emanu\AppData\Roaming\stack\global\stack.yaml
Warning: https://raw.githubusercontent.com/fpco/stackage-content/master/stack/stack-setup-2.yaml: Unrecognized field in SetupInfo: ghcjs
Already downloaded.
Already downloaded.
Already downloaded.
Could not delete existing msys directory: C:\Users\emanu\AppData\Local\Programs\stack\i386-windows\msys2-20150512\
removeDirectoryRecursive: permission denied (Access is denied.)

@snoyberg
Copy link
Contributor

I'm going to guess this is a bug in MSYS2 itself, not in anything we're doing. It may be worth reporting upstream.

@3noch
Copy link
Member

3noch commented Sep 28, 2015

:( IMO, MSYS2 is way too heavy to be isolating and using ourselves. It deserves to be installed by the end users.

@wismill
Copy link

wismill commented Oct 6, 2015

Hi there. I've just tested the latest stack.

I would like to point out that the command stack exec -- pacman -Sy --noconfirm git will not work until you add <localappdata>\Programs\stack\x86_64-windows\msys2-20150512\usr\bin to the PATH environment variable.

@borsboom from my experience the "permission denied" issues are often solved by closing the Explorer.

@3noch it may be heavy but it is very practical to have an all-in-one installation especially on Windows.

@omgreenfield
Copy link

omgreenfield commented Feb 1, 2018

Here's what worked for me:

  • Disabling anti-virus
  • After getting any sort of permission issues, go to stack installation folder. For me, this was C:\Users\mattgreenfield1\AppData\Local\Programs\stack\x86_64-windows.
  • For whatever "modules" you have, like ghc-8.2.2 and msys-20150512, make sure that:
    • You don't have a temp folder for that module
    • You DO have a folder for that module that is just the tar.xz unzipped
    • You also have a .installed file. For ghc-8.2.2, I have a ghc-8.2.2.installed file. Its contents are just the string installed.
    • After doing all this monkeying around, x86_64-windows folder looked like this:
      • ghc-8.2.2/
      • msys2-20150512/
      • 7z.dll
      • 7z.exe
      • ghc-8.2.2.installed
      • ghc-8.2.2.tar.xz
      • msys2-20150512.installed
      • msys2-20150512.tar.xz

After going through these steps and ensuring I had these "module" files in place, stack behaved as expected.

Hope this helps others!

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

No branches or pull requests

6 participants