-
Notifications
You must be signed in to change notification settings - Fork 75
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
docs: add guide to setup windows machine for WSL #2876
Conversation
68272c9
to
eff6b87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow this is complicated - thank you for figuring this out!!! Just left various small comments in attempts to clarify
I think this can go straight into the docs
branch since it doesn't depend on an unreleased feature of pro-client.
Should this be in RST instead of markdown?
This how to guide will explain all the necessary steps for the setup, from launching the image | ||
from Azure to testing if WSL is correctly working on the machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This how to guide will explain all the necessary steps for the setup, from launching the image | |
from Azure to testing if WSL is correctly working on the machine. | |
This how-to guide will explain all the necessary steps for the setup, from launching the image | |
in Azure to testing if WSL is correctly working on the machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also specify the version of windows this is intended to be run on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The from/in issue is a bit ambiguous. The former implies that it's an Azure image, the latter implies it could be an Ubuntu image which we're launching in Azure. I think we intend the second case, based on the below sections, but I want to double check my understanding is correct here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a matter of taste, but wouldn' tit read better if we drop the how-to
part of the sentence : This how-to guide will explain all the necessary step...
. Also not being an explanation, but rather a how-to guide, shouldn't we rephrase that sentence into This guide presents all the necessary steps...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is the latter. We are launching a Windows machine in Azure. And I will also specify the Windows version here as well
integration tests. | ||
|
||
After that, select the `Windows 11` image and mark the `Security Type` as *Standard*. | ||
![windows_secuirty_type](windows-security-type.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![windows_secuirty_type](windows-security-type.png) | |
![windows_security_type](windows-security-type.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text in the square brackets is usually displayed as alt text. We should either change this to something more descriptive, or leave it blank.
Do we need to provide any guidance on image selection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add the following to this step:
The alternative "Trusted Launch" [doesn't support Nested Virtualization](https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch#unsupported-features), required to run WSL.
or something similar.
Although this is not an explanation documentation, if the user skips this step it can be really hard to figure out what is causing the error when trying to set up a WSL instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I will leave it blank
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
Now, install a Bionic instance to test the whole WSL setup is working as expected: | ||
|
||
```console | ||
$ winget install --id "9PNKSF5ZN4SW" --accept-source-agreements --accept-package-agreements --silent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this ID refers to the bionic wsl app? I think that deserves a short explanation and maybe also an explanation of how you got this ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that winget install --name "Ubuntu 18.04 LTS" --exact ...
would also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great suggestion for this guide. I will use it. Thanks @EduardGomezEscandell
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on the WSL side.
Note that our team does not Bastion nor SSH for this so I cannot comment on that part :)
Now, install a Bionic instance to test the whole WSL setup is working as expected: | ||
|
||
```console | ||
$ winget install --id "9PNKSF5ZN4SW" --accept-source-agreements --accept-package-agreements --silent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that winget install --name "Ubuntu 18.04 LTS" --exact ...
would also work.
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small nits and suggestions
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
When launching the Windows instance on Azure, there a few configurations that need to be performed, | ||
otherwise we will not be able to launch WSL instances. | ||
|
||
First of all, name the machine as `wsl-test`. Currently, this is the name we expect on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How/where do we do this? Or can we assume this is something people already know how to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Do we have a link to a guide that covers all this? If so, we can drop that in as a prerequisite step if it's out of scope for this article)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a specif link to launch a Windows machine, but this is one the first steps when launching a image in Azure, that's why I have not added any screenshots here. But I don't have a strong opinion. If you believe it is worth, I can add it. No problem at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I think it could be helpful to link to a guide on launching images in Azure if you know of a good one. It would be ++convenient for a reader who may not have used Azure before if we can cut out a bit of Googling for them, but it's not essential.
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good stuff! I only have minor comments, except for the Virtual Machine Platform
one that deserves a double-check.
This how to guide will explain all the necessary steps for the setup, from launching the image | ||
from Azure to testing if WSL is correctly working on the machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a matter of taste, but wouldn' tit read better if we drop the how-to
part of the sentence : This how-to guide will explain all the necessary step...
. Also not being an explanation, but rather a how-to guide, shouldn't we rephrase that sentence into This guide presents all the necessary steps...
?
integration tests. | ||
|
||
After that, select the `Windows 11` image and mark the `Security Type` as *Standard*. | ||
![windows_secuirty_type](windows-security-type.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add the following to this step:
The alternative "Trusted Launch" [doesn't support Nested Virtualization](https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch#unsupported-features), required to run WSL.
or something similar.
Although this is not an explanation documentation, if the user skips this step it can be really hard to figure out what is causing the error when trying to set up a WSL instance.
dev-docs/howtoguides/how_to_setup_windows_machine_for_wsl_testing.md
Outdated
Show resolved
Hide resolved
After that, just test to see if we can run commands on the WSL instance: | ||
|
||
```console | ||
$ wsl -d Ubuntu-18.04 --exec lsb_release -a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that running ubuntu1804.exe run
instead of wsl -d Ubuntu-18.04 --exec
is equally valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is totally fair. I am using wsl
here just because this is what I am doing on the integration tests
## Running the integration test | ||
|
||
After this setup, you should be able to use that machine to run the WSL tests automatically. | ||
Before running a WSL test, remember to set the following environment variables: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the environment variables inside each WSL instance subject to the integration tests or in the Windows host environment as well?
I suspect it's only the first, but wouldn't it be better to clarify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually neither of the options, we need to set up that up on your local machine. Our integration tests will use them to start and communicate with the Windows host machine and launch the WSL tests.
But I will make this more explicit
## Configuring Hyper-V | ||
|
||
After login into the machine through Bastion, you need to configure Hyper-V by following | ||
this [tutorial](https://learn.microsoft.com/en-us/azure/lab-services/how-to-enable-nested-virtualization-template-vm-using-script?tabs=powershell) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing a reference to the Virtual Machine Platform
optional feature. Does this step cover it?
We had this error when setting up a VM, fixed by setting that feature ON, if you remember:
WslRegisterDistribution failed with error: 0x80070424
Error: 0x80070424 The specified service does not exist as an installed service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I have found is that when just running wsl --install
, it already covers this step automatically.
But I will let @orndorffgrant and @renanrodrigo try this out first just to guarantee if this is indeed correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the Microsoft Docs, --install
does it for you. https://learn.microsoft.com/en-us/windows/wsl/install#install-wsl-command.
@CarlosNihelton and I are just not used to these new conveniences 😅.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed 😄
34bc2e9
to
c84b446
Compare
Thank you all for the review. I have updated the docs with all the suggestions made here |
To install it on the machine, follow this [tutorial](https://winget.pro/winget-install-powershell/) | ||
|
||
``` | ||
if you see the following error during installation, restart the machine first: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you see the following error during installation, restart the machine first: | |
If you see the following error during installation, restart the machine first: |
|
||
To install it on the machine, follow this [tutorial](https://winget.pro/winget-install-powershell/) | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` | |
```{note} |
|
||
|
||
```{note} | ||
We are installing the pre-release version because it allow us to directly run wsl commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are installing the pre-release version because it allow us to directly run wsl commands | |
We are installing the pre-release version because it allow us to directly run WSL commands |
|
||
To install OpenSSH server, follow these steps: | ||
|
||
1) Open *Settings* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I might have overlooked something, but what application are we using here?
|
||
To do that, follow these steps: | ||
|
||
1) Create a public key to be used in the Windows machine (You can also reuse an existing key if you want to) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1) Create a public key to be used in the Windows machine (You can also reuse an existing key if you want to) | |
1) Create a public key to be used in the Windows machine (you can also reuse an existing key if you want to). |
$ icacls administrators_authorized_keys /inheritance:r /grant "Administrators:F" /grant "SYSTEM:F" | ||
``` | ||
|
||
Now test SSH into the machine using your private key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now test SSH into the machine using your private key | |
Now test SSH into the machine using your private key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention that the private key here should not be password protected.
I tried reusing a key which had a password, and could not run the tests because pycloudlib would need the password for the key, and I could not pass it in any way. I am not even sure pycloudlib supports this?
Anyway, generating a passwordless key works.
* **UACLIENT_BEHAVE_WSL_PRIVKEY_PATH** | ||
* **UACLIENT_BEHAVE_WSL_PUBKEY_PATH** | ||
|
||
Note that this variables must be set on our local machine. The integration test setup will use them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this variables must be set on our local machine. The integration test setup will use them | |
Note that these variables must be set on your local machine. The integration test setup will use them |
* **UACLIENT_BEHAVE_WSL_PUBKEY_PATH** | ||
|
||
Note that this variables must be set on our local machine. The integration test setup will use them | ||
to stablish the connection with the Windows host machine to create the WSL instances the tests will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to stablish the connection with the Windows host machine to create the WSL instances the tests will | |
to establish the connection with the Windows host machine, to then create the WSL instances the tests will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few nits from me, otherwise looks good :)
After that, select the `Windows 11` image and mark the `Security Type` as *Standard*. | ||
![](windows-security-type.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screenshow shows Ubuntu not windows.
Also I see several Windows 11
s
- Windows 11 Pro
- Windows 11 Pro N
- Windows 11 Enterprise
- Windows 11 Enterprise multi-session
- Windows 11 Enterprise N
I'll try out the Windows 11 Pro for now but it would be good to choose a specific one for the guide
6763717
to
95323b9
Compare
@orndorffgrant I have fixed the issues you mentioned while also adding a paragraph about the license checkbox |
To install OpenSSH server, follow these steps: | ||
|
||
1) Open *Settings* | ||
2) Go to *Apps* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, Optional Features is in the "System" category, not the "Apps" category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct - I found it in Sysytem
2) Send the public key to the Windows machine: | ||
|
||
```console | ||
$ scp PUB_KEY_PATH ubuntu@$UACLIENT_BEHAVE_WSL_IP_ADDRESS:%programdata%/ssh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work for me but the following did
scp .ssh/wsl_test_rsa.pub ubuntu@$UACLIENT_BEHAVE_WSL_IP_ADDRESS:C:\\ProgramData\\ssh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both work for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am changing to the option that works for everyone
Add guide to setup windows machine for running our integration tests on WSL instances
@orndorffgrant @renanrodrigo updated |
Add guide to setup windows machine for running our integration tests on WSL instances