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

Install WSL and MSYS2 on Windows Images #342

Conversation

AndreyMaslennikov
Copy link
Contributor

@AndreyMaslennikov AndreyMaslennikov commented Jan 31, 2020

In this PR we enabled WSL Windows feature, requested in #50, and installed Debian Image to use it in the WSL.
We also installed MSYS2 tool

Copy link
Contributor

@sergey-akhalkov sergey-akhalkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please confirm that docs also will be automatically updated?

images/win/scripts/Installers/Install-DebianImage.ps1 Outdated Show resolved Hide resolved
Import-Module -Name ImageHelpers

$msys2Path = "C:\tools\msys64"
choco install msys2 -y --params "/InstallDir:$msys2Path"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm rather sure that the mingw toolchains can be installed through msys2 so ideally we do that here and remove the separate installation of mingw. Also, I wonder if it's possible to tell GitForWindows to just use the installed msys2/mingw rather than bring in it's own. Any thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, how does this affect existing builds that depend on the currently installed mingw?

Copy link
Contributor

@alepauly alepauly Jan 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another comment. if avoiding chocolatey is not substantially difficult, I think we should avoid it since waiting for choco packages adds another layer of delay and potential problems that we can't control. This comment by @eine suggests it should be easy enough to just untar and execute setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re using the tar, I created an Install-MSYS2.ps1 script mentioned in Issue #30 comment. Also installs typical MSYS2 shell tools and basic 32 & 64 bit compilers.

Having used MSYS2 for a while, the main tar is not revised often, as the current release is dated 2019-May-24. Hence, the more important code is the update code, which hopefully can be run any time images are updated...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hence, the more important code is the update code, which hopefully can be run any time images are updated...

I beg to differ. Updating by default prevents users from testing their tools on a stable environment.

Copy link
Contributor Author

@AndreyMaslennikov AndreyMaslennikov Feb 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alepauly, MSYS2 installation is already implemented in the #355 PR. Could you please take a look at this PR? If it looks good for you, we probably should merge #355 (after adding some tests), and remove MSYS2 installation from this PR. What do you think about it?

images/win/scripts/Installers/Install-DebianImage.ps1 Outdated Show resolved Hide resolved
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-WSL.ps1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should make these changes to the Windows2016 - I don't see any requests asking for them and it just adds one more element to destabilize an older setup. @thejoebourneidentity thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I can see there is a request for the both Windows2016 and 2019 images in the issue #50.
We also planned to use bash from the WSL as default . Wouldn't it be confused if we'll use different bash.exe for these images?

Import-Module -Name ImageHelpers

$msys2Path = "C:\tools\msys64"
choco install msys2 -y --params "/InstallDir:$msys2Path"
Copy link
Contributor

@alepauly alepauly Jan 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another comment. if avoiding chocolatey is not substantially difficult, I think we should avoid it since waiting for choco packages adds another layer of delay and potential problems that we can't control. This comment by @eine suggests it should be easy enough to just untar and execute setup.

@eine
Copy link

eine commented Feb 1, 2020

As commented by @alepauly, I believe that it'd be desirable to get the tarball from MSYS2's site (as done in setup-msys2), instead of using chocolatey. Not only it avoids an unnecessary layer of delay/complexity, but it is also faster.

https://github.com/numworks/setup-msys2/blob/4895c26cd1bbdf4052003c6d771c3c713932bf36/index.js#L24-L26

I'm rather sure that the mingw toolchains can be installed through msys2 so ideally we do that here and remove the separate installation of mingw. Also, I wonder if it's possible to tell GitForWindows to just use the installed msys2/mingw rather than bring in it's own. Any thoughts?

Also, how does this affect existing builds that depend on the currently installed mingw?

Actually, if MSYS2 is installed, GitForWindows should not be required at all. MSYS2 provides three flavours: MSYS, MINGW64 or MINGW32. Hence, starting an MINGW64 shell from MSYS2 provides the same features as GitForWindows, plus pacman is available.

Precisely, issue #30 (which should probably be closed by this PR) is about replacing the existing mingw package with MSYS2, not about adding MSYS2 only. Hence, the default bash shell would be MSYS2's MINGW64.

Furthermore, I think that the following points should also be considered:

Ref actions/starter-workflows#95

@TomasHubelbauer
Copy link

This looks great! I don't mind the choice of Debian as long as I can install Ubuntu instead, but perhaps we could also install both at the same time? Would that be too wasteful? Ubuntu is much more popular than Debian in WSL so I think many people would be switching to it anyway, so it makes sense to have it out of the box. Thoughts?

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 1, 2020

Above, I mentioned a ps1 script written to install MSYS2. Please see the following, which is a link to MSYS2's script that they use for CI on Azure Pipelines:

https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml

Also note that they have a repo with a base install of MSYS2, which is used in their script:
https://github.com/msys2/msys2-ci-base

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 1, 2020

@eine

I beg to differ. Updating by default prevents users from testing their tools on a stable environment.

No. From my perspective, a stable environment is the equivalent of a fresh MSYS2 install, since pacman does not normally allow older packages to be installed. If you want to download and install older packages, have at it. Most users will not want that.

Given your statement, what then determines when MSYS2 (or anything for that matter) gets updated?

@eine
Copy link

eine commented Feb 1, 2020

From my perspective, a stable environment is the equivalent of a fresh MSYS2 install, since pacman does not normally allow older packages to be installed.

That's exactly what I said. The tar should be uncompressed and any dummy command should be executed (say uname -a), so that the installation is completed. But that command should NOT be pacman -Syu.

Conversely, you said that "the more important code is the update code, which hopefully can be run any time images are updated", which I understand as updating MSYS (executing pacman -Syu) each time the environment images (windows-latest) are updated. This is what I differ with.

Given your statement, what then determines when MSYS2 (or anything for that matter) gets updated?

  1. Maintainers of MSYS2, when they release a new version to the upstream location: http://repo.msys2.org/distrib/x86_64/
  2. Any user, by executing pacman -Syu explicitly, or by using action setup-msys2, which will hopefully be updated according to this PR.

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 1, 2020

@eine

Ever used MSYS? One of the main changes in MSYS2 was the use of pacman.

Maintainers of MSYS2, when they release a new version to the upstream location

Since pacman is able to update all of one's MSYS2 install, releases are not done as frequently as other software.

Since you mentioned them, why does all their CI for packages run with a fully updated version?

Why do all their docs mention performing the equivalent of pacman -Syyuu immediately after install?

Actions should try to update/refresh MSYS2 anytime a new image is released. People will prefer it, and the extra resources (time, downloads) needed to update it wouldn't be needed.

@eine
Copy link

eine commented Feb 2, 2020

@MSP-Greg

One of the main changes in MSYS2 was the use of pacman.

Since pacman is able to update all of one's MSYS2 install, releases are not done as frequently as other software.

These are two facts. What do you mean by stating them?

Since you mentioned them, why does all their CI for packages run with a fully updated version?

I believe that's an standard procedure to detect regression bugs in the development branch of a tool, innit? I.e. this question/discussion would better fit in their repo/forum, rather than here.

Why do all their docs mention performing the equivalent of pacman -Syyuu immediately after install?

I'm afraid that's not true. It is not the first time you word your very personal point of view as if it was some objetive fact. I'd like to please ask you to do an effort to make it clear what it is, and what you'd like to be.

On the one hand, I didn't find pacman -Syyuu or any equivalent command to be mentioned in the docs. I found -Syu and -Su, which might be considered as -Syuu. Still, it is explicitly suggested to do it in separate steps.

On the other hand, they suggest it to make it immediately after install, as long as you want to update the packages. It makes sense to suggest using updating commands in order to have packages updated.

I acknowledge that the frontpage (https://www.msys2.org/) might be misleading. But I believe that the docs are clear enough:

  • https://github.com/msys2/msys2/wiki/MSYS2-installation#ii-installation: no reference to any pacman command at all. It is said that "you should start MSYS2", "after this initial run you MUST restart MSYS2" and "now you can update the base MSYS2 packages". Note that should, MUST, and can are used. Not MUST, MUST and MUST.
  • https://github.com/msys2/msys2/wiki/MSYS2-installation#iii-updating-packages: the procedure to update the packages "in the right way" is explained. It is explicitly said that executing pacman -Syuu is likely not to work if done just once: "Follow the instructions. Repeat this step until it says there are no packages to update". Moreover, "there's an update-core script that helps you to update MSYS2 in the right way". Note, that there might be further complexities to account for: "updating bash, MSYS2 or Pacman itself can cause subsequent package updates to fail. For this reason, the safest procedure for updating MSYS2 is to do it in two stages".
  • https://github.com/msys2/msys2/wiki/MSYS2-installation#v-issues-and-workarounds: "Please read "III." above, carefully :-) We will continue working towards trouble-free updates".

Actions should try to update/refresh MSYS2 anytime a new image is released. People will prefer it, and the extra resources (time, downloads) needed to update it wouldn't be needed.

I think you forgot to add "some" before "people". Having it updated by default involves a maintenance burden, due to the references above, and it will break multiple use cases. Those use cases are maintained by people, which will be forced to keep installing a separate "clean" MSYS2. Once again, I feel that you are ok with having your particular preferences placed, but seem to show little regard to other users' needs.

Honestly, I suggest you to get involved in the development of setup-msys2. Many of your ideas are useful for many users indeed, and I'd be really happy to have those supported by a single action, instead of fragmenting the ecosystem. Nevertheless, I believe that most of them need to be optional; thus, should not be applied to this PR.

Please, note that, regarding setup time (which you seem to be more concerned about), setup-msys2 can be combined with a caching approach, so that you have your custom MSYS2 install ready-to-use.

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 2, 2020

@eine

pacman -Syyuu is the equivalent of much of what you mentioned. From my perspective, using an MSYS2 install from nothing but the current tar is equivalent to using Windows 10 with no updates applied.

It happened a while ago, so I can't remember all the details, but sometimes package updates cannot be applied piecemeal.

There was an issue with the AppVeyor MSYS2 install, and I needed one package updated. Jumped thru all sorts of hoops trying to figure out how to do it, and couldn't force it with script. I was writing code and running it locally to show dependency chains, etc.

The main reason for trying to do so was that the MSYS2 install at the time was outdated, and, given all the packages that were installed, running pacman -Syyuu took a long time, probably 8 to 10 minutes.

I asked about it in MSYS2, and the response was equivalent to "what you're trying to do should work, but there will be some rare package updates that can only be performed by pacman -Syyuu". So, if Actions doesn't update their MSYS2 install, the same thing may happen...

Anyway, maybe we'll just agree that we disagree.

Honestly, I suggest you to get involved in the development of setup-msys2

For now, I'm just waiting for an independent, normal install in the image(s). I have an action (https://github.com/MSP-Greg/msys2-action), which uses the embedded MSYS2, and is directed towards gcc use.

It's also somewhat Ruby focused, as older Ruby versions (which I encourage people not to use) are compiled with OpenSSL 1.0.2. There's logic to detect the Ruby version and switch OpenSSL packages accordingly.

Anyway, I'll have a look at setup-msys2...

@eine
Copy link

eine commented Feb 2, 2020

From my perspective, using an MSYS2 install from nothing but the current tar is equivalent to using Windows 10 with no updates applied.

I mostly agree, and I'd expect any average user to update MSYS2 periodically. However, this is not always true. Some users (which are not familiar with the environment) will just install it and use it straightaway. Moreover, in some "computer rooms" installations are preset, reset after each restart and do not provide admin permissions to the user. These are the use cases that (as maintainer of PKGBUILD recipes for MSYS2), I'd like to be able to test. That allows me to know whether it should work, or if users need to talk to their admins.

It happened a while ago, so I can't remember all the details, but sometimes package updates cannot be applied piecemeal.

Just for the sake of completeness, should you remember or find a link, please do add it here or in #30. I believe it might be useful for someone in the future.

The main reason for trying to do so was that the MSYS2 install at the time was outdated, and, given all the packages that were installed, running pacman -Syyuu took a long time, probably 8 to 10 minutes.

I think that situations such as this one you describe should be handled by requesting/requiring MSYS2 maintainers to release a new package. As you said, MSYS2 tarballs are updated once or twice a year. Overall, I'm ok with that. Nevertheless, if the latest is so outdated that 10min are required, I believe that's a fair point to nudge them. There should not be 10+ breaking changes to the core in a year anyway. Moreover, as you pointed, I believe they don't want thousands of potential CI jobs hitting their servers so hard.

For now, I'm just waiting for an independent, normal install in the image(s). I have an action (MSP-Greg/msys2-action), which uses the embedded MSYS2, and is directed towards gcc use.

I understand that Ruby-specific details might not fit in setup-msys2, so it would still make sense for you to keep your own action. Nonetheless, features such as having gcc and other build-essentials set up can be useful for many users. Hence, setup-msys2 might support some "preset" groups which are optionally cached separatedly. Of course, this is just me thinking loud. Regardless of our discussion, GitHub employees/maintainers might take any approach.

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 2, 2020

@eine

Nevertheless, if the latest is so outdated that 10min are required

Sorry, the main reason that pacman -Syyuu took so long is that they (AppVeyor) have a lot packages installed, see:
https://ci.appveyor.com/project/MSP-Greg/appveyor-ruby

But, the fact that they have all of those packages installed means something. As stated elsewhere, I feel that Actions should install standard compiler tools and leave individual packages up to the people using them.

as maintainer of PKGBUILD recipes for MSYS2

What packages do you maintain? Just wondering what you normally work with...

I understand that Ruby-specific details

It's not really Ruby specific, more about allowing installation of OpenSSL 1.0.2 when needed. I just provided an easy 'translation' for it into Ruby terms...

@eine
Copy link

eine commented Feb 2, 2020

What packages do you maintain? Just wondering what you normally work with...

GHDL, a FOSS analyser, compiler, simulator and synthesiser for VHDL: https://github.com/ghdl/ghdl/tree/master/dist/msys2-mingw It supports three different backends, so up to 6 different PKGBUILD files might exist. Currently, only two of them are maintained. Moreover, there are also variants to test 'stable' releases: https://github.com/eine/ghdl-packaging/tree/master/msys2-mingw. Hence, the full matrix might have up to 18 items.

@MSP-Greg
Copy link
Contributor

MSP-Greg commented Feb 3, 2020

See draft PR #355 for a ps1 script installing MSYS2 via download from repo.msys2.org.

@eine
Copy link

eine commented Mar 12, 2020

@AndreyMaslennikov, any updates on this?

@maxim-lobanov
Copy link
Contributor

@eine , we have reworked our approach a bit and still working on implementation / validation.
This PR can be closed but @m-minasyan will publish the new one soon

@eine
Copy link

eine commented May 28, 2020

Ref #928 #916 #906 #899 #355 #342

@joelvaneenwyk
Copy link

Awesome work on MSYS2 and so glad to see that merged in. The reworked pull requests seem to no longer include WSL support though. Any chance that part can come back? Help needed on that? Seems fairly trivial to enable and would make me (and likely others) insanely happy. If there are concerns / risks around enabling it please let us know. Having WSL enabled seems to also be the only legitimate path for Linux containers on Docker for Windows now that LCOW seems deprecated.

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

Successfully merging this pull request may close these issues.

9 participants