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

bash missing in windows-2019 image version 20210309.0 #2961

Closed
1 of 7 tasks
ned14 opened this issue Mar 17, 2021 · 6 comments
Closed
1 of 7 tasks

bash missing in windows-2019 image version 20210309.0 #2961

ned14 opened this issue Mar 17, 2021 · 6 comments
Assignees
Labels
Area: Scripting and command line investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows

Comments

@ned14
Copy link

ned14 commented Mar 17, 2021

Description
Calling bash from within cmake on windows-2019 image version 20210309.0 yields:

stdout was: Windows Subsystem for Linux has no installed distributions.


  Distributions can be installed by visiting the Microsoft Store:


  https://aka.ms/wslstore

See https://github.com/ned14/llfio/pull/70/checks?check_run_id=2132363419

The exact same script works fine in the windows-2016 image. See https://github.com/ned14/llfio/pull/70/checks?check_run_id=2132363324

Area for Triage:

Containers

Question, Bug, or Feature?:

Bug

Virtual environments affected

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10.15
  • macOS 11.0
  • Windows Server 2016 R2
  • Windows Server 2019

Image version
20210309.0

Expected behavior
bash to be callable from within a cmake script.

Actual behavior
Not the error listed above.

Repro steps

You can retrigger the build on the PR at ned14/llfio#70 to diagnose the situation and/or check the fix.

@miketimofeev
Copy link
Contributor

miketimofeev commented Mar 17, 2021

Hi @ned14!
First of all, we don't have wsl on windows 16 because it's available for windows server 19 only. And in windows 19 there is no pre-installed wsl linux distribution that's why bash couldn't be found for wsl. You can use the following task to setup Linux distribution of your choice for wsl https://github.com/marketplace/actions/setup-wsl

@ned14
Copy link
Author

ned14 commented Mar 17, 2021

First of all, we don't have wsl on windows 16 because it's available for windows server 19 only. And in windows 19 there is no pre-installed wsl linux distribution that's why bash couldn't be found for wsl. You can use the following task to setup Linux distribution of your choice for wsl https://github.com/marketplace/actions/setup-wsl

Have you inverted the bug report?

  • windows-2016 provides working bash.
  • windows-2019 does NOT provide working bash.

https://github.com/actions/virtual-environments/blob/win19/20210309.0/images/win/Windows2019-Readme.md says bash is installed in windows-2019.

The GA linked to is 100% Windows, building Windows binaries on Windows to be CIed on Windows. Yes it calls bash on Windows, but that is supposed to work as per the virtual environment spec. It DOES work on windows-2016. It does NOT work on windows-2019.

If you're saying that I need to install a WSL to get bash, then I think you need to update https://github.com/actions/virtual-environments/blob/win19/20210309.0/images/win/Windows2019-Readme.md to say so.

Edit: What happened to the bash which msysgit installs on Windows? I don't care which bash it is, so long as it is called bash and it executes from the Windows command box. I certainly don't need WSL, your WSL GA action appears to install wsl-bash not bash which doesn't help me.

@miketimofeev miketimofeev added investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows and removed needs triage labels Mar 17, 2021
@miketimofeev
Copy link
Contributor

miketimofeev commented Mar 17, 2021

@ned14 it looks like both win16 and win19 steps use gitbash (which is mentioned in the docs):
image
The question is why win19 step tries to use wsl bash at the end for tarring up binaries

CMake Error at D:/a/llfio/llfio/quickcpplib/repo/cmakelib/QuickCppLibUtils.cmake:95 (message):
  FATAL: Tarring up binaries 9 failed with error '-1'
 

  stdout was: Windows Subsystem for Linux has no installed distributions.

@miketimofeev
Copy link
Contributor

Probably the PATH changes during the execution, and after that C:\windows\System32 directory comes first in the PATH — it explains the reason why this code tries to invoke bash from wsl

    checked_execute_process("Tarring up binaries 9"
      COMMAND bash -c "mv ned14-outcome* llfio/include/outcome"
      COMMAND bash -c "mv ned14-quickcpplib* llfio/include/quickcpplib"
    )

image

@vsafonkin vsafonkin self-assigned this Mar 18, 2021
@vsafonkin
Copy link
Contributor

vsafonkin commented Mar 18, 2021

Hi @ned14, as @miketimofeev mentioned above, most likely the changes of PATH are reason of fail. As workaround you can add the step to rename wsl bash:

- name: Rename wsl bash
    if: matrix.image == 'windows-latest'
    run: |
      takeown /F C:\Windows\System32\bash.exe
      icacls C:\Windows\System32\bash.exe /grant administrators:F
      ren C:\Windows\System32\bash.exe wsl-bash.exe

@ned14
Copy link
Author

ned14 commented Mar 18, 2021

That was a very useful reply in fact. I now have the CI ctest script find_program() bash in BASH_COMMAND before doing anything else. Then when PATH changes later on, it doesn't matter.

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Scripting and command line investigate Collect additional information, like space on disk, other tool incompatibilities etc. OS: Windows
Projects
None yet
Development

No branches or pull requests

3 participants