-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add Windows Subsystem for Linux to Windows #50
Comments
Where exactly would one send a PR for this anyway, there's no agent provisioning code in this repo, no? |
I don't think you can, at least I haven't found a way to do so. |
I feel like "proper" is a loaded word. In one way, WSL is a part of Windows and WSL2 is an actual Linux kernel, so one could argue that makes it more proper than MSYS2 which you need to install yourself and is a recompiled binary for Windows, not the actual Linux binary. I personally think WSL is more important to add, because you can (as I understand it) install MSYS2 yourself in the workflow run, not so much for WSL which needs to be enabled as a Windows component, which requires restart and at the current, the agents are not set up so that they could pick up a workflow run after their restart. |
@dcermak, so, you are implicitly asking for nested virtualization to be supported, isn't it? It seems that you don't want to just test WSL images as containers running on the existing Docker VM; instead you want to create your own VMs through WSL's cli. @TomasHubelbauer, I feel that you might have misunderstood when I used proper. Currently,
I didn't mean to say that MSYS2 is better or worse than WSL(2). Those are completely different products, and target audiences are very different.
@TomasHubelbauer, AFAIK, WSL(2) is not available in any version of Windows. You need HyperV support. Did it change?
AFAIK, WSL2 is based on HyperV VMs, which is where the actual kernel is located. Therefore, it is technically the same as Docker for Windows. Apart from that, WSL2 includes (borrows?) the compatibility layer that allows to use windows binaries from a shell with Linux syntax; which is what MINGW is about.
I expect both MSYS2 and WSL to be enabled eventually. That's why this issue and #30 exist. Furthermore, GitHub was bought by Microsoft, so they might have interest on promoting their own tools. Nevertheless, provided that Docker for Windows is already installed and available, I wonder what specific use case you have to depend on WSL. You should be able to run/use all the GNU/Linux binaries in containers. As for windows binaries, those work natively. The only feature I can think of is running windows binaries from a bash script. For that specific use, WSL2 seems overkill, and the already available bash (MINGW) should work. Overall, I'm not trying to argue against adding this feature. I'm just trying to understand why would one need WSL, if Docker and MINGW are already available. |
I did misunderstand, thanks for correcting me. You're right that you need HyperV, but I consider that to be a part of Windows like WSL, you don't need to install either, just enable (unless you're using the Home edition). My use case is actually the same as Dan's (not exactly a WSL image, but something which revolves around WSL specifically), I have a project which as a part of it uses WSL and I want to test it end-to-end in the pipeline. I can't replicate the test in any other way, because it specifically deals with WSL. In my case that's WSL1, but I do hope GitHub enables WSL2 as well as soon as it hits general availability. To provide a few more examples, I can imagine something like VS Code would benefit from this WSL support as well, as they have an extension which enables using the WSL file system as a remote file system, so that's something they could test. My project is similar in this way. |
Thanks for clarifying. I'm sorry that you both seem to be hitting one of the few cases (testing support for a default WSL installation) where there is no other workaround than actually using WSL(2). I hope that you get attention from GitHub/Microsoft employees, since this sounds like a relevant feature. |
I did also ask if WSL could be enable-able without a restart at microsoft/WSL#4743, but alas it looks like something which is not technically feasible, so indeed looks like this support landing will be the only way. |
eine <notifications@github.com> writes:
> Yes, if you want to test a WSL image, you actually do need WSL ;-)
@dcermak, so, you are implicitly asking for nested virtualization to be supported, isn't it? It seems that you don't want to just test WSL images as containers running on the existing Docker VM; instead you want to create your own VMs through WSL's cli.
I want to load a custom built WSL image inside a github action and run
some simple tests for it. I assumed that this requires WSL to be installed.
|
Just for extra information, we found that (older, but not sure how old) installations of WSL add a My understanding is that In short, just be aware that blindly installing this may interfere with how we currently run bash scripts on Windows |
@dcermak, @TomasHubelbauer, see #342 |
WSL or Cygwin are the only ways to build/run code on Windows that uses Unix fork(2). Msys/msys2/mingw don't support it. Cygwin's fork is pretty flaky, and Cygwin in general is quite slow. This leaves WSL as the preferred option. |
|
@unfor19, @Vampire, see actions/checkout#250.
I suggest using Action msys2/setup-msys2 instead of Chocolatey.
You might try defining a custom shell or an intemediate |
@umarcor I don't understand why you post this issue?
I suggest using neither of the three (manual download, Chocolatey or setup-msys2).
There are sooo many ways to do it right and you seem to have tried the one that does not work and gave up.
Actually the
If that was really the command you did, it shouldn't have complained about the Now a few different ways that work from which you can pick freely:
prefix both commands with
if somehow you really downgraded your PowerShell or something, just use
tell bash to evaluate the whole command chain
configure bash as shell for the run-step with options similar to what GitHub actions uses for Be cautious, this only works for one-liners, due to the same problem you had without the
as described in the last example, if you want a multi-line
and finally the most versatile example. If you do not have All these examples were done with this setup (for the
And i also tried with 20.04, same results
|
See actions/checkout#250 (comment):
Also actions/checkout#250 (comment). So, an alternative to using dos2unix is to execute |
That's actually just symptom treatment. |
I suggested MSYS2 instead of Chocolatey. Both are installed by default, both are better alternative to install dos2unix than doing it manually, and MSYS is better than Chocolatey. However, I agree that for this use case it is better to install none of them. That's why I referenced how to solve it through git config.
I suggested one that is known to work and which is used regularly by multiple users. Effectively,
This is precisely what is solved in setup-msys2 by using an intermediate file, and that's why I suggested it above.
I beg to differ. I am no one to tell maintainers of projects which I don't know how should they be saving their files in their repositories. Git allows to save scripts with either LF or CRLF, and it provides mechanisms to handle it. A possible solution is to always use LF. That's one only. Another solution is to use |
I'm sorry if I was unclear.
As I said, I did not say or intend to say that you said something wrong.
Neither do I. Hence I do not understand why you now start to attack me, saying I dictate anyone anyhting. |
@Vampire, the point is that this discussion has arised several times, with more or less aggressiveness. I understood some of your expressions as dismissing the provided solutions, which are the most straightforward among the multiple possible alternatives. When the option is included in v3 of Action checkout, it will be even easier. I did not try to personally attack you, but just point out that all the content I had provided was valid and that you rewrote it from a different point of view. All my points were/are technical about the implementations that have been referenced and/or explained. By the same token, I was implicitly validating your findings. In fact, I think that your tests might be useful as the foundation of a "setup-wsl" Action (similar to setup-msys2).
I think that using
I shared plenty of pertinent references to answer the technical details that are derived from the context. I did provide objective reasons only. The single point I did not explain is why MSYS2 is better than Chocolatey, but that's because it's off-topic and no one asked about it. I beg you not to accuse me of ad hominen attacks, and please do not do so precisely through it. If you feel that some technical point is unanswered or not discussed sufficiently, please do point it out. |
I did not want to dismiss any provided solution. I'm sorry if you interpreted it like that. Using git-config as symptom treatment is a perfect fine solution if you are just a consumer of the repo and the developer did not configure the But if you are the developer, then imho it is your responsibility to configure the |
TL;DR- we all have good intentions |
Howdy! I tried a few of @Vampire's suggestions, but i'm not able to get WSL working. Here's my yaml configuration: - name: Set up WSL
shell: powershell
run: |
$url = "https://aka.ms/wslubuntu2004"
$output = ".\Ubuntu.zip"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
Expand-Archive .\Ubuntu.zip .\Ubuntu
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
.\Ubuntu\ubuntu2004.exe install --root
- name: Set up repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Run a test
shell: wsl bash --noprofile --norc -euo pipefail "$(wslpath '{0}')"
run: echo hello-world After the install step, I see But on attempting to invoke
Am I missing something here? A quick google search indicates that this may be a corrupted WSL installation |
I have not the faintest idea why, but it is the |
Btw. |
@Vampire it is because your code downloads and unpack Ubuntu to the working directory. |
Ah, that makes sense of course, thanks. |
* Move to kotlin 1.4.0-rc * Removing broken WSL bash see actions/runner-images#50 Co-authored-by: Salomon BRYS <salomon@kodein.net>
They were :-) |
Tool information
Virtual environments affected
Can this tool be installed during the build?
No, it requires a reboot of the Windows machine.
Are you willing to submit a PR?
Willing yes, able: no (I have literally zero Windows experience). In theory you just have to run:
as the administrator and reboot.
The text was updated successfully, but these errors were encountered: